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