Archive for the ‘Uncategorized’ Category

More Help with SharePoint Management Shell

Wednesday, March 17th, 2010

Our new best friend, Dan, has posted this that helps with anyone that trying to get to their SharePoint farm from the SharePoint Management Shell (SMS.)

We have to remember that when we’re running PowerShell, we’re given permissions according to the account that we logged into Windows with. This is a little different than in the SharePoint GUI where what we see depends on who we are but the actions we take are often executed using the application pool account. What that means is that when we’re running PowerShell and .ps1 scripts, we have to be sure we’ve got the necessary permissions to complete our tasks. Dan’s post covers most of that.

hth

-robot

Still Working Through the Codeplex Autointaller Script

Wednesday, March 10th, 2010

We’re still trying to decode the SharePoint 2010 Autoinstaller Script from CodePlex.

We got the Throw thing figured out thanks to TechNet which offers this little demo:

function Get-XMLFiles
   {
   param ($path = $(throw "The Path parameter is required."))
   dir -path $path\* -include *.xml -recurse | sort lastwritetime
   |  ft lastwritetime, attributes, name  -auto
   }

Which is all good except trying to figure out what to do with it. I found this from our new best friend Dr. Tobias. Of course, we know saving this into a .ps1 script will make it run but, in the console, you have to learn to do multi-line entry and Dr. Tobias covers that straight away.

So looking that the function we’ll create, we see we enclose the code in {curley braces} and we have a param section. Here we drop our variable $path and we set it’s initial value to $(Throw “blah blah blah”) What this does is poke the Throw to the processor unless it’s replaced by an alternative at runtime.

Hence, get-XMLFiles (‘C:\’) will return all the .xml files on your C: drive.

You’ll also see that the -include option filters the return to .xml files, the -recurse option makes it dig down into folders and sub-folders, the  sort sorts the output and the ft formats the output into a nice table with the designated headers. Note also that the parameter is passed inside parenthesis and single quotes. I presume you’d separate multiple paramerters with a comma.

Essentially, in the Get-XMLFiles function, it’s give me a path or I’ll barf. I’ve been there.

In the AutoInstaller script, the script itself has a parameter block, so when the script is called, it better get passed a configuration file or it’s barf city. I’ve been there too.

The one thing I don’t know is how to list the function code after it’s built. I presume I can just rebuild it with new code but I don’t know how to get what I’ve got in there to make minor edits. So I turned to our new best friend Lee who talks about environment variables here. From what he says, I figured out that a get-content function:<function name> will display the code supporting a given function.

Progress. That’s good.

-robot

How’s it Work?: Codeplex AutoInstaller Script

Tuesday, March 9th, 2010

So since we’re expert at beginner PowerShell Scripts, maybe we should take a look at the AutoInstaller on CodePlex. Download it and you’ll find it’s got an AutoSPInstaller.ps1 script inside.

It takes about two seconds to see we got work to do. First, there’s this issue of the:

param
(
    [string]$InputFile = $(throw 'need parameter input file
    (e.g. "c:\SP2010\Scripted\SetInputs.xml")')
)

So I can’t quite crack this but when you look at get-help throw, you see it looks like they’re making the path a required parameter or bailing on the script.

The second issue is that of iterating through an XML file. Now I imagine we’re going to put all our configurations in an XML file and the script will read it and call the SharePoint Management Shell commands that use them to build your whole farm with one click. Groovy.

So how do we iterate through an XML file? Well, our new best friend, Dan, covers it pretty good here. He’s got the best line of the day:

With some practice you actually can drive nails with a screwdriver and then you only need to learn how to use one tool to build a house.

I gotta tell you guys and gals, I see alot of myself in that one-tool group. So maybe Dan will help. The problem is that his example is a grocery list and it’s almost supper time so, I’m heading out to:

  1. Buy Groceries
  2. Make Dinner
  3. Iterate…

Sound like an exciting evening for a robot.

-robot

Create and Delete Web App, Site, and Web using PowerShell

Friday, March 5th, 2010

SharePoint 2010 retains the ambiguous naming of the various containers so that anyone new to the technology will end up getting confused. As a result, I feel compelled to explain, as best I can, everytime the subject comes up, the relationships using the appropriate terms: Web Apps, Sites and Webs. At the same time, we can hook them in our head to the SMS commands that we use to work with them.

Web Apps are an IIS entity. Consequently, while web apps can share ApplicationPools, everything in a single web app shares a single Application Pool. Also, while a single web app can support any number of site collections, it can only have one host header. This means that one site collection can own the host header url : http://<host header> while all the other will have a url: http://<host header>/SiteCollectionTopLevelSiteName.

In SMS we use new-SPWebApplication and remove-SPWebApplication to create and destroy web apps.

From the SharePoint administrators’ point of view, a “Site” is really a “Site Collection” which is a single top-level site and zero or more sub-sites. Interactively, Site Collections are created in Central Admin and are assigned to a specfic web app and have their own content database. If there’s already a Site Collection using the web app’s host header, Central Admin will make you give it a URL under that host header.

In SMS we use new-SPSite and remove-SPSite to create and delete a site collection.

Finally, a Web, aka Team Site, is a single SharePoint site. It uses a site template and can support any number of sites below it. Webs are either a top level site or a sub-site.

In SMS, we use new-SPWeb and remove-SPweb to create and delete webs.  

So, after you install SharePoint, if you can open Central Admin and if you can open the SharePoint Management Shell, you can create and delete Web Apps, Sites and Web at will. While it’s easy enough using Central Admin, I was thinking the script that does all of this might be interesting.

I came up with this:

function Pause ($Message="Press any key to continue...")
{
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host ""
}

Set-ExecutionPolicy RemoteSigned

New-SPWebApplication -Name MyHostHeader -Port 80
   -HostHeader MyHostHeader -URL http://MyHostHeader
   -AllowAnonymousAccess -ApplicationPool MyHostHeaderAppPool
   -ApplicationPoolAccount (Get-SPManagedAccount MyServer\SVC_SPAppPool03)
ECHO "Web Application Created"
ECHO ""
PAUSE

New-SPSite -Url http://MyHostHeader -OwnerAlias MyServer\Administrator
   -Name MyHostHeader -Template "STS#0"
ECHO "Site Collection Created"
ECHO ""
PAUSE

New-SPWeb -Url http://MyHostHeader/TeamSite -Template "STS#0"
ECHO "Team Sub-Site Created"
ECHO ""
PAUSE

Remove-SPWeb http://MyHostHeader/TeamSite
ECHO "Team Sub-Site Deleted"
ECHO ""
PAUSE

Remove-SPSite -Identity http://MyHostHeader
Echo "Site Collection Deleted"
ECHO ""
PAUSE

Remove-SPWebApplication -Identity http://MyHostHeader
   -DeleteIISSite -RemoveContentDatabase
Echo "Web Application Deleted"
ECHO ""
PAUSE

To see it work, copy it to Notepad and delete the line breaks I added to help with formatting here on the page.  Save it as MyScript.ps1. Open your SharePoint Management Shell and run it by using the full path and filename. If you navigate to the folder where you saved it, you have to call it with:

 .\MyScript.ps1

This will create a web app, site and web and then delete the web, the site and the web app, each time, pausing so you can browse out an see it. I got the PAUSE function from the PowerShell Team blog here.

hth

-robot

Tuesday, March 2nd, 2010

Okay, we know not to try to browse to web applications with non-standard host headers from the server because the loop back restrictions Windows places on us. Here, they explain that we can hack the registry to eliminate the problem but that’s not really necessary for our purposes now.

So let’s look at the SMS command for our new web application:

New-SPWebApplication
-Name "Contoso Internet Site"
-Port 80
-HostHeader sharepoint.contoso.com
-URL https://www.contoso.com
-ApplicationPool ContosoAppPool
-ApplicationPoolAccount (Get-SPManagedAccount MyServer\Administrator)

Now, I’ve added line breaks for readability so we’ll have to delete them to make it work. I’ve also created the managed account on Central Admin’s Security | Configure Managed Accounts.

It runs for a minute and I get a return of:

DisplayName               Url
-----------               ---
sharepoint.contoso.com    http://www.contoso.com

Now, I can’t browse to it locally, but I can from another computer. Of course, there will be an issue with DNS, but I added www.contoso.com to my hosts file and pointed it to the SharePoint server.

So I browse to the site and I get prompted to login, but then I get The webpage cannot be found. This makes sense because there’s no site collection installed there yet. When we did this interactively in CA, it gave us a popup window that told us to go create a site collection.

Let’s go back to CA and look at Application Management | Manage Web Applications and you’ll see the new web application listed. What we need to do is go back to the Application Management pages and click Create Site Collections. Here, our new web application will appear in the web app pull down; if not, pull it down and select the new web app. We give it a name, select a template, specify an owner and click OK. After it processes, we can get a link to our new site collection’s home page. Click it and it will prompt us to login and there it is.

We can back out by moving to the Application Management page and, in the Delete a Site Collection. Pull down the Site Collection pick list and click on Change Site Collection. Here, we get another pull down to select the site collection we just created. Now, we also get an option to select any additional site collection we may have created in the selected web application. When we can click OK, we go back to the delete page and we click Delete. We get a dialog box to confirm and click OK.

We go back to the Application Management page and we can click on Manage Web Applications, select our web application and click Delete. This time we get a DHTML popup where we dot the options to delete the content database and the IIS web site and click Delete and then OK on the confirmation popup.

So, next, what we want to do is add to our new web app command to allow anonymous access and then we’ll add the command to create the site collection creating our first SMS script to do both at once. Then we’ll do another script to work the delete.

 hth!

-robot

SharePoint 2010 Depoloyment Issues\86 SSP

Friday, February 26th, 2010

With the server up and running, at least in Stand Alone mode, we’re beginning to encounter some issues.

First of all, we had trouble with our installation on a domain controller. The wizard did not offer a “Complete” option and barfed on Stand Alone. Then, on a non-domain server, it barfed on Complete. Hence we’re currently at stand alone SharePoint on a stand alone server. There’s a thread in TechNet that’s tracking a similar issue.

Next, sometimes, when we create a web application, we’re having trouble logging in. We’ll be looking at that in more detail here today.

I expect we’ll find more as we work to resolve these and encounter all the new functionality of SharePoint Server offers. No doubt, one of the first things you’ll notice is that we’ve lost our Shared Service Providers. Instead, these services are integrated more tightly into Central Administration on the Application Management page where you get a Service Applications linkgroup. In that  group there’s the Manage Service Appliations link.

I gotta admit, while this looks a little familiar, the User Profile Service, for example, there a number of new toys in here. It’s going to take some doing to nail these down but we’ll make a list and see if we can get them one at a time.

TTYS

-robot

SQL Server 2008 Install – Second Try

Tuesday, February 23rd, 2010

The SQL Server install didn’t go well. I tried to install the full suite and four of the five services failed.

So I reverted and thought I’d explore a different track.

First of all, I was trying to use the free SQL Server Developer Edition x64 that I got from the Heroes Happen Here Road Show. I know that version expires in 180 days but it was in hand and I had used it successfully before.

For this second try, I was considering alternatives. Microsoft offers this download that’s also good for 180 days. It’s a 1gb+ download so I started it and went to get some coffee.

Once it’s completed downloading, I run the setup.exe program. I check my prerequisites and it warns me about installing on a domain controller. Then I check the Installation tab and select New Installation. It runs the setup configuration check and I pass seven of seven. I click OK.

I specify Enterprise Evaluation and click Next.

I accept the terms and click Next and then Install.

Again, it warns me about the domain controller. It also mentions firewall rules saying:

..make sure the appropriate ports are open to enable remote access. See the rules documentation at http://go.microsoft.com/fwlink/?LinkID=94001 for information about ports to open for each feature.

Since I’m not looking for remote access at this point, I click Next.

I get a Setup Role page. It wants me to setup Analysis Services with SharePoint Integration. I’ll forego that for now, hoping just to get the database engine to start. I may have to retrace my steps to get this to work later. I click Next.

On the Feature Selection page, I just check the Database Engine Services, Full Text Search and the client tools and click Next.

The Installation Rules page tells me nothing will be blocked. This time, I pass five out of five. I click Next.

I leave the default instance checked and click Next.

It tells me I’ve got enough disk space and click Next.

I tell it to use the same account for all services. I enter the user name and password of the service account I created earlier which is a domain admin account. I click OK on the username box and then I click Next.

I select Mixed Mode authentication, enter an SA password. I add the current user as a SQL Server admin and click Next.

I let it send whatever it wants to Microsoft and click Next.

The Installation Configuration Rules page tells me I’ve passed four out of four. I click Next.

I get a summary and I click Install.

@Success (tipping my hat to my Domino programmer buddies)

I open SQL Server Management Studio, watch the progress lights and I get the SQL Server login window.

I try MyNewDomainController.MyNewDomain.com: No Good.

I try the IP address: No Good

My error, in both cases is:

Cannot connect to 192.168.1.20

A network-related or instance specific effor occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and then SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a conection to SQL Server)(Microsoft SQL Server, Error 5)

I found this from our new best friend Pinalkumar. At his suggestion, I check the services in the Configuration Manager. The SQL Browser and SQL Agent weren’t running so I started them both. Still no luck but, also at his suggestion, I try to connect to LocalHost. Again @Success. I can also connect to MyNewDomainController which is the computer name but not the FQDN which is MyNewDomainController.MyNewDomain.com. I noticed that the Browser service and the FT Scheduler Daemon were set to manual startups. I changed them to Automatic.

I look deeper into the Configuration Manager and I see that the SQL Server Network Configuration has a Protocols for MSSQLSERVER and, among those protocols, TCPIP and Named Pipes are disabled. I enable them and restart the services.

Also, I realize my network adapter was told to use external DNS so IP will not be looking to MyNewDomainController to resolve host names. So I added MyNewDomainController and MyNewDomainController.MyNewDomaincom to my hosts file pointing to the LAN IP address.

Finally, @Success one last time. I can connect to my SQL Server using computer name, FQDN, IP address and localhost.

Pinalkumar also has some help with the Firewall settings but his screenshots show Windows Vista. One day, I’ll have to figure this one out.

I’ll restart and take a snapshot here before I backtrack to install Report Services and Analysis Services. Then we can try the SharePoint 2010 install.

HTH

-robot

SPS 2010 Install – SQL Server 2008

