Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 17, 2018 17:51
Show Gist options
  • Select an option

  • Save h3nryza/bbcb12cd307497d6e48a883a1f60e8f2 to your computer and use it in GitHub Desktop.

Select an option

Save h3nryza/bbcb12cd307497d6e48a883a1f60e8f2 to your computer and use it in GitHub Desktop.
Powershell last shutdown events
$arrShutdown = Get-EventLog -LogName System -EntryType Information -InstanceId 2147484722 | sort-object $_.Time -descending
foreach ($item in $arrShutdown)
{
$UserName = $item.UserName
$Message = $item.Message
$Time = $item.TimeGenerated
write-host "UserName `t:$username `nTime `t`t:$time `nMessage `t:$Message `n`n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment