Skip to content

Instantly share code, notes, and snippets.

@dougwaldron
Created March 22, 2023 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougwaldron/2d0aa7da6d7d7ccdaafa085880276fff to your computer and use it in GitHub Desktop.
Save dougwaldron/2d0aa7da6d7d7ccdaafa085880276fff to your computer and use it in GitHub Desktop.
PowerShell commands to show when the computer last turned off and then on
# Last time system was turned off
Get-WinEvent -MaxEvents 3 -FilterHashTable @{ProviderName='Microsoft-Windows-Kernel-Power';LogName='System'}
# Last time system was turned on
Get-WinEvent -MaxEvents 1 -FilterHashTable @{ProviderName='Microsoft-Windows-Power-Troubleshooter';LogName='System'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment