Created
September 29, 2017 14:49
-
-
Save bentaylorwork/eeb86ba08cbdbba70709b3cdfb7f29af to your computer and use it in GitHub Desktop.
Gets the IP of a user login from the event log. Filters out entries where the IP isn't recorded.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-WinEvent -Logname Security -FilterXPath "*[System[EventID=4624]]" | Where-Object { $_.Properties[18].Value -ne '-' } | Select-Object MachineName, | |
@{ | |
Name = 'UserName' | |
Expression = { $_.Properties[5].Value } | |
}, | |
@{ | |
Name ='IP' | |
Expression = { $_.Properties[18].Value } | |
}, | |
TimeCreated | Sort-Object -Descending UserName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment