I need to be able to run a script to get the Active Directory users email by domain name. The part on the right of the @ sign ex. JohnDoe@acme.com ( just acme.com
I want the script to search all email's in AD ending in domain "acme.com" and then add that user to a security group. ( memberof tab)
Is there a sample i can use?
The 'Mail' attribute specifies the users primary SMTP address.Querying the 'proxyAddresses' attribute might work better if you're looking for any users who have an @acme.com e-mail address and not just ones who have it set as their primary SMTP address. Depends on your requirements though.