Guest User

Untitled

a guest
Sep 7th, 2020
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $time = [int64](New-TimeSpan (get-date "01/01/2017") (get-date "08/10/2018")).TotalMilliseconds
  2. $filter = "*[System[TimeCreated[timediff(@SystemTime) < $time] and EventID=4624] and EventData[Data[@Name='LogonType']=10]]"
  3. $results = @(
  4. Get-WinEvent -FilterXPath $filter -LogName Security | Foreach {
  5. $evt = $_
  6. $addr = $evt.Properties[18].Value
  7. $textcolor = $host.ui.rawui.foregroundcolor
  8. $host.ui.rawui.foregroundcolor = "red"
  9.  
  10. if ($addr -like "192.168.0*") {$host.ui.rawui.foregroundcolor = "DarkGreen"}
  11. if ($addr -like "10.*") {$host.ui.rawui.foregroundcolor = "yellow"}
  12. "" | Select-Object @{n="Time";e={$evt.TimeCreated}},@{n="UserName";e={$evt.Properties[5].Value}},@{n="Address";e={$addr}}
  13. $host.ui.rawui.foregroundcolor = $textcolor
  14. }
  15. )
  16. $results | export-csv -Encoding UTF8 -Path d:\so1.csv -NoTypeInformation -Delimiter ";"
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×