Update reboot.ps1

This commit is contained in:
Markus Fleschutz 2022-08-20 12:40:31 +02:00
parent 0cdf5ec9a1
commit fe3cd68194

View File

@ -1,20 +1,24 @@
<#
.SYNOPSIS
Reboots the local computer (needs admin rights)
Reboots the computer (needs admin rights)
.DESCRIPTION
This PowerShell script reboots the local computer (needs admin rights).
This PowerShell script reboots the local computer immediately (needs admin rights).
.EXAMPLE
PS> ./reboot
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
Author: Markus Fleschutz | License: CC0
#>
#Requires -RunAsAdministrator
try {
Restart-Computer
if ($IsLinux) {
sudo reboot
} else {
Restart-Computer
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"