ADGroupmember not returning contacts

  • 389 Views
  • Last Post 17 August 2018
yogeshcittu posted this 16 August 2018

Hi All,
I'm trying to get members list inside ADGroup but get-adgroupmember doesn't return "contacts".
Found that below script seems to be working for a single ADgroup

$GroupName = "group name"
$memberof=get-adgroup $GroupName |select -expandproperty distinguishedname
Get-ADObject -Filter 'memberof -eq $memberof ' -properties * | select name,mail,objectclass


Can anyone help me out get the same output for bulk ADGroups.
Regards,Yogesh

Order By: Standard | Newest | Votes
Biju_Babu posted this 16 August 2018

I'm trying to get members list inside ADGroup but get-adgroupmember doesn't return "contacts". – I don’t think it suppose to

 

You can use foreach loop in PowerShell

 

$Groups = Get-content c:\temp\grouplist.txt

Foreach ($Group in $Groups)

{

<your script>



}



 

show

michael1 posted this 16 August 2018

Correct.

 

A “contact” is an Exchange object.

 

Get-ADGroupMember returns users, computers, and other groups. But no Exchange objects.

 

Get-DistributionGroupMember would be the Exchange cmdlet to use.

 

Or, ignore both stupid sets of cmdlets and use ADSI or System.DirectoryServices.

 

J

 

show

alexbarth posted this 16 August 2018

If you want to keep using PowerShell cmdlets, try using Get-ADObject instead. For example:

 

Get-ADObject -Filter 'Name -eq "Group1"' -Properties member

 

That should list out all of the objects that are members of the group regardless of object type.

 



ALEX BARTH | ITS Systems - Shared Infrastructure

The University of Texas at Austin

|

alexbarth@xxxxxxxxxxxxxxxx
| utexas.edu



 

show

chriss3 posted this 17 August 2018

This is a bug / design issue of the AD PowerShell oh so crapy cmd’lets according to me. A Contact is NOT an Exchange object. It’s a DS base object class. 

show

Close