mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-31 19:26:27 +02:00
Update hibernate.ps1
This commit is contained in:
parent
82d8ad6d84
commit
6b0b54fedf
@ -5,7 +5,7 @@
|
|||||||
This PowerShell script hibernates the local computer immediately.
|
This PowerShell script hibernates the local computer immediately.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./hibernate.ps1
|
PS> ./hibernate.ps1
|
||||||
😴💤 Good night, I'm going to sleep deep...
|
It's 5:04 PM, going to sleep now... 😴💤
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -13,7 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Host "😴💤 Good night, I'm going to sleep deep..."
|
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
|
||||||
|
$CurrentTime = $((Get-Date).ToShortTimeString())
|
||||||
|
Write-Host "It's $CurrentTime, going to sleep now... 😴💤p"
|
||||||
|
Start-Sleep -milliseconds 500
|
||||||
& rundll32.exe powrprof.dll,SetSuspendState 1,1,0 # bHibernate,bForce,bWakeupEventsDisabled
|
& rundll32.exe powrprof.dll,SetSuspendState 1,1,0 # bHibernate,bForce,bWakeupEventsDisabled
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user