Solved

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

Posted on 2013-10-25
7
683 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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 video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

729 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