Solved

Active Directory - Powershell Command

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
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 …

911 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