Author Posts

October 20, 2017 at 6:16 pm

When I run the following command at powershell command prompt it works fine. It changes the time zone to Easter time zone.

tzutil.exe /s 'Eastern Standard Time'
But when I run it the following way, it says

powershell.exe -ExecutionPolicy Unrestricted -Command tzutil.exe /s 'Eastern Standard Time'

TZUTIL: Invalid number of arguments for /s.Use TZUTIL /? for a list of valid options.

I don't understand. any suggestions please?

October 20, 2017 at 6:18 pm

I'm sorry to answer a question with a question but...
Is there any reason the powershell cmdlet of Set-Timezone wont work?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-timezone?view=powershell-5.1

October 20, 2017 at 6:25 pm

It's like you are trying to run dir /s inside the PowerShell. Set-TimeZone, what Greg suggests, is a good one. If you still want to stick to tzutil.exe, you can use:
tzutil.exe /s 'Eastern Standard Time' and save the command to .bat or .cmd. the command prompt will pick it up and run it. You don't need PowerShell to do that.

October 20, 2017 at 6:49 pm

I looked up about Set-Timezone already. It is available only from Powershell 5.0.
We are using Powershell 4.0

thanks much
I could make it to work. double quotes
powershell.exe -ExecutionPolicy Unrestricted -Command "tzutil.exe /s 'Eastern Standard Time'"

October 20, 2017 at 7:47 pm

I am actually using that command from Cloudformation stack template

October 20, 2017 at 8:51 pm

powershell.exe -ExecutionPolicy Unrestricted -Command tzutil.exe /s "'Eastern Standard Time'"