PowerTip: Use PowerShell to Change System Time

Doctor Scripto

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.


Discussion is closed.

Feedback usabilla icon