[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 123
  • Last Modified:

How to export users out of Active Directory

Hello,

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?
0
PBIT
Asked:
PBIT
  • 2
1 Solution
 
bas2754Commented:
I believe the following addresses your needs:

http://www.deliveron.com/blog/post/Query-for-User-Accounts-in-Active-Directory-with-PowerShell.aspx

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
0
 
PBITAuthor Commented:
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?
0
 
PBITAuthor Commented:
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"
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now