POWERSHELL-清单从安全日志中列出的IP地址包括计数



我有以下PowerShell输出失败登录事件的IP地址列表:

$DT = [DateTime]::Now.AddDays(-1) # check only last 24 hours
$l = Get-EventLog -LogName 'Security' -InstanceId 4625 -After $DT | Select-Object @{n='IpAddress';e={$_.ReplacementStrings[-2]} }
$g = $l | group-object -property IpAddress  | where {$_.Count -gt 20} | Select -property Name | export-csv c:usersexport.csv

我真的很想改进它,因此它像现在一样输出IP地址,以及$_。Count。我已经尝试了几件事,但我认为我陷入了SQL World!

我认为您要做的就是在第二个管道中替换

Select -property Name

Select -property Name, Count

(但是我将通过查看从group-object返回的对象上使用get-member首先查看属性。)

最新更新