I am trying to create a web application "http://Intranet" and a site collection "http://Intranet" on SharePoint 2013 foundation farm. Here is my code
$sp = New-SPAuthenticationProvider
$web = New-SPWebApplication -Name "Intranet Home" `
-Port 80 `
-Url "http://Intranet" `
-ApplicationPool "Intranet App Pool" `
-ApplicationPoolAccount (Get-SPManagedAccount "mars\svc_intranetapppool") `
-AuthenticationProvider $sp
$web = Get-SPWebApplication "http://Intranet"
# Create a New Site at the Base of the Web App
New-SPSite "http://Intranet" -OwnerAlias "mars\aaronp" `
-Name "Intranet Sites" `
-HostHeaderWebApplication $web `
-Template "STS#0"
The error I get is
New-SPSite : The URL "http://Intranet" 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 line:3 char:1
+ New-SPSite http://Intranet -OwnerAlias "mars\aaronp" `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite], ArgumentException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite
How does one create a site collection at the root of the web-app.