Powershell - List all group members



  • The below script will list all group members. It can definitely be improved.

    Import-Module Activedirectory
    $credentials = Get-Credential
    
    $groups = Get-ADGroup -Properties DistinguishedName -Filter * DistinguishedName
    Foreach ($g in $groups)
    
    {
    	Write-Host $g.Name
    	Write-Host "---------"
    	Write-Host "         "
    	$g.Members
    
    }