none
Powershell scripts for AD users groupmemebership and nested groups RRS feed

  • General discussion

  • Hello everyone,

    basically, I can work with powersehll in very first level and not good at all with scripting.

    My boss has asked me to create an excel table which should contains all the users from all branches and clearly indicate that which user is in which groups.

    In my enviroment, we have many groups that are member of another group for better Info disterbution.

    Can anyone help me with this, please?

    Best regards,

    Jawad

    • Changed type Bill_Stewart Friday, April 28, 2017 8:26 PM
    • Moved by Bill_Stewart Friday, April 28, 2017 8:26 PM This is not "scripts on demand"
    Monday, March 27, 2017 1:12 PM

All replies

  • Read this first:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Monday, March 27, 2017 1:32 PM
  • Check the help for the PowerShell cmdlets Get-ADGroup (to retrieve all groups in the domain), and Get-ADGroupMember (to retrieve the membership in each). For example:

    Get-ADGroupMember "GroupSAMAcctName" -Recursive

    retrieves all members of the specified group, including due to nested groups. Select either sAMAccountName or distinguishedName (or Name if you don't mind that it does not uniquely identify the objects) and output to a comma delimited file (perhaps using the Export-CSV cmdlet), which can be easily read into Excel.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Monday, March 27, 2017 1:50 PM