locked
PowerShell for User Information RRS feed

  • Question

  • Hello,

    Is there a PowerShell Script available that will export to a cvs to display user information like the users name into two different  columns example: Firstname in one column and last name in next column and show email address, and office location from Active Directory?

    Thanks

    • Moved by Bill_Stewart Thursday, April 23, 2015 2:31 PM Unanswerable drive-by question
    Friday, March 20, 2015 1:42 PM

Answers

  • Get-ADUser -Filter '*' -Properties givenName,sn,mail,office |  select givenName,sn,mail,office | Export-Csv 'C:\export.csv' -NoTypeInformation


    Raf Delgado

    • Proposed as answer by Raf Delgado Friday, May 22, 2015 3:57 AM
    • Marked as answer by Just Karl Friday, May 29, 2015 9:19 PM
    Friday, March 20, 2015 7:14 PM
  • I really appreciate your help but how would the script look? I'm confused.

    Something like this:

    Get-ADUser -Filter * -Properties EmailAddress,Office |
        Select-Object GivenName,Surname,EmailAddress,Office |
            Export-Csv .\userDetails.csv -NoTypeInformation

    You may want to look at the -SearchBase parameter of Get-ADUser to target this to individual OUs.


    EDIT: Ah, I see I'm slow on the submit button. See Raf's post above.

    Don't retire TechNet! - (Don't give up yet - 13,225+ strong and growing)

    • Edited by Mike Laughlin Friday, March 20, 2015 7:24 PM
    • Proposed as answer by Just Karl Friday, May 22, 2015 7:47 PM
    • Marked as answer by Just Karl Friday, May 29, 2015 9:19 PM
    Friday, March 20, 2015 7:24 PM

All replies