Solved

Active Directory - Powershell Command

Posted on 2015-02-09
5
9 Views
Last Modified: 2016-06-23
Hi,

Can you please let me know how i can get the following information from Active Directory into excel using powershell command.

Specific OU container e.g. test.loc, UK, Office 1, Users
Display Name
Title
Department
Company
Street Address
City
Postal Code
Country or Region
Phone
Manager
Mobile

thanks
0
Comment
Question by:MVTechies
  • 2
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 40598563
Use the following powershell command below...

import-module activedirectory
get-aduser -filter * -properties * | select DistinguishedName, Name, Title, Department, Company, StreetAddress, City, PostalCode, Country, OfficePhone, Manager, MobilePhone | export-csv "c:\users.csv" -notypeinformation

Open in new window


Will.
0
 

Author Comment

by:MVTechies
ID: 40598579
thanks Will,

How can i drill this down to only a specific container? We have multiple OU's and i only need this for a couple of specific groups.

thanks
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 500 total points
ID: 40598594
Just use the code below. I have added the additional syntax.

import-module activedirectory
get-aduser -filter * -SearchBase "ou=mfg,dc=domain,dc=com" -properties * | select DistinguishedName, Name, Title, Department, Company, StreetAddress, City, PostalCode, Country, OfficePhone, Manager, MobilePhone | export-csv "c:\users.csv" -notypeinformation

Open in new window


I have added the line "ou=mfg,dc=domain,dc=com" you need to change this to the OU and domain that you are running this under.

Let me know if you need any help with this.

Will.
0
 

Author Comment

by:MVTechies
ID: 40598620
thanks Will.

Much appreciate the quick response.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

830 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