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
653 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
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 500 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Do you have users whose passwords are expiring and they are constantly calling you?  Well I sure did and needed a way to put an end to this.  We have a lot of remote users which would not be notified that their passwords were expiring since they wer…
Resolve DNS query failed errors for Exchange
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 configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

757 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

21 Experts available now in Live!

Get 1:1 Help Now