AD power shell module command help please

Welcome Forums General PowerShell Q&A AD power shell module command help please

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 month, 2 weeks ago.

  • Author
    Posts
  • #118930

    Participant
    Points: 10
    Rank: Member

    Hello Total Noob here,

    The command below works just fine and pulls all the user names from within the "AD Group Name" I enter and exports them to an excel file under the A column. I would like to also have it pull each users Active Directory OU location and place it under the B column.

    My question is what do I need to add to the code below to achieved this? Thank you in advance for all your help.

    get-adgroupmember -identity "AD Group Name" | Select name | Export-csv -path C:\Output\Groupmembers.csv -NoTypeInformation

     

  • #118936

    Moderator
    Points: 171
    Team MemberHelping Hand
    Rank: Participant
    Get-ADGroupMember GROUP |
    Select-Object name, @{
    Name='Parent'
    Expression={$PSItem.DistinguishedName -replace "^.*?,(?=OU=)"}
    } | Export-Csv -Path C:\Output\Groupmembers.csv -NoTypeInformation

     

  • #119056

    Participant
    Points: 10
    Rank: Member

    Thank you so much Wes this was exactly what I needed to pull, thank you again for the help!

You must be logged in to reply to this topic.