Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List AD Users with PowerShell

Posted on 2014-01-22
6
Medium Priority
?
221 Views
Last Modified: 2014-01-22
Hello Everyone,

My PowerShell Skills are near non-existant.

I'm looking for a powershell script that will list all the users in my AD. All I need is a Firstname, Lastname and SamAccountName please?

Any help would be awesome thanks.
0
Comment
Question by:Ampletrix
  • 3
  • 2
6 Comments
 
LVL 1

Assisted Solution

by:felo86
felo86 earned 400 total points
ID: 39801736
Hi Ampletrix
Here's a Powershell script that will do just that! Download
0
 

Author Comment

by:Ampletrix
ID: 39801764
Thanks guys.

I'm getting errors using this script. I don't want to import any users.
All I'm looking for is a csv file with FirstName, LastName and SamAccount info.
What's the command that I must use?
Apology if I'm an ID10t.
:-)
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 1600 total points
ID: 39801773
Use the following syntax below...

import-module activedirectory
Get-aduser -filter * - properties * | select GivenName, Surname, sAMaccountName | export-csv -noTypeInformation "c:\users.csv"

Open in new window


Will.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:felo86
ID: 39801774
If you dont mind installing the FREE Quest cmdlets from here this could be as simple as

# For all properties
Get-QADUser -sl 0 -IncludeAllProperties -SerializeValues | export-csv <file> -noType

# For just the properties in your script
Get-QADUser -sl 0 -IncludeAllProperties -SerializeValues | select DisplayName,mailnickName,city | export-csv <file> -noType
0
 

Author Comment

by:Ampletrix
ID: 39801787
Unfortunately I can't install the  FREE Quest cmdlets felo86, but thanks for the input.

Will - Have you tested your command? I'm getting an error.
0
 

Author Closing Comment

by:Ampletrix
ID: 39801826
Thanks guys. Will's solution was what I was looking for and managed to fix the syntax. Cheers guys.
0

Featured Post

Independent Software Vendors: 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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

971 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