locked
Extract GUID to a file RRS feed

  • Question

  • I have a working ps1 file to extract Name,SamAccountName,Description,EmailAddress to a file.

    I need to add the GUID identity to this extract. 

    This is my working extraction ps1 (sanitized):

    Import-Module ActiveDirectory

    Get-ADUser -Filter * -SearchBase "ou=<DESIGNATEDOU>,ou=Domain Users and Groups,dc=<DOMAIN>,dc=local" -Properties Description,EmailAddress | 
        Select-Object -Property Name,SamAccountName,Description,EmailAddress | 
            Export-Csv "\\svr-resource2\home2$\information services\IS STAFF\Documentation\AD Info\scusers.csv"

    Thanks in advance!


    Karon W

    Thursday, April 3, 2014 1:14 PM

Answers

  • Just add objectGuid to your list of properties in the call to Select-Object, and you should be all set.
    • Proposed as answer by Mike Laughlin Thursday, April 3, 2014 1:50 PM
    • Marked as answer by Karon W Thursday, April 3, 2014 1:53 PM
    Thursday, April 3, 2014 1:47 PM

All replies

  • Just add objectGuid to your list of properties in the call to Select-Object, and you should be all set.
    • Proposed as answer by Mike Laughlin Thursday, April 3, 2014 1:50 PM
    • Marked as answer by Karon W Thursday, April 3, 2014 1:53 PM
    Thursday, April 3, 2014 1:47 PM
  • PERFECT!!! That did the trick! Thanks so much! I knew it had to be something simple... 

    Karon W

    Thursday, April 3, 2014 2:12 PM