Skip to content

Instantly share code, notes, and snippets.

@Apoc70
Created October 24, 2024 16:26
Show Gist options
  • Select an option

  • Save Apoc70/cb8a025c204d46cf3df8887301df0fa5 to your computer and use it in GitHub Desktop.

Select an option

Save Apoc70/cb8a025c204d46cf3df8887301df0fa5 to your computer and use it in GitHub Desktop.
A quick script to add a new Exchange mailbox database to a dedicated file path.
# Variables specific to your environment
# Name of Exchange Server, database name, subfolder, default Offline Addressbook
$Server = 'VAREX01'
$DatabaseName = 'MXDB75'
$DatabaseSet = 'DBSet03'
$OAB = '\Standard-Offlineadressbuch'
# domain controller to use
$DomainController = 'vardc01.varunagroup.de'
# local database root path
$DBBasePath = 'C:\ExchangeDatabases'
# database file path and file name, and log file path created as dedicated in subfolders
$EdbPath = ('{0}\{1}\{1}.db\{1}.edb' -f (Join-Path -Path $DBBasePath -ChildPath $DatabaseSet), $DatabaseName )
$LogPath = ('{0}\{1}\{1}.log' -f (Join-Path -Path $DBBasePath -ChildPath $DatabaseSet), $DatabaseName )
Write-Host ('EDB Path: {0}' -f $EdbPath)
Write-Host ('LOG Path: {0}' -f $LogPath)
# create new mailbox database excluded from provisioning
New-MailboxDatabase -Server $Server -Name $DatabaseName -EdbFilePath $EdbPath -LogFolderPath $LogPath `
-DomainController $DomainController -OfflineAddressBook $OAB `
-IsExcludedFromInitialProvisioning -IsExcludedFromProvisioning:$true # -WhatIf
# set specific mailbox database settings
Set-MailboxDatabase -Identity $DatabaseName `
-ProhibitSendReceiveQuota 6GB `
-ProhibitSendQuota 5GB `
-RecoverableItemsQuota 30GB `
-RecoverableItemsWarningQuota 20GB `
-CalendarLoggingQuota 5GB `
-IssueWarningQuota 4GB `
-RetainDeletedItemsUntilBackup:$true `
-DeletedItemRetention 60.00:00:00 `
-MailboxRetention 91.00:00:00 `
-DomainController $DomainController #`
# -WhatIf
# now you can mount the database manually
# validate all settings prior mounting the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment