Skip to content

Instantly share code, notes, and snippets.

@mwrock
Created December 11, 2015 15:30
Show Gist options
  • Save mwrock/9b8f613178d36c9aef48 to your computer and use it in GitHub Desktop.
Save mwrock/9b8f613178d36c9aef48 to your computer and use it in GitHub Desktop.
force-reboot
try {
$rebootFile = "$($boxstarter.BaseDir)\reboot-test.txt"
if(!(Test-Path $rebootFile)) {
new-Item $rebootFile -value "hi1" -type file
write-host "rebooting"
return Invoke-Reboot
}
write-host "I am done"
del $rebootFile
}
catch {
$_ | Out-File "$($boxstarter.BaseDir)\test_error.txt" -Append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment