Powershell

How to Use the Set-TimeZone Cmdlet in PowerShell?

In Windows, the time zone is usually adjusted or set through the graphical user interface(GUI). However, it can also be set using PowerShell’s “Set-TimeZone” cmdlet. To change the system time zone to a specific time zone, use the “Set-TimeZone” cmdlet. The standard alias for the “Set-TimeZone” cmdlet is the “stz”.

This guide will explain the usage of PowerShell’s “Set-TimeZone” cmdlet.

How to Use the PowerShell’s Set-TimeZone Cmdlet?

With PowerShell’s “Set-TimeZone” cmdlet, a user can change the system time zone to a certain time zone. To do so, first, use the “Set-TimeZone” cmdlet and assign it the time zone name.

Syntax

Let’s have a look at the general syntax of the “Set-TimeZone” cmdlet in PowerShell:

Set-TimeZone [-Name] [CommonParameters]

Example 1: Use the “Set-TimeZone” Cmdlet to Set the Time Zone by ID

First, use the “Set-TimeZone” cmdlet. Then, specify the time zone by using the “-Id” parameter:

Set-TimeZone -Id "UTC"

Example 2: Use the Cmdlet “Set-TimeZone” to Set the Time Zone by Name

First, use the cmdlet “Set-TimeZone” along with the parameter “-Name” and specify the time zone name. Lastly, use the parameter “-PassThru” at the end:

Set-TimeZone -Name "Coordinated Universal Time" -PassThru

Example 3: Use the Cmdlet “Set-TimeZone” to List All Available Time Zones

To retrieve the available list of time zones, first, use the “Get-TimeZone” cmdlet. Then, assign the “-ListAvailable” parameter:

Get-TimeZone -ListAvailable

That’s it! We have described the usage of the “Get-TimeZone” cmdlet in PowerShell.

Conclusion

The “Set-TimeZone” cmdlet in PowerShell is used to change the system time zone to a given time zone. Simply pass the time zone name to the “Set-TimeZone” cmdlet to set the time zone to a certain time zone. This tutorial has explained the usage of the “Set-TimeZone” cmdlet with the help of various examples.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.