Scenario: You would like to create Databases and Database Copies via a script. For each database, you want to set the Quotas for Send, Send/Receive, and Warning to unlimited as well.
Solution:
Create a db.csv file with the following column headers: DB,1,2,3,4. In that CSV File, put the name of the DB in the DB column, and each server in its numerical location based on Activation Preference:
db,1,2,3,4
DB1,Ex2013Srv1,Ex2013Srv2,Ex2013Srv3,Ex2013Srv4
DB2,Ex2013Srv2,Ex2013Srv3,Ex2013Srv4,Ex2013Srv1
DB3,Ex2013Srv3,Ex2013Srv4,Ex2013Srv1,Ex2013Srv2
DB4,Ex2013Srv4,Ex2013Srv1,Ex2013Srv2,Ex2013Srv3
Then run the script:
#Import the CSV File into a Variable $DBs = Import-CSV C:tempDb.csv #Loop the Variable $DBs | %{ #Declare variables for each column $n = $_.DB $1 = $_.1 $2 = $_.2 $3 = $_.3 $4 = $_.4 #Create the DB Write-Host "Creating $n" New-MailboxDatabase $n -EDBFilePath C:$nDB$n.edb -LogFolderPath C:$nLogs -Server $1 #Wait for replication Write-Host "Sleeping 3 minutes for replication" Sleep 180 #Mount the Database Write-Host "Mounting $n" Mount-Database $n #Wait for additional replication Write-Host "Sleeping 3 minutes for replication" Sleep 180 #Setting the DB Quotas Write-Host "Setting DB Quotas to unlimited" Set-MailboxDatabase $n -ProhibitSendReceiveQuota Unlimited -ProhibitSendQuota Unlimited -IssueWarningQuota Unlimited #Create the additional Database Copies Write-Host "Creating ActivationPreference2 for $n" Add-MailboxDatabaseCopy $n -MailboxServer $2 -ActivationPreference 2 Write-Host "Creating ActivationPreference3 for $n" Add-MailboxDatabaseCopy $n -MailboxServer $3 -ActivationPreference 3 Write-Host "Creating ActivationPreference4 for $n" Add-MailboxDatabaseCopy $n -MailboxServer $4 -ActivationPreference 4 }