Skip to content

Instantly share code, notes, and snippets.

@desek
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desek/6ec1a4693c28d47f189f to your computer and use it in GitHub Desktop.
Save desek/6ec1a4693c28d47f189f to your computer and use it in GitHub Desktop.
OMSDK Logons from Event Log
$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