This project has moved. For the latest updates, please go here.

Script halted


Got to the part where the Webapplications is created and the site collection

Exception             : System.ArgumentException: The URL 'http://URLPORTAL' is in use as an alternate access URL or as the URL of a host header site.  Please choose a different URL and try again.
at Microsoft.SharePoint.Administration.SPSiteCollection.ValidateSiteUrlEx(SPWebApplication application, SPUrlZone zone, String& siteUrl, Boolean useHostHeaderAsSiteName, Uri& fullUri, String& strFullUrl)
at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, SPSi
teSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID
, Int32 compatibilityLevel, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName, Boolean overrideCompatibilityRestriction) at Microsoft.SharePoint.PowerShell.SPCmdletNewSite.CreateDataObject()
at Microsoft.SharePoint.PowerShell.SPNewCmdletBase`1.InternalProcessRecord() at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord() TargetObject          : Microsoft.SharePoint.PowerShell.SPCmdletNewSite CategoryInfo: InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite], ArgumentException
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
Do I run the script again or can I resume from where it halted or is the rest manual work (and what's missing to do? ??


MikeEggert wrote Oct 16, 2013 at 4:00 PM

This looks like the error that you get when you are creating a host-named site collection for your portal web app. When you initially create your farm (and web app), you need to deselect/clear the "Use Host Header" check box for the portal web app. Note, the "Use Host Header" check box will remain selected for the "My Sites" web app. Additionally, use the URL for the actual server name (i.e. "http://win2012spabc123"). Do not use a user friendly URL, as you would for an alternate access mapping. You will use a user friendly URL for a host-named site collection later (after AutoSPInstaller is finished). When AutoSPInstaller is finished creating the web app, you will have a root site collection with the server name for the URL. You use that as a root site collection to support creating host-named site collections.

Bear in mind, this applies to host-named site collections (NOT host headers). Using host headers means that IIS will handle the request. Using host-named site collections, means that IIS will simply pass the request up to SharePoint to handle it.

Here are some sample PowerShell commands to use to create a web app, root site collection, and host-named site collections (referencing the root site collection):

1) Create Web-Application (this is created by AutoSPInstaller, you can delete that web app and use this if you like)

New-SPWebApplication -Name 'Portal' -port 80 -ApplicationPool Portal -ApplicationPoolAccount (Get-SPManagedAccount 'DOMAIN\SP_ServiceAccount') -AuthenticationProvider (New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication)

2) Create root site collection (SP2013APP is the server name. This is also created by AutoSPInstaller, you can delete that root site collection and use this if you like. You will need to use this to create the root site collection if you delete the web app above in #1.)

New-SPSite 'http://SP2013APP' -Name 'Portal' -Description 'Root Site Collection' -OwnerAlias 'DOMAIN\SP_AdminAccount' -language 1033 -Template 'SPS#0'

3) Create host-named site collection for a content type hub

New-SPSite 'http://cthub.lab.local' -HostHeaderWebApplication 'http://SP2013APP' -Name 'CTHub' -Description 'Content Type Hub' -OwnerAlias 'DOMAIN\SP_AdminAccount' -language 1033 -Template 'STS#0'

4) Create host-named site collection for an authoring portal

New-SPSite 'http://authoring.lab.local' -HostHeaderWebApplication 'http://SP2013APP' -Name 'Authoring' -Description 'Authoring Portal' -OwnerAlias 'DOMAIN\SP_AdminAccount' -language 1033 -Template 'SPS#0'

5) Create host-named site collection for a product catalog

New-SPSite 'http://productcatalog.lab.local' -HostHeaderWebApplication 'http://SP2013APP' -Name 'Product Catalog' -Description 'Product Catalog' -OwnerAlias 'DOMAIN\SP_AdminAccount' -language 1033 -Template 'PRODUCTCATALOG#0'

6) Create Enterprise Search Center

New-SPSite 'http://search2013app.lab.local' -HostHeaderWebApplication 'http://SP2013APP' -Name 'Search' -Description 'Enterprise Search Center' -OwnerAlias 'DOMAIN\SP_AdminAccount' -language 1033 -Template 'SRCHCEN#0'