PowerShell how to get around Active Directory referral errors

If you’re getting referral errors from your PowerShell scripts trying to enumerate users the problem is most likely your LDAP search scope. An LDAP referral error occurs when you’re searching in a domain that doesn’t contain the user you’re looking for. For example, if you’re looking for user cn=foo,dc=HQ,dc=contoso,dc=com, but your search scope is set to…


Powershell: Enumerating a LDAP Group with a large (>1500) number of users

Okay I searched though a lot of PowerShell Blogs for the answer to this but couldn’t find a solution that really worked. I finally just took the C# solution from a MSDN article (http://msdn.microsoft.com/en-us/library/ms180907(VS.85).aspx) and converted it to PowerShell. Hopefully this is helpful to someone! # $LDAPGroup is in the format cn=TestGroup,dc=contoso,dc=com $container = ‘LDAP://’ + $LDAPGroup$member…

1