How to Set the Time Zone Using PowerShell in Windows

As an IT administrator, you may be required to set the correct time zone across multiple servers located in different regions. This is a common requirement. You can easily achieve this using PowerShell.

In this tutorial, I will explain how to set the time zone using PowerShell in Windows.

In PowerShell, you can use the Set-TimeZone cmdlet to set the time zone on Windows systems.

Set the Time Zone Using PowerShell

Follow these steps to set the time zone using PowerShell:

  1. Open PowerShell with administrative privileges (You must).
  2. To view the current time zone setting, run the following command:
   Get-TimeZone

This command will display the current time zone information.

As shown in the screenshot below, the time zone of my system is displayed after executing the above PowerShell command.

Set the Time Zone Using PowerShell
  1. To list all available time zones, use the following command:
   Get-TimeZone -ListAvailable

This command will display a list of all supported time zones.

Set the Time Zone Using PowerShell in Windows
  1. To set the desired time zone, use the Set-TimeZone cmdlet followed by the time zone ID. For example, to set the time zone to “Pacific Standard Time” (commonly used in states like California, Washington, and Oregon), run:
   Set-TimeZone -Id "Pacific Standard Time"

Replace “Pacific Standard Time” with the appropriate time zone ID for your location, such as “Eastern Standard Time” for states like New York, Florida, and Massachusetts, or “Central Standard Time” for states like Texas, Illinois, and Minnesota.

  1. Verify that the time zone has been set correctly by running Get-TimeZone again.

Check out Update PowerShell on Windows 11

Examples of Setting Time Zones for Different U.S. Regions

Here are a few examples of setting time zones for different regions in the United States:

  • Setting the time zone for Los Angeles, California:
  Set-TimeZone -Id "Pacific Standard Time"
  • Setting the time zone for New York City, New York:
  Set-TimeZone -Id "Eastern Standard Time"
  • Setting the time zone for Chicago, Illinois:
  Set-TimeZone -Id "Central Standard Time"
  • Setting the time zone for Denver, Colorado:
  Set-TimeZone -Id "Mountain Standard Time"

Read List Windows Features Using PowerShell

Automating Time Zone Settings Across Multiple Servers

If you need to set the time zone on multiple servers, you can use PowerShell remoting or create a script to automate the process. Here’s an example of how to set the time zone on remote servers:

$servers = "server1", "server2", "server3"
$timezone = "Pacific Standard Time"

Invoke-Command -ComputerName $servers -ScriptBlock {
    Set-TimeZone -Id $using:timezone
}

In this example, the $servers variable contains the names of the remote servers, and the $timezone variable holds the desired time zone ID. The Invoke-Command cmdlet executes the Set-TimeZone command on each remote server specified in $servers.

Troubleshooting Time Zone Issues

Below are the issues I faced while doing this, so I thought to share them with you.

If you encounter any issues while setting the time zone using PowerShell, consider the following troubleshooting tips:

  1. Ensure that you have administrative privileges to run the Set-TimeZone cmdlet.
  2. Double-check the time zone ID for accuracy. You can refer to the list of available time zones by running Get-TimeZone -ListAvailable.
  3. If you receive an error message indicating that the time zone ID is not valid, verify that the time zone is supported on your version of Windows. You can check the Microsoft documentation for the list of supported time zones.
  4. If the time zone setting does not take effect immediately, you may need to restart the system or the specific services that depend on the time zone setting.

Conclusion

In this tutorial, I have explained how to set the time zone in Windows using the Set-TimeZone cmdlet in PowerShell.

If you found this tutorial helpful, please share it with your colleagues and friends who might benefit from learning how to set the time zone using PowerShell in Windows.

You may also like:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.