Set Language and TimeZone in Office 365 Mailboxes using Powershell

Mailbox users can easily change their regional settings from Outlook Web App (OWA). But in some scenarios, we may need to change language and time zone settings for bulk mailboxes. We can use the exchange Powershell cmdlet Set-MailboxRegionalConfiguration to set mailbox regional configuration. We can also use the same command for Exchange on-premise mailbox.

Before proceeding run the following command to connect Exchange Online Powershell module.

$365Logon = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection
Import-PSSession $Session

Run the below command to set the language “German” and time zone “W. Europe Standard Time”.

Set-MailboxRegionalConfiguration -Identity "[email protected]" -Language 1031 -TimeZone "W. Europe Standard Time" -DateFormat "dd.MM.yyyy" -TimeFormat "HH:mm"

You can get the required language id from this source: Language Locale ID Values and you can get the time zone name from this source:
Time Zone Values.

You can retrieve the existing regional configuration by running the below command.

Get-MailboxRegionalConfiguration -Identity "[email protected]"

You can also set language and time zone values individually.

Set-MailboxRegionalConfiguration -Identity "[email protected]" -TimeZone "W. Europe Standard Time"
Set-MailboxRegionalConfiguration -Identity "[email protected]" -Language 1031 -DateFormat "dd.MM.yyyy" -TimeFormat "HH:mm"

You have to set supported date format for the corresponding language. When you set the language without date-time format, you will get the error like ‘DateFormat “M/d/yyyy” isn’t valid for current language setting “de-DE”‘ if the existing date time format do not support the new language setting.

Set Regional Configuration for all Mailboxes

Get-Mailbox -ResultSize Unlimited | Set-MailboxRegionalConfiguration -Language en-US -TimeZone "Pacific Standard Time" -DateFormat  "M/d/yyyy" -TimeFormat "h:mm tt"

Set language and time zone for multiple users from CSV

Use the below Powershell commands to set regional settings for bulk Office 365 mailbox users by importing users from CSV file. Consider the CSV file MailBoxUsers.csv which contains a set of mailbox users with the CSV column headers UserPrincipalName, TimeZone, Language, DateFormat, and TimeFormat.

Import-Csv 'C:\MailboxUsers.csv' | ForEach-Object {
$mailbox = $_."UserPrincipalName"
$language = $_."Language" # Use language code (Ex: de-DE) as input. don't use language id here.
$timeZone = $_."TimeZone"
Set-MailboxRegionalConfiguration -Identity $mailbox -Language $language -TimeZone $timeZone -DateFormat $_."DateFormat" -TimeFormat $_."TimeFormat"
}

You can list the regional config of all mailboxes by running the below command.

Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfiguration

You can also export the results to CSV file by running below command.

Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfiguration | Export-CSV "C:\Mailbox-Regional-Configs.csv" -NoTypeInformation -Encoding UTF8

Note: Setting regional settings through Powershell will not reflect immediately in all services, it may take a few mins to hours to sync in all services.

Advertisement

Leave a Comment