Monday, February 22nd, 2010

So we have new VM domain controller and now we’ll try to get SQL Server to run.

I have the install disk in my metal server and so, in the VM, I have to uncapture the CD drive and then recapture it with the new disk.  It wants to auto start. I click OK and click Install Server Components.

I accept the license terms and click Next and then Install.

The Intstallation Center opens. I click New Installation. The wizard does a configuration check, I pass7 and fail none. I click Next.

I check the Database engine, Analysis Services and Reporting Services, the client tools,BIDS and Integration Services and click Next.

I accept the default instance and file locations and click Next.

I have to add a service account for the SQL Server Agent, the server itself as well as AS and RS. Start |  Administrative Tools | AD Users and Computers opens the ADU&C management console. I right click on Users and select New and then User. I give the new account a name and a logon name SVC_SQLServer. I give him a password and click Finish. Then I add him to the domain administrators group.

Back on the SQL Server Configuration wizard, I enter this account in the Use the same account for all fields and click Apply to all and then Next.

I allow for mixed mode security and enter an sa password. Then I add the current user, MyNewDomain\Administrator and my SQL Server service account, MyNewDomain\svc-sqlserver to the SQL Server administrators group and click Next.

I add the current user and the SVC_SQLServer acocunt to the Analysis Services configuration page and click  Next.

Then, I choose this option: Install the SharePoint mode default configuration. I let the server send whatever it wants to Microsoft. I click Next and it tells me it’s ready to install.

I click Install.

The database engine services, reporting services and analysis services fail. All I can do is click next. It points me to a .txt file in c:\program files\Microsoft SQL Server\100\Serup_Bootstrat\log\20200222_1720\MyDomainController)20100111_1720_Summary.txt.

That file tells me to check the logs to figure out what went wrong.

Not a great conclusion to a day’s work.

-robot

SPS 2010 Install – Windows Server 2008 and ADDS

Monday, February 22nd, 2010

You guys know I’m no Windows expert; I’m way too easily frustrated. It’s great to have experts to lead us. I’m going to try this item from CodeProject.com to create a domain conttoller with the hopes of mapping the whole SPS 2010 instsall.

There’s alot of material to cover so this may take a few tries. I’m using the Server 2008 R2 x64 on a the Dell host I’ve talked about earlier.

Creating a new virtual machine is pretty easy in the Hyper-V manager. I told it to  give it 4gb RAM, give it a LAN connection and install an OS from the host CD drive when it starts up. The Windows Server install starts up and asks some rudimentaty setup questions. Click, click, click and you get a cool little status bar that says  2. Installing Windows.

This looks like it may take a little while. 5% in five minutes; makes the math easy.

brb… I’m expanding files…

