Created
February 9, 2012 09:35
-
-
Save flq/1778824 to your computer and use it in GitHub Desktop.
Powershell function to bring your PC to sleep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zzz { | |
$source = @" | |
[DllImport("powrprof.dll")] | |
public static extern void SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent); | |
"@ | |
$app = Add-Type -Namespace "Standby" -MemberDefinition $source -Name Sleep -PassThru; | |
$app::SetSuspendState($false,$true,$false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment