Tag Archives: DB

Script used for enable XenDesktop Database Mirroring

Make sure that all DDCs are up and running, then run below PowerShell Script.

$cs = 'Data Source=DB1; Failover Partner=DB2; Initial Catalog=XenDesktopDB; Integrated Security=True; Network=dbmssocn’


$controllers = Get-BrokerController | %{$_.DNSName}
foreach ($controller in $controllers) {
    Write-Host "Disconnect controller $controller ..."
    Set-ConfigDBConnection –DBConnection $null –AdminAddress $controller
    Set-HypDBConnection –DBConnection $null –AdminAddress $controller
    Set-AcctDBConnection –DBConnection $null –AdminAddress $controller
    Set-ProvDBConnection –DBConnection $null –AdminAddress $controller
    Set-PvsVmDBConnection –DBConnection $null –AdminAddress $controller
    Set-BrokerDBConnection –DBConnection $null –AdminAddress $controller
} 



    Set-ConfigDBConnection –DBConnection $cs –AdminAddress $controller
    Set-HypDBConnection –DBConnection $cs –AdminAddress $controller
    Set-AcctDBConnection –DBConnection $cs –AdminAddress  $controller
    Set-ProvDBConnection –DBConnection $cs –AdminAddress $controller
    Set-PvsVmDBConnection –DBConnection $cs –AdminAddress $controller
    Set-BrokerDBConnection –DBConnection $cs –AdminAddress $controller