Solved

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

Posted on 2013-10-25
7
681 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

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

Accepted Solution

by:
Subsun earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
This article will help you understand what HashTables are and how to use them in PowerShell.
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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…

825 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