"tzutil.exe" to change the time zone when launched from powershell throws error:

This topic contains 5 replies, has 4 voices, and was last updated by  js 7 months ago.

  • Author
  • #82661

    jason smith

    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?

  • #82664

    Greg Tate

    I'm sorry to answer a question with a question but...
    Is there any reason the powershell cmdlet of Set-Timezone wont work?

    • #82672

      jason smith

      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'"

  • #82666

    Naw Awn

    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.

    • #82673

      jason smith

      I am actually using that command from Cloudformation stack template

  • #82676

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

You must be logged in to reply to this topic.