XenDesktop 7 Move Database

Unfortunately once again the documentation provided by Citrix on moving databases from one SQL Server to another is incomplete. The documentation provided here: http://support.citrix.com/article/CTX140319 misses out the configuration of one of the services.

The listing misses out the configuration of the Citrix Analytics Service. In my environment this meant that after the reboot of the service, it tried to do a license server upgrade (I forgot to take a screenshot).

Secondly, the PowerShell that is supplied on the site removes the DB configuration for the MonitorDBConnection and LogDBConnection before removing the configuration from the DataStore of the respective services. This causes an error when running the commands in the order that they list.

My corrected version is below. This assumes that the database has already been moved to the new SQL server and the necessary logins created.

This script must be run elevated and needs to be run on all XenDesktop servers.

21 May 2017 – Updated script to support new services in XenDesktop 7.13, with backwards compatibility. Also prompts you to confirm that the new connection string is correct before continuing.

1 person found this post useful.

23 thoughts on “XenDesktop 7 Move Database

    1. Yes, It should update all databases. Only the server component of the connection string is updated, so the database name remains the same. It does require that all databases are moved at the same time though.

  1. It does’nt seem to work if the Server name is the same but the instance is different. Trying to run it with just an Instance name but it just reports the New Instance as the Old instance

    Old Server= SQL01\CITRIX02

    any ideas?

    1. Sorry for delay. I have not been able to replicate this. Have set up a new instance and attempted to move and it completed the move and worked.

    1. Hi,

      Yes, I did. However, whilst the database is offline no new users will be able to connect. So I would schedule out-of-hours or at the quietest possible time.


  2. Hi Craig,
    Can this be applied to move an existing database (standalone) to a clustered database. I have been trying this and get the error noted in the beginning of this article. I have tried using your script with no success


    1. Yes it can be used to move from a standalone to a clustered instance. The underlying SQL architecture is irrelevant.

      I have just updated to script to support all of the services in XenDesktop 7.13, as some new services were missing.

  3. We have 3 DCs in our site. What process do you find works best. Do you power down the servers not being worked on during the conversion?

    1. The process I used was:

      1. Backup database, but leave online on old instance.
      2. Restore to the new instance
      3. Run script one server at a time, verifying that the new configuration works
      4. Once all servers are updated, take the database offline on the old instance.

  4. In my case I am migrating from a standalone SQL Server to Always On Availability Group

    What steps and additional considerations are required for ensuring a smooth migration?
    So far I have:
    1. DDC Accounts on SQL (Need to Match)
    2. When re-conecting use the Listener´s name.

    1. I haven’t actually done this yet. Something I am looking to do later this year as I am currently working on the SQL side. From the DDC point of view, it is just a different SQL instance, so what you have listed looks to be sufficient.

      It would be great to hear back how you get on though and if you encounter anything else.

  5. You are a lifesaver, I have spent a couple of days trying to dismount and remount a database to Studio and had failed constantly when running the scripts from Citrix sites and forums.

    Ran your script and it worked first time, restored Studio connection and no silliness about an upgrade.

    1. Hi, just out of curiousity; we came across the same issue, were you changing the DB links for 7.6 or a different version of XenDesktop?

  6. Craig, thanks for the information. The observation you made about the Citrix docs being both incomplete and in the wrong order was dead on.. Spent a considerable amount of time trying to muddle through before i ran across your post… Worked like a champ!
    Thanks again

      1. Do we just need to run this powershell script ? Does it need any parameters ?
        And one query I have is, here we define only the server names. where does it take database details from ?


        1. Hi,

          You just run it after changing the server and instance names that you have highlighted. The script is not a function and does not take parameters.

          This also assumes that the database name is going to remain the same.

          Hope that clarifies what the script does.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.