Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Powershell / QuestCommandLets script that would list theSAM accountname, display name, DN, description, and title then export to CSV file

Posted on 2013-01-02
6
Medium Priority
?
666 Views
Last Modified: 2013-02-25
Powershell / QuestCommandLets script that would list all users in a domain with the SAM accountname, display name, DN, description, and title then export to CSV file
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
6 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 38736964
# Script source: www.itbigbang.com
# Description: This script will search and find all active directory users in particular domain
# How to use this script: http://www.itbigbang.com/how-to-list-all-active-directory-users-in-a-particular-domain-using-powershell/

# Create New Directory Service Object
$objDomain = New-Object System.DirectoryServices.DirectoryEntry "LDAP://dc=test,dc=com"

$Result = Get-QADUser -SearchRoot $objDomain.distinguishedName -LdapFilter "(proxyAddresses=smtp:*@test.com)" | Get-QADUser | Select Email,SamAccountName,DisplayName,Name
IF($Result)
{
$Ouput = $Result.Email+","+$Result.SamAccountName+","+$Result.ProxyAddresses+","+$Result.DisplayName
$Ouput >> Output.txt
}
0
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 2000 total points
ID: 38736966
Just use this one
Get-QADUser * -SizeLimit 0 | Select sAMAccountName,DisplayName,DN,Description,Title | Export-CSV c:\allusers.csv

Open in new window


Regards,
Krzysztof
0
 
LVL 9

Expert Comment

by:David Carr
ID: 38736990
Change Email,SamAccountName,DisplayName,Name to SAMaccountname, display name, DN, description, title  in the example I provided
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 18

Expert Comment

by:Sarang Tinguria
ID: 38737054
Chris has a great GUI tool for all theese stuffs

Cjwdev | AD Info - Active Directory Reporting www.cjwdev.co.uk/Software/ADReportingTool/Info.html

Or

AdFind by joe but CLI
www.joeware.net/freetools/tools/adfind/index.htm
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38739265
dsquery user forestroot -limit 0 | dsget user -samid -display -dn -desc -title >leon.txt
Will give you the results in text format, so open in Excel and then resave as CSV.

Alternatively look at some output formating using the same dsquery commands for data extraction.
http://serverfault.com/questions/435366/i-need-to-export-a-list-of-all-users-on-our-domain-and-i-am-not-familiar-with-ds
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 38739309
Or just use CSVDE
csvde /f users.csv will export all users an all attributes to .csv format.
Open in Excel and delete the columns you don't want.

OR you can fine-tune the query to only export the fields you need:
csvde /f users.csv -r objectCategory=person -l "samaccountname, displayname, description, title"
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

A hard and fast method for reducing Active Directory Administrators members.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
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 …
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.

610 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