如何获取过去 6 个月内禁用的 AD 用户以及禁用时的时间戳(以 dd/MM/yyyy 格式作为 .CSV 文件)?
就像使用这个 Powershellhttps://learn.microsoft.com/en-us/powershell/module/addsadministration/get-aduser?view=win10-ps https://learn.microsoft.com/en-us/powershell/module/addsadministration/get-aduser?view=win10-ps ?
$paramhash=@{
UsersOnly = $True
AccountDisabled = $True
SearchBase = "OU=Employees,DC=globomantics,dc=local"
}
Search-ADAccount @paramHash |
Get-ADuser -Properties Description,Department,Title,LastLogonDate,WhenChanged |
sort LastLogonDate |
Select Name,Department,Title,Description,WhenChanged,LastLogonDate,DistinguishedName |
out-gridview -title "Disabled Employees"
而不是使用Out-GridView
要显示结果,您需要将它们保存到文件中。您可以使用 CSV 格式轻松完成此操作Export-Csv
像这样。
Export-Csv '.\DisabledEmployees.csv' -NoTypeInformation
明确地说,只需更换Out-GridView
与此线在管道末端的线。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)