Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Changing a Computer’s Date and Time
Before explaining how to use the Set-Date cmdlet we should note that this is a cmdlet you should use with care. For example, if you’re in an Active Directory environment your workstation times must be closely synchronized with your domain controller times; if they aren’t, you might not be able to log on to the domain. Computer times are often assigned using an automatic time service; in that case, you probably don’t need to (and probably shouldn’t) set dates and times by hand. However, if you do have a need to set dates and times manually then Set-Date provides an easy way to do so.
One way to change the date/time on a computer is to use the -date parameter followed by the new date and time. For example, suppose you want to set the date and time to 8:30 AM on June 1, 2006. Here’s how you do that:
Set-Date -date "6/1/2006 8:30 AM"
Need to set the clock ahead exactly two days? This command uses the Get-Date cmdlet and the AddDays method to advance the clock two days:
Set-Date (Get-Date).AddDays(2)
Other methods that can be used here include AddHours, AddMinutes, and AddSeconds. Need to set the clock back 1 hour due to Daylight Saving Time? Then simply set the clock back -1 (minus 1) hours, like this:
Set-Date (Get-Date).AddHours(-1)
Alternatively, you can use the -adjust parameter to adjust the time using the format hours:minutes:seconds. For example, this command sets the clock ahead 1 hour and 37 minutes:
Set-Date -adjust 1:37:0