How to export users out of Active Directory

Posted on 2014-08-27
Last Modified: 2014-09-02

I like to export profiles out of active directory.  I see the Export List menu selection, when I do a right mouse click, but it only exports the organizational unit (OU) that you are at, and it does not export other OU, where I have the profiles.

Also, there are profiles, accounts and security groups that I don't want, but only active accounts and accounts for employees.  

How can I do this?
Question by:PBIT
    LVL 9

    Accepted Solution

    I believe the following addresses your needs:

    Essentially you download and install the Microsoft Active Directory Administration module for PowerShell and then open it.  Then run the following commands:

    Import-module ActiveDirectory

    Then you can run a search for users:

    Get-ADUser -Filter * -SearchBase "DC=domain,DC=name"  <- Obviously change domain name to suit your environment

    There a lot of options you can use for the filtering:

    Get-Help Get-ADUser -examples

    The page I linked above has this information on it.  Let me know if you need further assistance

    Author Comment

    Get-ADUser -Filter * -SearchBase "DC=domain, DC=com" -Properties mail Export-CSV "EmailAddresses.csv"

    I ran the above command, but PowerShell said the export-csv was an argument.  Can you tell me the argument that will get a CSV file?

    Author Comment

    I figured it out.

    Get-ADUser -Filter * -SearchBase "DC=domain, DC=com" -Properties department, displayname, officephone, mobilephone,

    title, division, emailaddress, manager | export-csv "d:\scripts\data.csv"

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    One of the major disadvantages of still running XP in production is its lack of Internet Explorer Favourites directory redirection. If your users frequently roam between computers, the usual workaround is to enable Roaming Profiles to have the favou…
    Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now