At one of my projects I’m using the new and greater multi language options in SharePoint 2010 and with ASP.Net resources it is really easy to create site in different languages. When I create a site e.g. in Danish the content type display name is translated into Danish, as expected, but when I start my SharePoint managed shell it is running in English context and if I have some PowerShell code which is dependent on language resources, then it will ask in English, but when my site is created in Danish, it may give some weird errors. The solution to this is to set PowerShell CurrentUICulture to be as the site you work with like this.
- #Ensure the PowerShell process is running the same culture as SPWeb is created with
- $web = Get-SPWeb "http://win-l2sfc3oetnn"
- [int]$lcid = $web.Language
- $culture = new-object "System.Globalization.CultureInfo" $lcid
- [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture