Skip to content

Managing Mailbox Time Zone and Language settings with PowerShell

Some users want to change their mailbox’s time zone, language, date format, or time format. With Exchange Online PowerShell, you can modify the time zone and language settings for a single mailbox, multiple mailboxes, or all Microsoft 365 mailboxes. In this article, we will show you how to manage user mailbox time zone and language settings with PowerShell.

Manage Time zone and Language

By default, when a user opens Outlook on the web (OWA) for the first time, a special window will be displayed, asking the user to select the values for time zone and language.

As an Exchange Online administrator, you would like to set a predefined setting for these values (time zone, language, data or time format) to make the users’ life easier and avoid users’ mistakes.

We will show you how to manage the time zone and language settings for:

  • Single user mailbox
  • Multiple user mailboxes
  • Bulk all user mailboxes

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands, you will need to Connect to Exchange Online PowerShell.

Connect-ExchangeOnline

Set Time zone and Language for single mailbox

To change the time zone and language settings for a single mailbox, we will use the Set-MailboxRegionalConfiguration PowerShell cmdlet.

Set mailbox Time zone

Change the time zone for a single Microsoft 365 mailbox.

PowerShell command syntax:

Set-MailboxRegionalConfiguration "Identity" -TimeZone "Time Zone"

PowerShell command example:

Set-MailboxRegionalConfiguration "amanda.hansen@m365info.com" -TimeZone "Pacific Standard Time"

You changed the time zone to Pacific Standard Time for the user mailbox, amanda.hansen@m365info.com.

Set mailbox Language and Date or Time format

If you set a mailbox language, you must also change the date and time format to avoid errors.

Note: You will get a PowerShell error if you set a language for a mailbox that has a different date or time format.

A PowerShell error message appears when the date format is invalid for the current language setting.

Ex328A48|Microsoft.Exchange.Data.DataValidationException|DateFormat \"dd/MM/yyyy\" isn't valid for current language setting \"en-US\". Valid formats include \"M/d/yyyy, M/d/yy, MM/dd/yy, MM/dd/yyyy, yy/MM/dd, yyyy-MM-dd, dd-MMM-yy\"."

A PowerShell error message appears when the time format does not match the current language setting.

Ex402B93|Microsoft.Exchange.Data.DataValidationException|The TimeFormat \"h:mm tt\" isn't valid for current language setting \"da-DK\". Valid formats include \"HH:mm, H:mm\"."

Note: Each language has its own valid value for date format and time format. If you receive the above errors (Dateformat or the Timeformat isn’t valid for the current language setting), you can set DateFormat and Timeformat to value $null. This will set the date and time format to the default format for that specific language.

In our example, we want to set the language to Danish Denmark for the user mailbox amanda.hansen@m365info.com. This is what we have to change:

  • Date format: day-month-year
  • Time format: HH:mm
  • Localize the default folder names: Danish

Set the -DateFormat $null and -Timeformat $null to get the default value format for the language.

PowerShell command syntax:

Set-MailboxRegionalConfiguration "Identity" -Language "language-country" -DateFormat "dd-MM-yyyy" -TimeFormat "HH:mm" -LocalizeDefaultFolderName

Use the below PowerShell example:

Set-MailboxRegionalConfiguration "amanda.hansen@m365info.com" -Language "da-dk" -DateFormat "dd-MM-yyyy" -TimeFormat "HH:mm" -LocalizeDefaultFolderName

Set mailbox Time zone and Language and Date or Time format

You can change the time zone, language, date, and time format for a single mailbox with a PowerShell cmdlet.

Note: You will get an error if you set a language for a mailbox with a different date format or time format. Always check which time and date format matches the language you want to set or use $null to get the default value.

In our example, we will make the following changes to the mailbox amanda.hansen@m365info.com:

  • Time zone: Greenwich Standard Time
  • Language: English – Great Brittain
  • Date format: dd/MM/yyyy or $null
  • Time format: h:mm tt or $null
  • Localize the default folder names: English

PowerShell command syntax:

Set-MailboxRegionalConfiguration "Identity" -TimeZone "Time Zone" –Language "language-country" -DateFormat "dd/MM/yyyy" -TimeFormat "h:mm tt" -LocalizeDefaultFolderName

Run the below PowerShell example:

Set-MailboxRegionalConfiguration "amanda.hansen@m365info.com" -TimeZone "Greenwich Standard Time" –Language "en-GB" -DateFormat "dd/MM/yyyy" -TimeFormat "h:mm tt" -LocalizeDefaultFolderName

Set Time zone and Language for multiple mailboxes from CSV

To set the time zone and language settings for multiple mailboxes, you need to create a single CSV file.

Create CSV file

Open Notepad or Microsoft Excel and type a list of the mailboxes you want to change their time zone and language.

  1. Type UPN at the top
  2. All the mailboxes
Manage set mailboxes Time zone and Language settings with PowerShell create CSV file
  1. Create the folder temp if you don’t have it already in the (C:) drive
  2. Name the file UsersList.csv
  3. Save as type All files (*)
  4. Click Save
Manage set mailboxes Time zone and Language settings with PowerShell save CSV file

Set multiple mailboxes Time zone

First, you need to create a CSV file and list the mailboxes in a single column named UPN, as shown in the previous step.

We will set the time zone to Pacific Standard Time for multiple Microsoft 365 mailboxes from the CSV file.

Use the below PowerShell script to change the time zone.

  • Change the TimeZone in line number 2
# Time zone
$TimeZone = "Pacific Standard Time"

# Import the CSV file containing user information
$users = Import-Csv "C:\temp\UsersList.csv" -Encoding UTF8

# Go through each user in the CSV file
foreach ($user in $users) {

    # Retrieve the user's User Principal Name (UPN) from the CSV
    $userUPN = $user.UPN

    # Set the mailbox regional configuration for the user
    Set-MailboxRegionalConfiguration -Identity $userUPN -LocalizeDefaultFolderName: $true -TimeZone $TimeZone 
}

Set multiple mailboxes Time zone and Language and Date or Time format

First, you need to set up a CSV file and list the mailboxes in a single column named UPN, as shown in the first step.

We will change the time zone, language, date, and time format for multiple mailboxes from the CSV file.

Note: The language you want to set must match the date format and time format, or you will get an error. If you don’t know the valid format for a language, use $null to get the default date and time values.

Use the below PowerShell script to change the time zone and language settings.

  • Change the TimeZone in line number 3
  • Change the Language in line number 4
  • Set the DateFormat that matches the language, or type $null for default in line number 5
  • Set the TimeFormat that matches the language, or type $null for default in line number 6
# Define regional configuration parameters
$regionalConfigParams = @{
    TimeZone                  = "Central Europe Standard Time"
    Language                  = "da-DK"
    DateFormat                = "dd-MM-yy"
    TimeFormat                = "HH:mm"
    LocalizeDefaultFolderName = $true
}

# Import the CSV file containing user information
$users = Import-Csv "C:\temp\UsersList.csv" -Encoding UTF8

# Go through each user in the CSV file
foreach ($user in $users) {

    # Retrieve the user's User Principal Name (UPN) from the CSV
    $userUPN = $user.UPN

    # Set the mailbox regional configuration for the user using splatting
    Set-MailboxRegionalConfiguration -Identity $userUPN @regionalConfigParams
}

Bulk set Time zone and Language for all mailboxes

You can change the time zone and language settings for all Microsoft 365 mailboxes.

Bulk set Time zone

Change the time zone for all Microsoft 365 mailboxes in a single PowerShell command.

PowerShell command syntax:

$Users = Get-Mailbox -ResultSize Unlimited | % { Set-MailboxRegionalConfiguration $_.Identity -TimeZone <"Time Zone"> }

In our example, we want to bulk set the time zone Pacific Standard Time.

Use the below PowerShell command:

$Users = Get-Mailbox -ResultSize Unlimited | % { Set-MailboxRegionalConfiguration $_.Identity -TimeZone "Pacific Standard Time" }

Bulk set Time zone and Language and Date or Time format

Bulk change all Microsoft 365 mailboxes’ time zone, language, date format, and time format. It will also localize the default folder names in the language you set.

Note: The language and date and time format should always match, or you will get an error. For example, the DateFormat “dd-MM-yyyy” isn’t valid for the current language setting “en-US”. To get the default date and time values, use $null for DateFormat and TimeFormat.

Use the below PowerShell script to bulk set the time zone and language settings for all Microsoft 365 mailboxes.

  • Change the TimeZone in line number 2
  • Change the Language in line number 3
  • Set the DateFormat that matches the language, or type $null for default values in line number 4
  • Set the TimeFormat that matches the language, or type $null for default values in line number 5
$regionalConfigParams = @{
    TimeZone = "W. Europe Standard Time"
    Language = "da-DK"
    DateFormat = "dd-MM-yyyy"
    TimeFormat = "H:mm"
    LocalizeDefaultFolderName = $true
}

Get-Mailbox -ResultSize Unlimited | 
    Set-MailboxRegionalConfiguration @regionalConfigParams

Display information Time zone and Language

Get a list of time zones and languages for every Microsoft 365 mailbox.

Display list of Time zones

Use the below PowerShell command to view a list of all time zones.

Get-ChildItem "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Time zones" | Format-List pschildname

Display Time zone and Language information for specific mailbox

You can display a specific mailbox time zone, language, date, and time format settings.

PowerShell command syntax:

Get-MailboxRegionalConfiguration <Identity>

Run the PowerShell command example:

Get-MailboxRegionalConfiguration "amanda.hansen@m365info.com"

See the below PowerShell output:

PS C:\> Get-MailboxRegionalConfiguration "amanda.hansen@m365info.com"

Identity             Language        DateFormat TimeFormat TimeZone
--------             --------        ---------- ---------- --------
41377e9c-dc47-46c... en-US           M/d/yyyy   h:mm tt    Pacific Standard Time

Display Time zone and Language information for all Microsoft 365 mailboxes

You can also display all Microsoft 365 mailboxes with time zone, language, date, and time format information.

Run the below PowerShell command:

Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfiguration

The PowerShell output looks like the below example:

PS C:\> Get-Mailbox -ResultSize Unlimited | Get-MailboxRegionalConfiguration

Identity             Language        DateFormat TimeFormat TimeZone                                              
--------             --------        ---------- ---------- --------                                              
41377e9c-dc47-46c... en-US           yyyy-MM-dd h:mm tt    Pacific Standard Time                                 
d912b0fc-6f7e-4ec... en-US           yyyy-MM-dd h:mm tt    Pacific Standard Time                                 
Catch All            da-DK           dd-MM-yyyy H:mm       W. Europe Standard Time                               
fa956d8c-87df-4cd... da-DK           dd-MM-yyyy H:mm       W. Europe Standard Time                               
eec2668a-0773-494... en-US           yyyy-MM-dd h:mm tt    Pacific Standard Time

Export all Microsoft 365 mailboxes Time zone and Language details to CSV

You can also export the time zone and language settings for all Microsoft 365 mailboxes to a single CSV file. This way, you can easily search which language each mailbox has.

Run the below PowerShell command to bulk export mailboxes to a CSV file.

$exportPath = "C:\Temp\File.csv"

$csvData = Get-Mailbox -ResultSize Unlimited | ForEach-Object {
    $mailbox = $_
    $regionalConfig = Get-MailboxRegionalConfiguration -Identity $mailbox.Identity

    [PSCustomObject]@{
        UserPrincipalName = $mailbox.UserPrincipalName
        Name = $mailbox.Name
        TimeZone = $regionalConfig.TimeZone
        Language = $regionalConfig.Language
        DateFormat = $regionalConfig.DateFormat
        TimeFormat = $regionalConfig.TimeFormat
    }
}

$csvData | Export-Csv -Path $exportPath -NoTypeInformation -Encoding UTF8

Find the CSV file in the C:\temp folder. Open the CSV file with an application like Microsoft Excel to see the results.

Manage set mailboxes Time zone and Language settings with PowerShell Export CSV file

Read more: Exchange Online historical message trace report »

Conclusion

You learned how to manage mailbox time zone and language settings in Exchange Online with PowerShell. When you set the language for a mailbox, always change the date and time format to avoid errors in PowerShell. Remember to display a list of all Microsoft 365 mailboxes’ time zone and language information or export it to a CSV file and verify it looks good.

Did you enjoy this article? You may also like Manage user mailbox with PowerShell. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *