Examples/ConfigureDatabases-Manual/ConfigureDatabases-Manual.ps1
Configuration ConfigureDatabasesManual { param ( [PSCredential]$ShellCreds ) Import-DscResource -Module xExchange Node $AllNodes.NodeName { #Used when passing credentials securely. This configures the thumbprint of the cert that will be used to decrypt the creds LocalConfigurationManager { CertificateId = $Node.Thumbprint } #Create primary databases foreach ($DB in $Node.PrimaryDBList.Values) { $resourceId = "MDB:$($DB.Name)" #Need to define a unique ID for each database xExchMailboxDatabase $resourceId { Name = $DB.Name Credential = $ShellCreds EdbFilePath = $DB.DBFilePath LogFolderPath = $DB.LogFolderPath Server = $Node.NodeName CircularLoggingEnabled = $true DatabaseCopyCount = 4 IssueWarningQuota = "50176MB" ProhibitSendQuota = "51200MB" ProhibitSendReceiveQuota = "52224MB" AllowServiceRestart = $true } } #Create the copies foreach ($DB in $Node.CopyDBList.Values) { $waitResourceId = "WaitForDB:$($DB.Name)" #Unique ID for the xExchWaitForMailboxDatabase resource $copyResourceId = "MDBCopy:$($DB.Name)" #Unique ID for the xExchMailboxDatabaseCopy resource #Need to wait for a primary copy to be created before we add a copy xExchWaitForMailboxDatabase $waitResourceId { Identity = $DB.Name Credential = $ShellCreds } xExchMailboxDatabaseCopy $copyResourceId { Identity = $DB.Name Credential = $ShellCreds MailboxServer = $Node.NodeName ActivationPreference = $DB.ActivationPreference ReplayLagTime = $DB.ReplayLagTime AllowServiceRestart = $true DependsOn = "[xExchWaitForMailboxDatabase]$($waitResourceId)" } } } } if ($ShellCreds -eq $null) { $ShellCreds = Get-Credential -Message 'Enter credentials for establishing Remote Powershell sessions to Exchange' } ###Compiles the example ConfigureDatabasesManual -ConfigurationData $PSScriptRoot\ConfigureDatabases-Manual-Config.psd1 -ShellCreds $ShellCreds ###Sets up LCM on specified computer to decrypt credentials (if passing creds securely) #Set-DscLocalConfigurationManager -Path .\ConfigureDatabasesManual -Verbose -ComputerName "E15-1" ###Pushes configuration to specified computer #Start-DscConfiguration -Verbose -Wait -Path .\ConfigureDatabasesManual -ComputerName "E15-1" |