16

How can I set TimeZone using Powershell, on a Windows Server 2008 R2 target machine?

stacker
  • 14,641
  • 17
  • 46
  • 74

3 Answers3

23

This is how I do it in setup scripts...although our AD infrastructure would set this when the machine joins the domain anyway...I like to be thorough in my scripting :)

%windir%\system32\tzutil /s "Eastern Standard Time"
techraf
  • 64,883
  • 27
  • 193
  • 198
Max_Steve
  • 416
  • 1
  • 5
  • 6
  • actually for Powershell remove the %windir%\system32\ as PS wont know how to handle it...you could use C:\Windows\System32\ instead – Max_Steve Jan 28 '11 at 18:18
  • 1
    system32 is normally in your path so you don't need it at all. tzutil.exe works on any typical out of the box Windows machine (that has the application in system32 :) – shufler Dec 02 '15 at 02:00
  • 4
    The exact powershell equivalent is `& "$env:windir\system32\tzutil.exe" /s "Eastern Standard Time"` but agreed, you don't actually need system32 – gregmac Apr 11 '16 at 20:25
11

At least in newer versions of Powershell (5.1 and later), there is a cmdlet. See the docs.

Set-TimeZone "Eastern Standard Time"

Older versions can find the script here.

Prof Von Lemongargle
  • 3,658
  • 31
  • 29
0

PowerShell command tzutil /g - to see current time zone tzutil /l - list of time zones tzutil /s "example" to change time zone

There are other commands to change the time zone I have explained it in my YouTube video https://youtu.be/JvLa5HjEjHM

Hope this will help you!!