PoshCode Archive  Artifact [2abbbc3987]

Artifact 2abbbc3987ca96a02dde202f55b465922b89122d6d13a227aaaac174904ac384:

  • File Invoke-Standby.ps1 — part of check-in [d0f0a83bf1] at 2018-06-10 13:08:12 on branch trunk — Collection of functions to Shutdown, Reboot, Logoff, Standby(sleep) or Hibernate your computer. (user: TJdot size: 995)

# encoding: ascii
# api: powershell
# title: Invoke-Standby
# description: Collection of functions to Shutdown, Reboot, Logoff, Standby(sleep) or Hibernate your computer.
# version: 0.1
# type: function
# author: TJdot
# license: CC0
# function: Invoke-Shutdown
# x-poshcode-id: 2280
# x-archived: 2015-07-20T23:13:45
# x-published: 2011-10-04T12:37:00
#
#Autor:  Mateusz Świetlicki 
#Site:   mateusz.swietlicki.net
#Create: 2010-10-04

function Invoke-Shutdown
{
    &"$env:SystemRoot\System32\shutdown.exe" -s
}
function Invoke-Reboot
{
    &"$env:SystemRoot\System32\shutdown.exe" -r
}
function Invoke-Logoff
{
    &"$env:SystemRoot\System32\shutdown.exe" -l
}
Set-Alias lg Invoke-Logoff

function Invoke-Standby
{
    &"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Standby
}
Set-Alias csleep Invoke-Standby

function Invoke-Hibernate
{
    &"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Hibernate
}