I must be doing something silly but I'm damned if I can see what. According my Googling this Powershell script should list the members of the Domain Users group:
$root=([ADSI]"").distinguishedName
$group = [ADSI] ("LDAP://cn=Domain Users,cn=Users," + $root)
Write-Host $group.distinguishedName
Write-Host "Members:"
foreach ($member in $group.member)
{
$member
}
But when I run it I just get the output:
CN=Domain Users,CN=Users,DC=mydomain,DC=local
Members:
So it's finding the group OK but not listing the members. I've tried this on Server 2003 and Server 2008 and I'm out of ideas for where my obvious mistake is. Please help ...
JR