【问题标题】:Export of user information from AD [duplicate]从 AD 导出用户信息 [重复]
【发布时间】:2014-03-30 23:02:41
【问题描述】:
我希望从 AD 中导出以下信息:
First Name
Last Name
Login Name
Creation Date
Description
Office
Street
City
Zip Code
Country
此外,如果用户已过期或禁用,则应将其排除在外。
我一直在想如何使用 PS 来获取它,但它不起作用。
Rgds
克劳斯
【问题讨论】:
标签:
powershell
active-directory
export-to-csv
【解决方案1】:
查看Get-ADUser cmdlet(它是 Active Directory 模块的一部分)。
Get-ADUser
您应该能够使用-Properties 参数提取您要查找的所有信息,并使用-Filter 参数排除过期和禁用的用户。
例如:
Get-ADUser -Filter {Enabled -eq $true -and PasswordExpired -eq $false} -Properties "streetaddress","postalcode"
将返回所有已启用且密码尚未过期的用户的streetaddress 和postalcode 参数。
从那里,只需选择所需的属性并导出数据。