Expanding files is a non-linear process since it finished in less than 20 minutes, The VM reboots and it comes up with an OK\Cancel screen that says I have to change my password. I click OK. My user name is Administrator and I have to enter a password twice.

It prepares my desktop and gives me a set of configuration tasks.

  • Activate Windows
  • Set Time Zone
  • Configure Networking – It already read the DHCP since I told the VM to attach to the LAN.
  • Provide computer name and domain – I don’t have a domain yet but I’ll name it MyDomainController and leave it in the default workgroup.

Reboot.

I check for and install 15 updates. This takes about 20 minutes and requries another reboot.

I get to Add Roles.

The Select Server Roles dialog wizard opens up. On the Server Roles tab, I check Active Directory Domain Services (ADDS). A second dialog box pops up asking to add the .Net Fx 3.5 features required for ADDS. I click Add Required Features button.

When I try to add any other roles, I get an error that says ADDS has to be added alone.

So, I uncheck ADDS and check the application server and the Web Server instead. When I click through the rest of the dialogs, these roles install and then I need to reboot.

After the reboot, I go back to add the ADDS role and click Next.

I get a page of information including that I have to run DNS and DCPromo.exe to complete my setup. I click Next and then Install. The progress bar takes a minute and I get the results page that indicates success.

I open a command window and run DCPromo.exe

I get the ADDS Installation Wizard. I check Advanced mode for good measure and click Next.

I get this schpeil about OS Compatibility. This is way complicated so I ignore it and click Next promising myself I’d go look at the KB article to which it refers.

I dot the Create a new domain in a new forest option and click Next.

It wants the fully qualified domain name of this new forest. I enter MyNewDomain.com and click Next.

The wizard checks for naming conflicts and gives me a NetBiosName: MYNEWDOMAIN. I click Next.

It asks me for a functional level. I choose Windows Server 2008 R2. Again, I’m flying blind here.

It tells me it needs a DNS server. It told me it would do this earlier so I leave the box checked and click Next.

Here it barfs on dynamic IP address. I never gave this box a static IP so I have to tell it I will by clicking on the No, I will assign.. option and it takes me back to the Installation Wizard.

I go to the Network and Sharing Center and click on the Local Area Connection and then on the Properties button. Click on IPv4 and then Properties. Here I claim a static IP address suitable to my router and add in the DNS servers that my host server uses.

I go back and click the No, I will assign.. button again.

Here, it warns me that the DNS servers I just picked do not recognize my new domain name. This is not surprising as I will have to update the internet using my registrar’s software.  I tell it I want to continue all the same.

I’ve only got the one hard drive so all my DNS files go on there. I click Next. I enter my new domain Restore Mode Admin’s password. I enter it twice and click Next here  and again on the Summary page.

Then I get a Finish page and I click Finish and reboot.

When the machine restarts, it prompts me for the MyNewDomain\Administrator password. I enter it and everything is good. Since this is a virtual machine, I go back to the Hyper-V manager on my host and take a snapshot. At this point, I think I can revet to this state at any time in the Hyper-V manager. This is good, because in the past, I have always screwed something up in the subsequent steps and wanted to start over. It’s good to know I can spin up a fresh domain controller any time I want. 

- robot

The virtual machine could not be started because the hypervisor is not running.

Thursday, February 18th, 2010

Where was I when they covered the Hypervisor? Apparently I my mind was wondering but, I looked here at social.technet.microsoft.com and see an explanation of this hypervisor thing. Seems it’s a low-level setting made available in the BIOS.

On the Dell, I press f2 as the machine boots and navigate down to CPU Info where there’s a Virtualization Technology setting set to…

yup, DISABLED.

I used the right arrow to change it to ENABLED and press escape, save and exit.

The machine reboots. But the article says do a “Cold” reboot which, to me, means unplug the damm thing. I shut down, pull the cord and count to 20, plug it back in and hit the on button.

After it starts, I open the Hyper-V manager, select the VM, right click and select Start. It seems to be working. It’s running; I click Connect, It’s applying settings.

Press CRTL + ALT + DELETE to log on.

I get an EULA and click OK. There’s a Warm Up program that bangs on all the pages and pre-compiles them.

I move away from the VM to my host and browse to http://intranet.contoso.com and in a moment… DORKS!

It’s not really an install but it’s running. Now, I wonder how I can get my dual monitors to work with my VM on my server that I’ve remoted to… It’s good to have goals.

hth

-robot