Last active
August 29, 2015 14:06
-
-
Save desek/6ec1a4693c28d47f189f to your computer and use it in GitHub Desktop.
OMSDK Logons from Event Log
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
$Events = Get-EventLog -LogName 'Operations Manager' -EntryType Information | Where-Object {$_.EventID -eq 26328} | |
$Logons = @() | |
Foreach ($Event in $Events) | |
{ | |
If ($Event.ReplacementStrings[0] -notin @($Logons.UserName)) | |
{ | |
$Props = [ordered]@{ | |
UserName = $Event.ReplacementStrings[0] | |
LastLogon = $Event.TimeGenerated | |
} | |
$Logons += New-Object -TypeName PSObject -Property $Props | |
Remove-Variable Props | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment