Error running AutoSPInstaller and creating Web App

Apr 14, 2013 at 3:11 PM
Hi,

I am running SPInstaller to set up a multi tier farm but the script keeps failing with the follow error message. I have tried to change the site collection but i am still running into the error and not sure what i need to change in the script to get past this point.

- Creating Site Collection "http://portal.virtualworks.com/"...

  • Script halted!
Exception : System.ArgumentException: The URL
                    'http://portal.virtualworks.com/' 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.SPSiteCollect
                    ion.ValidateSiteUrlEx(SPWebApplication application,
                    SPUrlZone zone, String& siteUrl, Boolean
                    useHostHeaderAsSiteName, Uri& fullUri, String&
                    strFullUrl)
                       at Microsoft.SharePoint.Administration.SPSiteCollect
                    ion.Add(SPContentDatabase database, SPSiteSubscription
                    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.C
                    reateDataObject()
                       at Microsoft.SharePoint.PowerShell.SPNewCmdletBase`1
                    .InternalProcessRecord()
                       at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessR
                    ecord()
TargetObject : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
CategoryInfo : InvalidData:
                    (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite)
                    [New-SPSite], ArgumentException
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at CreateWebApp, C:\SP\2013\AutoSPInstaller\AutoSPInsta
                    llerFunctions.ps1: line 2111
                    at CreateWebApplications, C:\SP\2013\AutoSPInstaller\Au
                    toSPInstallerFunctions.ps1: line 1966
                    at Setup-Farm,
                    C:\SP\2013\AutoSPInstaller\AutoSPInstallerMain.ps1:
                    line 189
                    at <ScriptBlock>,
                    C:\SP\2013\AutoSPInstaller\AutoSPInstallerMain.ps1:
                    line 357
                    at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

PSMessageDetails :

| Automated SP2013 install script |
| Started on: 4/14/2013 3:39:37 PM |

| Aborted: 4/14/2013 3:41:29 PM |

    <WebApplication type="Portal"
                    name="SharePoint - Portal Sites"
                    applicationPool="SP-Portal"
                    applicationPoolAccount="VIRTUALWORKS\sys-D-Portal"
                    url="http://portal.virtualworks.com"
                    port="80"
                    UseHostHeader="true"
                    AddURLToLocalIntranetZone="true"
                    databaseName="Content_Portal"
                    useClaims="true"
                    useBasicAuthentication="false"
                    useOnlineWebPartCatalog="false">
               <Database>
                           <DBServer>AGSQL1\SPDBSERVER</DBServer>
             <DBAlias Create="false"
                     DBInstance="SERVER\INSTANCE"
                     DBPort="" />
        </Database>
        <ManagedPaths>
            <ManagedPath relativeUrl="help" explicit="true" />
        </ManagedPaths>
        <SiteCollections>
            <SiteCollection siteUrl="http://portal.virtualworks.com/"
                            HostNamedSiteCollection="true"
            owner="VIRTUALWORKS\webmaster"
                            name="Portal"
                            description="Portal Home"
                            SearchUrl="http://portal.virtualworks.com/search"
                            CustomTemplate="false"
                            Template="SPSPORTAL#0"
                            LCID="1033"
                            Locale="en-gb"
                            Time24="false">
            </SiteCollection>
        </SiteCollections>
    </WebApplication>
    <WebApplication type="MySiteHost"
                    name="SharePoint - My Sites"
                    applicationPool="SP-MySites"
                    applicationPoolAccount="VIRTUALWORKS\sys-D-MySite"
                    url="http://mysite.virtualworks.com"
                    port="8080"
                    UseHostHeader="true"                        
                    AddURLToLocalIntranetZone="true"
                    databaseName="Content_MySites"
                    useClaims="true"
                    useBasicAuthentication="false"
                    useOnlineWebPartCatalog="false">
Any help would be aprreciated.
Apr 14, 2013 at 3:29 PM
just changed the name of the Site Collection to http://portal.virtualworks2.com and seems to have got me past that point, still waiting for script to complete but fingers crossed....
Sep 5, 2013 at 10:18 PM
Where did you make the change? Did this fix your issues? Did it cause new issues?
Sep 5, 2013 at 11:28 PM
Are you installing SharePoint 2010 or SharePoint 2013?
Sep 6, 2013 at 12:53 PM
Thanks for the reply,

I am installing Sharepoint 2013 (app and WFE on Win server 2012) with SQL 2012 (on Win server 2012). Sorry to raise an old issue, but I am having the same issue.
Sep 6, 2013 at 11:09 PM
You should be able to create the site collection with the same name as the web application try changing:
<ManagedPath relativeUrl="help" explicit="true" />
 to
<ManagedPath relativeUrl="help" explicit="false" />
Nov 27, 2013 at 12:15 AM
Edited Nov 27, 2013 at 12:17 AM
I'm also having this problem when creating site collections.

I checked the xml file and managedpath relativeurl is set to false like it says in the above post.

Here is what's in my xml when it comes to creating the web app and site collections.. can you tell me what I've done wrong and why I get the error message the OP was getting?
>  __ <WebApplications AddURLsToHOSTS="true">
    <WebApplication type="MySiteHost" name="MySite Host" applicationPool="MySites Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://mysites.domain.com" port="8080" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="Content_MySites" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
      <Database>
        <DBServer />
        <DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
      </Database>
      <ManagedPaths>
        <ManagedPath relativeUrl="personal" explicit="false" />
      </ManagedPaths>
      <SiteCollections>
        <SiteCollection siteUrl="mysites.domain.com" HostNamedSiteCollection="false" Owner="domain\joe.shmoe-admin" Name="My Site Host" Description="My Site Host" SearchUrl="http://localhost/search" CustomTemplate="false" Template="SPSMSITEHOST#0" LCID="1033" Locale="en-us" Time24="false" />
      </SiteCollections>
    </WebApplication>
    <WebApplication type="Other" name="Connect" applicationPool="Connect Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://connect.domain.com" port="80" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="WSS_Content_Connect" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
      <Database>
        <DBServer />
        <DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
      </Database>
      <ManagedPaths>
        <ManagedPath relativeUrl="sites" explicit="false" />
      </ManagedPaths>
      <SiteCollections>
        <SiteCollection siteUrl="http://connect.domain.com" HostNamedSiteCollection="false" Owner="domain\joe.shmoe-admin" Name="Connect" Description="Top Level Site Collection" SearchUrl="http://localhost/search" CustomTemplate="false" Template="STS#0" LCID="1033" Locale="en-us" Time24="false" />
      </SiteCollections>
    </WebApplication>
  </WebApplications>__
When I run the script I get the below error for either site collection:
  __- Creating Site Collection "mysites.domain.com"...
--------------------------------------------------------------
 - Script halted!


Exception             : System.UriFormatException: Invalid URI: The format of the URI could not be determined.
                           at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
                           at Microsoft.SharePoint.PowerShell.SPCmdletNewSite.InternalValidate()
                           at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()
TargetObject          : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite], 
                        UriFormatException
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at CreateWebApp, C:\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 2372
                        at CreateWebApplications, C:\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1: 
                        line 2217
                        at Setup-Farm, C:\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: line 190
                        at <ScriptBlock>, C:\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: line 361
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails      : 
__

  
  
Nov 27, 2013 at 1:49 PM
Review search URL. It must be within an App that was/will be created in the XML. Localhost is not suitable given your example.
insure all URL's are prefixed with http:// Consider changing your XML to <WebApplications AddURLsToHOSTS="true"> <WebApplication type="MySiteHost" name="MySite Host" applicationPool="MySites Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://mysites.domain.com" port="8080" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="Content_MySites" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
<Database>
<DBServer />
<DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
</Database>
<ManagedPaths>
<ManagedPath relativeUrl="personal" explicit="false" />
</ManagedPaths>
<SiteCollections>
<SiteCollection siteUrl="http://mysites.domain.com" HostNamedSiteCollection="false" Owner="domain\joe.shmoe-admin" Name="My Site Host" Description="My Site Host" SearchUrl="http://WomethingThatAlreadyHasBeenCreated.domain.com/search" CustomTemplate="false" Template="SPSMSITEHOST#0" LCID="1033" Locale="en-us" Time24="false" />
</SiteCollections>
</WebApplication>
<WebApplication type="Other" name="Connect" applicationPool="Connect Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://connect.domain.com" port="80" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="WSS_Content_Connect" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
<Database>
<DBServer />
<DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
</Database>
<ManagedPaths>
<ManagedPath relativeUrl="sites" explicit="false" />
</ManagedPaths>
<SiteCollections>
<SiteCollection siteUrl="http://connect.domain.com" HostNamedSiteCollection="false" Owner="domain\joe.shmoe-admin" Name="Connect" Description="Top Level Site Collection" SearchUrl="http://WomethingThatAlreadyHasBeenCreated.domain.com/search" CustomTemplate="false" Template="STS#0" LCID="1033" Locale="en-us" Time24="false" />
</SiteCollections>
</WebApplication>
</WebApplications>
Nov 28, 2013 at 4:42 PM
Thanks for the suggestions. Seems like the only difference between my configuration and the one you suggested is that I should set the Search URL to "http://somethingthatalreadyhasbeencreated.domain.com/search". Maybe I'm missing something, but if I'm running this script, nothing has been created yet. The script is supposed to create it, right? What am I supposed to put into the configuration of the first web app that gets created? Which seems to be My Site Host.

Here are the modifications I made based on what I understood from your response. Please correct me if I'm not getting it.
<WebApplications AddURLsToHOSTS="true">
    <WebApplication type="MySiteHost" name="MySite Host" applicationPool="MySites Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://mysites.domain.com" port="80" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="Content_MySites" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
      <Database>
        <DBServer />
        <DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
      </Database>
      <ManagedPaths>
        <ManagedPath relativeUrl="personal" explicit="false" />
      </ManagedPaths>
      <SiteCollections>
        <SiteCollection siteUrl="mysites.domain.com" HostNamedSiteCollection="false" Owner="domain\joe.shmoe-admin" Name="My Site Host" Description="My Site Host" SearchUrl="http://connect.domain.com/search" CustomTemplate="false" Template="SPSMSITEHOST#0" LCID="1033" Locale="en-us" Time24="false" />
      </SiteCollections>
    </WebApplication>
    <WebApplication type="Other" name="Connect" applicationPool="Connect Application Pool" applicationPoolAccount="domain\sp2013webapp1" url="http://connect.domain.com" port="80" UseHostHeader="true" AddURLToLocalIntranetZone="true" GrantCurrentUserFullControl="true" databaseName="WSS_Content_Connect" useClaims="true" useBasicAuthentication="false" useOnlineWebPartCatalog="false">
      <Database>
        <DBServer />
        <DBAlias Create="false" DBInstance="SERVER\INSTANCE" DBPort="" />
      </Database>
      <ManagedPaths>
        <ManagedPath relativeUrl="sites" explicit="false" />
      </ManagedPaths>
      <SiteCollections>
        <SiteCollection siteUrl="http://connect.domain.com" HostNamedSiteCollection="true" Owner="domain\joe.shmoe-admin" Name="Connect" Description="Top Level Site Collection" SearchUrl="http://connect.domain.com/search" CustomTemplate="false" Template="STS#0" LCID="1033" Locale="en-us" Time24="false" />
      </SiteCollections>
    </WebApplication>
  </WebApplications>
I still get the same error.
Nov 28, 2013 at 6:39 PM
Change
siteUrl="mysites.domain.com"
to
siteUrl="http://mysites.domain.com"
Nov 29, 2013 at 7:16 PM
Whoops. Minor oversight ;) I still got that error after I added http:// Turns out the error I was getting was due to host named site collections. The full explanation is here:

https://autospinstaller.codeplex.com/workitem/20266
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.