Try our new Certificate Revocation List Check Tool
CRLcheck.exe is a tool developed to verify digital signatures of executable files. It collects files from known paths on your client, checks their signature, and checks Certificate Revocation Lists (CRL) and OCSP download. This helps avoid delays in launching files.
Category published:  Exchange 2010 Exchange 2013 Exchange 2016 Exchange 2019 Microsoft Exchange   Click on the Category button to get more articles regarding that product.

Exchange: Addresslist and Dynamic Distribution Groups in Shell

Posted by admin on 16.10.2021

All you need are working samples not thousands lists and Technet Articles. So here we go with some Exchange Powershell we daily use.

Maybe you want lists of all fields so you can choose one to use for the filter first.

Get all user info from a certain OU

Starting OU would be:

 OU=Active,OU=Users_W7,OU=BUTSCH,DC=butsch,DC=ch

Get-ADUser -filter * -SearchBase “OU=Active,OU=Users_W7,OU=BUTSCH,DC=butsch,DC=ch” -Properties * | select-object givenname, sn, displayname, description,office, streetaddress,city,st,postalcode,country, title, Department, company | ConvertTo-Csv –NoTypeInformation

 Exchange 2010 Addresslist and Dynamic Distribution Groups (E-Mail Distribution)

 Exchange 2010 Addresslist

 

Generate Exchange Addresslist with starting OU, OPATH filter for CITY and STREET

new-AddressList -Name ‘Mitarbeiter Nestle Suisse – W110’ -RecipientContainer ‘butsch.ch/BUTSCH/Users_W7/Active’ -IncludedRecipients ‘MailboxUsers’ -Container ‘\’ -DisplayName ‘Mitarbeiter Nestle Suisse – W110’

set-Addresslist -identity ‘Mitarbeiter Nestle Suisse – W110’ -RecipientFilter {(ObjectClass -eq ‘user’ -and City -eq ‘Lausanne’ -and StreetAddress -eq ‘Roberstenstrasse 133’ )}

 
 

Remark: DO not try to add other additional GAL-addresslists because they will appear in the ROOT of the Adressbook. You can’t filter all you can with regular Addresslist and you will be limited when you migrate those to later Exchange versions.

Dynamic Distribution Groups

 
 

Generate Exchange Dynamic Distribution Groups with OU, OPATH filter for CITY and STREET

This will generate a DynamicDistributionGroup which is located in “‘butsch.ch/BUTSCH/Groups/Mail'” and will list all members of OU ‘butsch.ch/BUTSCH/Users_W7/Active’. With the second command we filter to show ONLY the employees who have the field city and Streetaddress with a certain value.

 
 

This is a TWO part and it ONLY works in two commands. Forget it and do not try.

 new-DynamicDistributionGroup -Name ‘Alle Mitarbeiter Nestle Suisse’ -RecipientContainer ‘butsch.ch/BUTSCH/Users_W7/Active’ -IncludedRecipients ‘MailboxUsers’ -OrganizationalUnit ‘butsch.ch/BUTSCH/Groups/Mail’ -Alias ‘Alle_Mitarbeiter_Nestle Suisse’

 set-DynamicDistributionGroup “Alle Mitarbeiter Nestle Suisse” -RecipientFilter {(ObjectClass -eq ‘user’ -and City -eq ‘Lausanne’ -and StreetAddress -eq ‘Roberstenstrasse 133’ )}

 If you want to change the FIELD, you search for check:

Filterable properties for the -RecipientFilter parameter

https://technet.microsoft.com/de-de/library/bb738157(v=exchg.150).aspx

Manage the Members of Distribution Groups

https://technet.microsoft.com/en-us/library/hh859493(v=exchg.141).aspx

Upgrade Custom LDAP Filters to OPATH Filters

https://technet.microsoft.com/en-us/library/cc164375(v=exchg.141).aspx

 
 


 Category published:  Exchange 2010 Exchange 2013 Exchange 2016 Exchange 2019 Microsoft Exchange   Click on the Category button to get more articles regarding that product.