Solved

List AD Users with PowerShell

Posted on 2014-01-22
6
206 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 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
Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

 
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

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to count occurrences of each item in an array.

707 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

17 Experts available now in Live!

Get 1:1 Help Now