Solved

List AD Users with PowerShell

Posted on 2014-01-22
6
212 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
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!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

679 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