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?
I’m sorry to answer a question with a question but…
Is there any reason the powershell cmdlet of Set-Timezone wont work?
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.
I looked up about Set-Timezone already. It is available only from Powershell 5.0.
We are using Powershell 4.0
I could make it to work. double quotes
powershell.exe -ExecutionPolicy Unrestricted -Command “tzutil.exe /s ‘Eastern Standard Time’”
I am actually using that command from Cloudformation stack template
powershell.exe -ExecutionPolicy Unrestricted -Command tzutil.exe /s "'Eastern Standard Time'"