The script takes a single parameter, which is the SharePoint base Url and sets all sites within to UK regional settings, change the GetCultureInfo line to your Locale.
param ($url) $snapin ="Microsoft.sharepoint.powershell" if (-not $url) { write-host "Please Invoke script like this: SetRegionalSettings.ps1 -url `"http://sp.dev.com/`"" exit } if ( (Get-PSSnapin -Name $snapin -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin $snapin -ErrorAction SilentlyContinue } try { $sites = Get-SPweb -site $url -limit all } catch { Write-Error "An error occurred while retrieving the sharepoint sites for $url" } if ($sites -ne $null) { foreach ($site in $sites) { try { $site.Locale = [System.Globalization.CultureInfo]::GetCultureInfo("en-GB"); Write-Host "Changing Regional Settings for Site $($site.Name) to $($site.Locale.DisplayName)" $site.Update() } catch { Write-Error "An error occurred while changing regional settings" } } }
No comments:
Post a Comment