I try to create a new search center (as a subsite of a subweb) with powershell When I do this, I get an error:
New-SPWeb : Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: "hosturl/ER/FD/search" OriginalException: The value of AvailablePageLayouts contain s invalid url. All page layout urls inside the string have to be server relative. The url '~SiteCollection/_catalogs/masterpage/SearchResults.aspx' ('/ER/_catalogs/masterpage/SearchResults.aspx')is not in th e current site collection '/ER'. At MyScript.ps1:116 char:2 + New-SPWeb -Url $searchUrl -Template "SRCHCEN#0" -Language $web.Language
First I've activated the "PublishingSite" feature on the sitecollection (ALSO WITH POWERSHELL) Then I execute this function:
function CreateSearchSubsite{
Param ([Microsoft.SharePoint.SPWeb] $web)
WriteText " > Start creating a search subsite"
$searchUrl = $web.Url.TrimEnd('/') + "/search"
$exists = (Get-SPWeb $searchUrl -ErrorAction SilentlyContinue) -ne $null
if($exists)
{
Remove-SPWeb -Identity $searchUrl -Confirm:$false
}
New-SPWeb -Url $searchUrl -Template "SRCHCEN#0" -Language $web.Language
WriteText " > End creating a search subsite"
}
Anybody who knows what's wrong with this?