?
Solved

Powershell / QuestCommandlets script that would extract user account information to a .CSV File

Posted on 2013-10-25
7
Medium Priority
?
686 Views
Last Modified: 2013-10-25
So, a script that could pull AD users if certain fields weren't populated?


Powershell / QuestCommandlets script that would extract user account information to a .CSV File.

These are the items:

Office
Street
City
Country
Job Title
Department
Manager
0
Comment
Question by:mjm21
[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
  • 4
  • 2
7 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39601181
Use the code below to accomplish what you have asked...

Import-module activedirectory
Get-ADUser -filter * -Properties * | select Name, Office, Street, City, Country, Title, Department, Manager | export-csv "c:\exportedUsers.csv"

Will.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39601258
script that could pull AD users if certain fields weren't populated?
Try...
Get-Qaduser -SizeLimit 0 | ? { 
 $_.Office -eq $null -or `
 $_.StreetAddress -eq $null -or `
 $_.City -eq $null -or `
 $_.Country -eq $null -or `
 $_.Title -eq $null -or `
 $_.Department -eq $null -or `
 $_.Manager -eq $null
} | Select Samaccountname,Office,StreetAddress,City,Country,Title,Department,Manager |
Export-csv C:\report.csv -NTI

Open in new window

Replace Get-Qaduser -SizeLimit 0 with Get-Aduser -filter * -Properties * to run it with MS AD PowerShell..
0
 

Author Comment

by:mjm21
ID: 39601347
Thanks going to test now!
0
Industry Leaders: 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!

 

Author Comment

by:mjm21
ID: 39601449
Everything works fine except "country"
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39601471
Ok use CO or C instead of  country..
Get-Qaduser -SizeLimit 0 -ip CO | ? { 
 $_.Office -eq $null -or `
 $_.StreetAddress -eq $null -or `
 $_.City -eq $null -or `
 $_.CO -eq $null -or `
 $_.Title -eq $null -or `
 $_.Department -eq $null -or `
 $_.Manager -eq $null
} | Select Samaccountname,Office,StreetAddress,City,Co,Title,Department,Manager |
Export-csv C:\report.csv -NTI

Open in new window

0
 

Author Comment

by:mjm21
ID: 39601598
The CO did it.  Many Thanks!
0
 

Author Closing Comment

by:mjm21
ID: 39601601
Excellent Job!!
0

Featured Post

WatchGuard's M Series Appliances - Miecom Approved

WatchGuard's newest M series appliances were put to the test by Miercom.  We had great results and outperformed all of our competitors in both stateless and stateful traffic throghput scenarios! Ready to see how your UTM appliance stacked up? Download the Miercom Report!

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

801 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