Find AD users with most of their Attributes and save the result to a CSV file

I needed to find the AD users in specific OU or in the whole domain with are having the following attributes and save the result to a CSV file:

  • given Name
  • Sure Name
  • Title
  • Departement
  • Last login time
  • Mobile Phone
  • Display Name
  • …..

The following Script fulfilled what i need:

get-aduser -f * -Searchbase "ou=HRusers,dc=Contoso,dc=Com" -pr employeeType,EmployeeID,Description,displayname,Mobilephone,GivenName,
Surname,CN,Title,Manager,Department,Country,City,EmailAddress,LastLogonDate,Created,enabled | ConvertTo-Csv | Out-File c:\Users.csv

if you want to add more attribute you can chose from the list below:

http://social.technet.microsoft.com/wiki/contents/articles/12037.active-directory-get-aduser-default-and-extended-properties.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: