Solved

List AD Users with PowerShell

Posted on 2014-01-22
6
213 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
[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
  • 3
  • 2
6 Comments
 
LVL 1

Assisted Solution

by:felo86
felo86 earned 100 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 400 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
An article on effective troubleshooting
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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