Created
February 22, 2019 16:47
-
-
Save realslacker/879f85347f5dcf726595586ee59d1269 to your computer and use it in GitHub Desktop.
Schedule a restart at a specific time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the same script as a one liner: | |
# shutdown -r -t ( [math]::Ceiling( ([datetime]"1PM").Subtract((Get-Date)).TotalSeconds ) | |
param( | |
[Parameter(Mandatory=$true)] | |
[datetime] | |
$When | |
) | |
$Now = Get-Date | |
$SecondsToWait = [math]::Ceiling( $When.Subtract( $Now ).TotalSeconds ) | |
shutdown.exe -r -t $SecondsToWait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment