Tag Archives: stsadm

How to Create a Host Header Site Collection in WSS3 and SharePoint Foundation 2010

For WSS3 and MOSS you will have to open the CMD and use “stsadm” function. Here is the syntax:

1
stsadm -o createsite -url http://yourdomain.com -owneremail user@yourdomain.com -hostheaderwebapplicationurl htt://yourwebapplication.com

You can also give a check at the Microsoft Technet reference: http://technet.microsoft.com/en-us/library/cc262594%28office.12%29.aspx

In SharePoint Foundation 2010 you will have to use PowerShell which comes with Windows Server 2008.

First run:

1
Add-PSSnapin "Microsoft.SharePoint.PowerShell"

Now lets add a new site collection with host header (be sure to configure the command accodring to your server settings – link):

1
New-SPSite http://www.newdomain.com -OwnerAlias SERVER2008\Administrator -HostHeaderWebApplication http://server2008

Sooner or later you will also like to know which Site Collections there are in you Web Application (link). You can either look for it in Central Administration but you can also run a command in PowerShell:

1
Get-SPWebApplication http://server2008 | Get-SPSiteAdministration -Limit ALL | Select URL

Finaly, you do not want to use your Site Collection any more. Lets delete it (link):

1
RemoveSPSite -Identity "http://www.deletethis.com" -GradualDelete

‘Stsadm’ is not Recognized as an Internal or External Command, Operable Program or Batch File.

Add stsadm.exe to default system paths: make your system able to execute stsadm no matter what folder you are in.

Go to Control panel > System > Advanced system setings

Under “System Variables” click Path (You will need to scroll down a bit – see the image attached). Click edit. At the end of the line add:

;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN

I was at my friend Jose Antonio Morales the other day. He had the same problem. Usualy he was solving this problem by just copying the stsadm.exe file to c:\ and than run all commands from there. But the problem with this approach is that the stsadm.exe in c:\ does not get updated, so he could not use the stsamd -o rename function.