Get-ADUser – PowerShell & Active Directory

Well, Get-ADUser is a useful PowerShell command to get everything you required from single object in Active Directory. For instance, I have around 2500 objects in Active Directory and these objects are populated with an Employee ID in the Description Filed.

I have a requirement where I want to fetch the Name, Email ID and the Description ‘Employee ID’

Get-ADUser has several approaches to fetch this requirement, but  in here I will talk about the main thing which got my requirement fulfilled.

Get-Content C:\EmployeeID.txt | ForEach-Object { Get-ADUser -Filter {Description -eq $_} -Properties EmailAddress, Description | Select-Object Name, EmailAddress, Description } | Export-Csv C:\ID.csv -NoTypeInformation

All done, this will give a result of a CSV File with Name, Email Address and Description.


  1. #1 by Vps provider on November 6, 2012 - 4:43 pm

    whoah this weblog is excellent i really like studying your articles.
    Keep up the good work! You know, lots of people are hunting around
    for this information, you could aid them greatly.

    • #2 by habibalby on November 6, 2012 - 5:44 pm

      Thank you, stay tune for more on that.. Daily Shell ;)

  2. #3 by Charles on March 20, 2015 - 9:34 am

    I was looking for this! In my DC, when I run Export-csv or out-file, am getting Access to the path is denied message.

    I have various drives from C to E and have given full control for tat folder in the drive but still not working!

    • #4 by habibalby on February 25, 2018 - 12:09 pm

      Hi Charles,
      You will need to launch PowerShell as an Administrator..


Leave a Reply

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

You are commenting using your 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: