在AD中导出所有用户


可以使用PowerShell中的Get-ADuser命令进行导出。
以下命令可以导出用户的名字,上次登录时间,上次密码重置时间,邮件并以CSV格式保存。

Get-ADUser  - Filter  * -Properties * -SearchBase  " dc=superdoor,dc=co, dc=nz" |Select -Object
  Name, lastlogondate, passwordlastset, mail |  Export-Csv  -Path  "c:\userinfo.csv"

如果只需要导出某一个OU下面的用户,加上对应的OU即可,OU内部有层级关系,再加上下面的OU即可。

Get-ADUser  - Filter  * -Properties * -SearchBase  "ou=nation dc=superdoor,dc=co, dc=nz" |Select -Object
  Name, lastlogondate, passwordlastset, mail |  Export-Csv  -Path  "c:\userinfo.csv"