Set SPWeb title on a SharePoint site using PowerShell
-
16-10-2019 - |
Question
I'm having problems setting the title of a root web in a site collection when creating it in an other language then English. When i run the script under using 1033, it works fine the site title is set to the input. But then I change to 1044 Norwegian I get no error but the title is empty (I have installed the language package). Here is the script (I'm using a custome site definition, but set it to STS#0 in the example same problem):
Write-Host "******** Create site. ***********" -f Green
Write-Host "Please enter the URL and the administrator of the site to create" -f Green
[console]::ForegroundColor = "yellow"
$newSiteUrl = Read-Host "Please enter the site Url to for the site"
$siteAdministrator = Read-Host "Please enter the site administrator"
$webTitle = Read-Host "Please enter the title of the root"
[console]::ResetColor()
$site = New-SPSite $newSiteUrl -OwnerAlias $siteAdministrator -Language 1044
$web = $site.RootWeb
$web.ApplyWebTemplate("STS#0")
$web.Title = $webTitle
$web.Update()
Write-Host "The Installation is complete please visit the site at" $web.URL -f Green
So how can I set the title of a site using an other language then English?
Solution
Why do it in 2 steps? The New-SPSite cmdlet takes a webtemplate and a title parameter too?
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange