如何以dd/MM/yyyy格式获取过去6个月内被禁用的AD用户以及禁用时的时间戳为.CSV文件?
How to get the AD user that was disabled in the past 6 months and also the time stamp when it was disabled in dd/MM/yyyy format as.CSV file?
喜欢使用这个 Powershell docs.microsoft/en-us/powershell/module/addsadministration/get-aduser?view=win10-ps ?
Like using this Powershell docs.microsoft/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 来显示结果,您需要将它们保存到文件中.您可以像这样使用 Export-Csv 以 CSV 格式轻松完成此操作.
Instead of using Out-GridView to display the results, you need to save them to a file. You can do that easily in the CSV format by using Export-Csv like this.
Export-Csv '.DisabledEmployees.csv' -NoTypeInformation为了清楚起见,只需将管道末尾的 Out-GridView 行替换为这一行.
To be clear, just replace the Out-GridView line at the end of the pipeline with this line.
更多推荐
Powershell 在过去 6 个月内禁用 AD 用户?
发布评论