Powershell 在过去 6 个月内禁用 AD 用户?

编程入门 行业动态 更新时间:2024-10-24 15:27:09
本文介绍了Powershell 在过去 6 个月内禁用 AD 用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何以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 用户?

本文发布于:2023-11-27 10:20:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637676.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:月内   用户   在过去   Powershell   AD

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!