Skip to content

Conversation

@MacsInSpace
Copy link

@MacsInSpace MacsInSpace commented Dec 14, 2022

Updated and changed to use "Get-WinEvent"
Added extended filters. More descriptive than, for example, "ReplacementStrings[6]" in my opinion.
Removed old variable settings:


$LogonEvent=(Get-EventLog -LogName Security -InstanceId 4624 -After $30Days | Where {$_.ReplacementStrings[8] -eq $LogonType -and $_.ReplacementStrings[6] -ne "Window Manager"})[0]
$LoggedOnUser=($LogonEvent.ReplacementStrings[6])+'\'+($LogonEvent.ReplacementStrings[5])
$Date=$LogonEvent.TimeGenerated

Change to Get-WinEvent<br>
Added extended filters<br><br>
Removed old variable settings:<br><br>
$LogonEvent=(Get-EventLog -LogName Security -InstanceId 4624 -After $30Days | Where {$_.ReplacementStrings[8] -eq $LogonType -and $_.ReplacementStrings[6] -ne "Window Manager"})[0]<br><br>
$LoggedOnUser=($LogonEvent.ReplacementStrings[6])+'\'+($LogonEvent.ReplacementStrings[5])<br><br>
$Date=$LogonEvent.TimeGenerated<br><br>
Added PS to extend the schema. *Untested at 15/05/23*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant