Solved

Active Directory - Powershell Command

Posted on 2015-02-09
5
6 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

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mapped shared drives are with red X mark 4 47
Script is being strange 8 51
Unknown AD user under VMWare OU 4 29
GPO warning 15 27
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

744 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

13 Experts available now in Live!

Get 1:1 Help Now