Sep. 12, 2016
XenDesktop 7.6 introduced the Analytics Service which also needs its database connection string updated. The service is responsible for sending information back to Citrix as part of the Customer Experience Improvement Program (CEIP).
The only change to the commands from previous versions is the need to use the cmdlet to update the DBConnection:
If you run it just after you use the command Set-SfDBConnection, then it should update correctly.
Many customers have started to use Always On Availability Groups for their high availability (HA) database solution. For the most part, the use of Availability Groups is invisible to XenDesktop. However, there is one recommended setting that Microsoft says should be part of the connection string: MultiSubnetFailover=true. Citrix recommends this option in both single subnet and multi-subnet environments, and it speeds up recovery when an HA event occurs.
This option is only available in .Net versions that are patched to include it. Depending on the version of XenDesktop you're using will depend on which KB patch you'll need to add support.
When you're running on a supported .Net version, you'll need to update the connection strings. To do this is very similar to the changes for mirroring, you have to null the connection string, then set it back to the same, but with the extra option ';MultiSubnetFailover=true'.
Keyword 'multisubnetfailover' is not supported
On Windows 7 or 2008 R2, you might receive the above error message on the Configuration node in Studio, because Studio uses the Microsoft Management Console (MMC) that is using .Net 3.5 SP1 runtime on Windows 7 and 2008 R2. To avoid the error, you need to apply the patch to .Net 3.5 SP1. Note that the services will be using .Net 4.x runtime. (This section was added on April 15th, 2015)
Citrix updated the script to include the analytics service. While doing so, we broke out the core functions into a separate file and created some wrapper scripts to use those functions. You can find the ZIP file that contains the scripts at:
The scripts rquire PowerShell v3 at the moment (You might be able to switch to PowerShell v2, but v3 is needed to load the core script into the other scripts.)
Citrix tested the scripts on Server 2012 R2, with XenDesktop 7.5 and XenDesktop 7.6. Note that this was as a full site administrator and in the local administrator PowerShell window.
The provided scripts are:
DBConnectionStringFuncs.ps1 - this is the core script and does the actual work. It contains common functions which the following scripts then use.
Change_XD_Failover_Partner_v1.ps1 - similar to a previously posted script and is used to update the failover partner.
Change_XD_To_ConnectionString.ps1 - takes the passed in connection strings and uses them, so a very generic version.
Change_XD_To_MultiSubnetFailover.ps1 - toggles the addition and removal of MultiSubnetFailover=true. Run the script once to add the options and run it again to remove the options.
Change_XD_To_Null.ps1 - resets of all the connection strings on the localhost if something went wrong. Note that because this resets the connection strings to null, it will place the DDC into an "initial" state. For example, if you run Studio it'll ask if you want to create a site, or join another DDC. You might find this useful if something went wrong somewhere, and a reset is needed, so you can then attempt to set the connection strings again.
If you need to do some connection string manipulation, look at how the Change_XD scripts use the functions in DBConnectionStringFuncs.ps1.
Disclaimer that Applies to the Scripts
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.