Modify the Time Zone Without tzutil.exe

Note: This post has been updated below (3/9/2017).

Earlier today (2/27/2017), I wanted a purely PowerShell answer to setting the time zone. That meant that I didn’t want to rely on tzutil.exe, as I had forever now. The best I could do was to use PowerShell with the registry, in order to update the TimeZoneKeyName key. So I can refer to the code, as I’ll forget it soon enough, I thought I’d place it here with the possibility it’ll also be helpful for someone else, someday.

I do want to mention that this method would require elevation to a local administrator, as would any modification to HKLM. Using tzutil.exe, however, does not include this same restriction. On that alone, I may actually stick with the Windows Time Zone (command line) Utility.

$RegistryPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
$RegistryKeyName = 'TimeZoneKeyName'
$RegistryValue = 'US Mountain Standard Time'
Set-ItemProperty -Path $RegistryPath -Name $RegistryKeyName -Value $RegistryValue


Update
: I saw a recent Tweet from Jeffery Hicks about the newer, PowerShell 5.1 function, Get-ComputerInfo. I ran it, as I have at least once before, and ended up staring right at a TimeZone property. So with that, I jumped back to this post to do an update. I think it’s coming…

2 thoughts on “Modify the Time Zone Without tzutil.exe

  1. tommymaynard Post author

    I found those built-in cmdlets recently, too… after I wrote this post. Thanks for mentioning them!

    Reply

Leave a Reply

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