Create a PowerShell script.

  1. start PowerShell ( as administrator )
  2. create directory : mkdir “name of te new directoy”
  3. cd “name of te new directoy”
  4. new-item Get-ADGroupMember-script.ps1
  5. notepad.exe  Get-ADGroupMember-script.ps1
  6. copy and paste the text in to the file:

 

#################################################################

$name = Read-Host 'Enter the group you want to view the members of'

Get-ADGroupMember -Identity ${name} -Recursive | select Name, objectclass

  # -Recursive # With this option you can see the members who are member of the first group! This will show you the users from the subgroep check example.

  #  Note: Run this on a ( domain controller / member server / computer with RSAT )

#################################################################

 

7. start the command:  .\Get-ADGroupMember-script.ps1

 

 

 

8.  when using Active Directory:

 

 

 

When starting this script without the option : -Recursive

###########################################################
$name = Read-Host 'Enter the group you want to view the members of'

Get-ADGroupMember -Identity ${name} | select Name, objectclass


  # -Recursive # With this option you can see the members who are member of the first group! This will show you the users from the subgroep check example.

  #  Note: Run this on a ( domain controller / member server / computer with RSAT )

#################################################################

You will see the nested group: subgroep  who is member of the testgroep. You can't see the users at this moment who are member of the subgroep.