PowerShell Get-AdGroupmember doen't work for some groups

815 views Asked by At

I am trying to execute the below PowerShell command. Its giving proper results for some AD groups, but "Cannot find an object with identity xxxx under region.company.com" for few groups. I'm looping the below command over a list of AD groups in the same domain (I can see the those groups throwing error in the Active Directory web interface. So those AD groups are actually there under the same $domain - yyy) I've obviously checked the spelling, syntax etc multiple times. (In fact, the script works perfectly for all the remaining domains).

$domain = "region.company.com"
$group = "xxxx"
Get-ADGroupMember -server $domain -identity $group | select name,distinguishedname

I am new to PowerShell and banging my head over this issue. Any help is greatly appreciated.

Note: Here, I'm passing the group name in $group. I also tried to use distinguished name instead of group's name, and it threw same error for ALL the groups, not some!

Edit: I've corrected the typo errors and included few more details on the problem.

Thank you in advance!

0

There are 0 answers