Hi All,

Very short post today. Just really wanted to share a couple of very simple PoSH scripts that I use during some of my XenDesktop Training sessions. They are pretty simple but I’m sure someone out in the interweb will find them useful…

Note: The Examples below are for XD5.x and FMA v1.0 but they can very easily be adapted for XD7 and FMA v2.0 by adding the new XD7 services and removing reference to the Machine Identity Service (PvsVmDBConnection).

 

Site Prep: Reset DB connection strings to $null on all site controllers:

$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

}

 

SetMirrorDBConnection: Reconfigure DB connection strings all site controllers to include Failover Partner for Mirrored DB:

$cs = ‘Data Source=SQLServer; Failover Partner=SQLServer2; Initial Catalog=CitrixXenDesktopDB; Integrated Security=True; Network=dbmssocn’

$controllers= @(“ddc1_56″, “ddc2_56″)

foreach ($controller in $controllers) {

Write-Host “Reconnect controller $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

}

 

Best Regards
Mick Glover (aka XD Tipster)
Senior Readiness Specialist,
Worldwide Support Readiness [EMEA]
Citrix Systems, Inc