Solved

Active Directory - Powershell Command

Posted on 2015-02-09
5
13 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Active Directory Disappeared 2 49
ADFS MSIS7065 error 8 35
Configure Windows Server 2012 time server 3 37
Deploying MSI package with GPO 3 24
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

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