S
shimojimatto
Guest
shimojimatto Asks: EMS: Filter Get-Mailbox results to Database with '-like' and wildcards
The end-game here is to create dynamic distribution groups based on similar Exchange databases. We have personnel mailboxes split into several databases by region and naming follows set conventions.
As a proof of concept I've been using the "Get-Mailbox" command with a -Filter and -or operators to list multiple databases and it works. The result is something like this:
This works fine... I get a list of mailboxes in those databases. But isn't ideal if another database is added due to an increased user count.
MS documentation here says that the "homeMDB/Database property is compatible with wildcards...
So, this should then theoretically work and give the same result:
But, this command returns no results.... no errors... nothing.
Is -like just not supported? Am I doing something wrong?
P.S. '-Filter' will be replaced with '-RecipientFilter" for the New-DynamicDistributionGroup command. Get-Mailbox is being used to verify that my filter is working correctly.
The end-game here is to create dynamic distribution groups based on similar Exchange databases. We have personnel mailboxes split into several databases by region and naming follows set conventions.
As a proof of concept I've been using the "Get-Mailbox" command with a -Filter and -or operators to list multiple databases and it works. The result is something like this:
Code:
Get-Mailbox -Filter {
(
(Database -eq 'CN=DBname01,CN=therestoftheDistinguishedName,DC=com')
-or
(Database -eq 'CN=DBname02,CN=therestoftheDistinguishedName,DC=com')
)
}
This works fine... I get a list of mailboxes in those databases. But isn't ideal if another database is added due to an increased user count.
MS documentation here says that the "homeMDB/Database property is compatible with wildcards...
So, this should then theoretically work and give the same result:
Code:
Get-Mailbox -Filter {(Database -like "CN=DBname*")}
But, this command returns no results.... no errors... nothing.
Is -like just not supported? Am I doing something wrong?
P.S. '-Filter' will be replaced with '-RecipientFilter" for the New-DynamicDistributionGroup command. Get-Mailbox is being used to verify that my filter is working correctly.
SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.