I never remember correctly how to set a SharePoint users display languages using PowerShell. Searching always brings up one or the other form of the following code:
This seems to look good, when looked at from central admin:
But for some (or all) users, when looking at the same settings from the users' mysite. Things are not so well:
The "secret" to this is that the settings from the SharePoint UserProfile are distributed (or rather copied...) by a TimerJob ("User Profile Service Application_LanguageAndRegionSync"). This TimerJob will only work on profiles where SPS-RegionalSettings-Initialized
is set to true
. Additionally that job runs every minute, if not changed by an admin.
So, the final (and working) script to deploy language settings to users looks like this:
Note lines 15 and 19 where the initialized-property is set and the TimerJob is immediately started, respectively. After running that script everything looks good:
What else is to say?
- language-codes must be correctly capitalized:
en-US
works, whileen-us
does not. - lists of language-codes must not contain spaces:
en-GB,en-CA
works, whileen-GB, en-CA
does not.