Advertisement
guyrleech

Show all remote interactive logons since boot

Aug 25th, 2020 (edited)
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Get "Begin session arbitration" events. Don't get for reconnects, just logons
  2. Get-WinEvent -FilterHashtable @{ ProviderName = 'Microsoft-Windows-TerminalServices-LocalSessionManager' ; Id = 41 }|select-object -Property TimeCreated,@{n='User';e={$_.Properties[0].Value}},@{n='SessionId';e={$_.Properties[1].Value}}
  3.  
  4. ## Or only since boot
  5. Get-WinEvent -FilterHashtable @{ ProviderName = 'Microsoft-Windows-TerminalServices-LocalSessionManager' ; Id = 41 ; StartTime = (Get-CimInstance -ClassName Win32_OperatingSystem|select-object -expand LastBootUpTime)}|select-object -Property TimeCreated,@{n='User';e={$_.Properties[0].Value}},@{n='SessionId';e={$_.Properties[1].Value}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement