PoshCode Logo PowerShell Code Repository

Invoke-Standby by TJdot 4 years ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2280"></script>download | new post

Collection of functions to Shutdown, Reboot, Logoff, Standby(sleep) or Hibernate your computer.

  1. #Autor:  Mateusz &#346;wietlicki
  2. #Site:   mateusz.swietlicki.net
  3. #Create: 2010-10-04
  4.  
  5. function Invoke-Shutdown
  6. {
  7.     &"$env:SystemRoot\System32\shutdown.exe" -s
  8. }
  9. function Invoke-Reboot
  10. {
  11.     &"$env:SystemRoot\System32\shutdown.exe" -r
  12. }
  13. function Invoke-Logoff
  14. {
  15.     &"$env:SystemRoot\System32\shutdown.exe" -l
  16. }
  17. Set-Alias lg Invoke-Logoff
  18.  
  19. function Invoke-Standby
  20. {
  21.     &"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Standby
  22. }
  23. Set-Alias csleep Invoke-Standby
  24.  
  25. function Invoke-Hibernate
  26. {
  27.     &"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Hibernate
  28. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me