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…


Getting XML values in PowerShell

I couldn’t believe how easy this was when I finally figured it out… I needed to enumerate all of the email addresses with an <email> tag in an XML file. The only really tricky thing was using the “InnerXML” property  # Create XML document from file$MemberDoc = (get-content $XMLFile) # Get all of the email addresses…