?
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
?
660 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
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.

 
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

Office 365 Training for Admins - 7 Day Trial

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
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 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.
Suggested Courses

752 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