One of the strengths of using PowerShell for Exchange Server administration is the ability to perform changes to multiple objects simultaneously. In this article I will demonstrate an example of this by showing you how to update a setting on multiple Exchange Server mailbox databases at once.

In this example the public folder database associated with the mailbox databases needs to be configured. There is already one mailbox database with the correct public folder setting and we want to apply the same setting to all of the other mailbox databases on the server.

Doing this manually, one at a time would be tedious.  But thanks to the Exchange Management Shell we can do it very quickly.

First, read the desired public folder setting from the first mailbox database into a variable.

[PS] C:\>$pfdb = (Get-mailboxdatabase EX2007MB1EX2007MB1_DB1).publicfolderdatabase

Now we can inspect the variable to see the result of that first step.

[PS] C:\>$pfdb

Rdn               : CN=EX2007PF1_DB1
Parent            : EX2007PF1EX2007PF1_SG1
Depth             : 12
DistinguishedName : CN=EX2007PF1_DB1,CN=EX2007PF1_SG1,CN=InformationStore,C
                    N=EX2007PF1,CN=Servers,CN=Exchange Administrative Group (
                    FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Corp,CN=M
                    icrosoft Exchange,CN=Services,CN=Configuration,DC=corp,
                    DC=org
DomainId          : corp.org
ObjectGuid        : e898f054-85f2-4486-9d35-654a16083348
Name              : EX2007PF1_DB1

Next, we apply that public folder setting to all of the mailbox databases on the server with this single command line.

[PS] C:\>Get-MailboxDatabase -server EX2007MB1 | Set-MailboxDatabase -PublicFolderDatabase $pfdb

Now we can confirm that the change has occurred.

[PS] C:\>Get-MailboxDatabase -server EX2007MB1 | ft name,publicfolderdatabase

Name                                    PublicFolderDatabase
----                                    --------------------
EX2007MB1_DB1                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB2                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB3                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB4                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB5                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB6                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB7                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB8                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB9                         EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB10                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB11                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB12                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB13                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB14                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB15                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB16                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB17                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB18                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB19                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB20                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB21                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB22                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB23                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB24                        EX2007PF1EX2007PF1_SG1EX2007PF...
EX2007MB1_DB25                        EX2007PF1EX2007PF1_SG1EX2007PF...

As you can see the Exchange Management Shell lets us make bulk changes with ease.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Leave a Reply