仅作记录:


Get-ADUser -filter * -SearchBase 'OU=小OU,OU=大OU,DC=域名,DC=com或local' -Properties * | Where-Object {$_.Enabled -eq $True} | select SamAccountName,Displayname,Department,Title,Office,Officephone,Mobile,Homepage,EmployeeID,Mail,ExtensionAttribute1,ExtensionAttribute2,ExtensionAttribute3 | export-csv c:\export\20170729.csv

 

加了过滤,这样离职禁用的AD账号未及时移动走的就不会名单里了。

Where-Object {$_.Enabled -eq $True}

常用属性:

SamAccountName登录名

Displayname显示名称

Department部门

Title职称

Office办公室

Officephone办公室电话

Mobile手机

Homepage

EmployeeID员工工号

Mail邮箱地址

ExtensionAttribute1自定义属性1

ExtensionAttribute2自定义属性2

ExtensionAttribute3自定义属性3


原文: http://blog.sina.com.cn/s/blog_56ecbb590101duo2.html 


需要从DC中导出,技术科这个OU下所有域用户的公司、部门、账号、姓名、邮箱等信息,在DC上运行-CMD,输入以下命令:
csvde -d "ou=OUNAME,DC=test,DC=com" -r "(&(objectcategory=person)(objectClass=user))" -l "company,department,sAMAccountName,name,mail," -f c:\output01.csv -u
注:前提是在建立域账号的时候,填写了此类用户信息,方可使用。不支持中文输入,如要输入中文,可使用粘贴。
批量添加用户信息,可用exchange powershell来实现:get-user -OrganizationalUnit "test.com/技术科" | set-user -office "技术科"


原文: http://bbs.51cto.com/thread-928479-1.html