Solved

List AD Users with PowerShell

Posted on 2014-01-22
6
210 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

860 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