mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Added hibernate.ps1
This commit is contained in:
18
Scripts/hibernate.ps1
Executable file
18
Scripts/hibernate.ps1
Executable file
@ -0,0 +1,18 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./hibernate.ps1
|
||||
.DESCRIPTION enables hibernate mode for the local computer (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
try {
|
||||
[Void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
|
||||
[System.Windows.Forms.Application]::SetSuspendState("Hibernate", $false, $false);
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./reboot.ps1
|
||||
.DESCRIPTION reboots the local computer, administrator rights are required
|
||||
.DESCRIPTION reboots the local computer (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
Reference in New Issue
Block a user