Get Distribution list members recursively including contact objects

Get Distribution list members recursively including contact objects

I have written this script to get recursively the members of the distribution lists in a specific OU. It is simple if your Active Directory distribution lists contain user account.
You will have problem if your DL includes contact objects :

Technet article https://technet.microsoft.com/en-us/library/ee617193.aspx:
The Get-ADGroupMember cmdlet gets the members of an Active Directory group. Members can be users, groups, and computers.

The solution, in that case, is to use the cmdlet get-adobject. The script below extract recursively the members of the dl in a specific OU and then export the result in text files ; one text file per dl that contains members dn.

And now the script:


References

Get-ADObject

<>

My Powershell script categories

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: