July 2017
Intermediate to advanced
648 pages
31h 9m
English
This code uses a foreach loop to iterate through each distribution group in the organization. As each group is processed, we retrieve only the members whose recipient type contains the word User. We're also filtering out all non-user mailboxes as these are tied to disabled Active Directory accounts. These filters will ensure that we only pipe objects with Active Directory user accounts down to the Get-User cmdlet, which will determine whether or not the account is disabled by checking the UserAccountControl property of each object. If the account is disabled, it will be removed from the group. See the following screenshot as an example:
Read now
Unlock full access