Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Date = [DateTime]::Now.AddDays(-14)
- $Date.tostring("MM-dd-yyyy"), $env:Computername
- $eventList = @()
- $variable | Export-Csv c:output.csv
- Get-EventLog "Security" -After $Date `
- | Where -FilterScript {$_.EventID -eq 4624 -and $_.ReplacementStrings[4].Length -gt 10 -and $_.ReplacementStrings[5] -notlike "*$"} `
- | foreach-Object {
- $row = "" | Select UserName, LoginTime
- $row.UserName = $_.ReplacementStrings[5]
- $row.LoginTime = $_.TimeGenerated
- $eventList += $row
- $variable | Export-Csv c:output.csv
- }
- $eventList
Add Comment
Please, Sign In to add comment