1

我試圖將腳本放在一起,以拉取所有用戶的SIDhistory列表,但從未使用過他們的帳戶並將其轉儲到CSV中。這是我迄今爲止所擁有的。需要吸引所有用戶使用SIDhistory,但從未登錄過

Get-aduser -filter {sidhistory -like「*」} -properties lastlogondate |我有一個問題,我可以得到一個所有用戶swith一個SID歷史的列表,但我不知道如何只是拉那些沒有登錄活動。

謝謝你的幫助!

回答

1

它管道位置對象是這樣的:

Get-aduser -filter {sidhistory -like "*"} -properties lastlogondate | Where-Object {$_.lastlogondate -eq $null} | Export-Csv output.csv 

的lastlogindate屬性將達到零如果帳戶從未登錄

+0

太感謝你了,這個完美! – MMbill

相關問題