Solved

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

Posted on 2013-10-25
7
678 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks going to test now!
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:mjm21
Comment Utility
Everything works fine except "country"
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
Comment Utility
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
Comment Utility
The CO did it.  Many Thanks!
0
 

Author Closing Comment

by:mjm21
Comment Utility
Excellent Job!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now