Prints the e-mailaddress of ADGroupMembers. Needs Module ActiveDirectory
Import-Module ActiveDirectory $list = @() $gebruikers = @() $Applicatiegroep = "ADGroup" $list = Get-ADGroupMember $Applicatiegroep -recursive foreach ($item in $list){$user = $item.Samaccountname foreach ($u in $user){$a = Get-ADuser $user -Properties * foreach ($B in $A){$gebruikers += $B.mail}}} $gebruikers