I have a PowerShell script in which I first create a new site collection, then fetches the SPWeb
object of the sitecollection and then set some properties.
Due to a specific error, I have instead opted for creating the site collection from Central Administration instead of from the PowerShell script. This is where the weird things start to happen.
When I create the site collection from PowerShell with the below code, I can fetch the SPWeb
without any errors.
New-SPSite -URL $root$managedPath$relativeUrl -ownerAlias $ownerAlias -Template $template -Language 1053
..
$web = Get-SPWeb $root$managedPath$relativeUrl
When I create the site collection through Central Administration and tries to fetch the SPWeb
object, I get the following error
Get-SPWeb : Cannot find an SPWeb object with Id or Url ...
Further more, when I run Get-SPSite
to view all available sites, the sites differ between those that have been created using PowerShell, and those via the Central Administration console.
Url CompatibilityLevel
--- ------------------
https://rootsite/createdViaPowershell1 15
https://rootsite/createdViaCentralAdmin
https://rootsite/createdViaPowershell2 15
I'm using the BLANKINTERNET#0
web template in PowerShell, and selects "Publishing portal" when creating from Central Administration.
How come the result differs, and how can I create a site collection identical to those created in Powershell, but instead from Central Administration?