mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-19 03:17:04 +02:00
Update reboot.ps1
This commit is contained in:
parent
0cdf5ec9a1
commit
fe3cd68194
@ -1,20 +1,24 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Reboots the local computer (needs admin rights)
|
Reboots the computer (needs admin rights)
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script reboots the local computer (needs admin rights).
|
This PowerShell script reboots the local computer immediately (needs admin rights).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./reboot
|
PS> ./reboot
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
#Requires -RunAsAdministrator
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Restart-Computer
|
if ($IsLinux) {
|
||||||
|
sudo reboot
|
||||||
|
} else {
|
||||||
|
Restart-Computer
|
||||||
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user