Solved

AD System Login Report (Extract) -

Posted on 2014-11-20
4
160 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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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