Windows Server 2016 – command line bulk export ad user list information

Time:2019-11-14

This chapter brings you how to export domain user list information through PowerShell or ldifde command line, which is convenient for you to use in daily operation and maintenance work.

A list of all user information under the staff directory appears in PowerShell mode:

Get-ADUser -Filter * -Properties * -SearchBase “DC=staff,DC=azureyun,DC=com” |Select-Object name,SamAccountName,Givenname,surname,Displayname,title,mobile,CanonicalName,Created,Department,DistinguishedName,EmailAddress,homeMDB,mail,mailNickname,MemberOf,msExchCoManagedObjectsBL,msExchHomeServerName,PasswordLastSet,PrimaryGroup,proxyAddresses,UserPrincipalName,whenCreated,whenChanged,MobilePhone,telephoneNumber,employeeNumber,postalCode,company |Export-Csv C:\AllADUser20190226.csv -Encoding UTF8 –NoTypeInformation

image

The ldifde mode leads to a list of all user information under the staff directory:

ldifde -f alldbauser.ldf -d “DC=staff,DC=azureyun,DC=com” -r objectClass=user -l “name,SamAccountName,Givenname,surname,Displayname,title,mobile,CanonicalName,Created,Department,DistinguishedName,EmailAddress,homeMDB,mail,mailNickname,MemberOf,msExchCoManagedObjectsBL,msExchHomeServerName,PasswordLastSet,PrimaryGroup,proxyAddresses,UserPrincipalName,whenCreated,whenChanged,MobilePhone,telephoneNumber,employeeNumber,postalCode,company”

image

Welcome to WeChat public: Xiao Wen Xi she.