PowerTip: Use PowerShell to Change System Time

Summary: Learn how to use Windows PowerShell to change the system time.

Hey, Scripting Guy! Question The clock on my computer (running Windows 8.1) is 30 minutes slow. How can I use Windows PowerShell 
            to move the system time up 30 minutes?

Hey, Scripting Guy! Answer Use the Set-Date cmdlet, create a TimeSpan object equal to 30 minutes, and supply it to
            the –adjust parameter:

Set-Date -Adjust (New-TimeSpan -Minutes 30)

To alter the clock back 30 minutes, create a negative TimeSpan, for example:

Set-Date -Adjust (New-TimeSpan -Minutes -30)

Note  This cmdlet requires credentials to set the time. One way to get this privilege is to open
Windows PowerShell as an administrator.

Comments (2)

  1. Great tip. Never thought of this!

  2. Lukester says:

    Any tips for setting 24hour time format using powershell?
    Server 2012 seems to default to US 12hour times