Solved

AD System Login Report (Extract) -

Posted on 2014-11-20
4
159 Views
Last Modified: 2014-11-25
Hello,
Is there a way to extract some kind of report / list of domain usernames (system login) ,, using only either the first name and last name ,, or Display Name
?
using power shell ,, or something else?
Thanks
-
-
,,
0
Comment
Question by:mvalencia2003
[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
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Learnctx
ID: 40456825
Yes you can do this with Powershell. If you're running Server 2008 R2 you can do this using the AD cmdlets easily.

Import-Module ActiveDirectory
Get-ADUser -Filter {givenName -eq "John" -and sn -eq "Smith"} | Select Name, sAMAccountName, givenName, sn | Export-Csv -Notype -Path C:\Temp\Results.csv
## or
Get-ADUser -Filter {displayName -eq "Smith, John"} -Properties displayName | Select Name, sAMAccountName, givenName, sn, displayName | Export-Csv -Notype -Path C:\Temp\Results.csv

Open in new window


You can do it from an import csv file as well.
0
 
LVL 4

Author Comment

by:mvalencia2003
ID: 40457092
what if I have list of Display Names in an excel file , how is this done ,,
?
?
0
 
LVL 17

Accepted Solution

by:
Learnctx earned 500 total points
ID: 40459056
I'll need to make some assumptions here. So I'll assume that you have a text file with display names? Would that be accurate? Or is it a CSV?

## For a flat text file with display names
Get-Content c:\temp\displaynames.txt | Foreach-Object {
   Get-ADUser -Properties displayName -Filter {displayName -eq $_} 
} | Select-Object Name, sAMAccountName, displayName | Export-Csv -NoType c:\temp\results.csv

## For a CSV file with displayname as a header
Import-Csv c:\temp\displaynames.csv | Foreach-Object {
   Get-ADUser -Properties displayName -Filter {displayName -eq $_.displayName} 
} | Select-Object Name, sAMAccountName, displayName | Export-Csv -NoType c:\temp\results.csv

Open in new window

0
 
LVL 4

Author Closing Comment

by:mvalencia2003
ID: 40464276
,,
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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