Migrating MSMQ Configuration to a New Server

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

MSMQ has two types of configuration:

  1. Service settings. These settings, such as storage locations and machine quotas, apply to the local MSMQ service instance. Service settings are usually set at when MSMQ is installed or when an administrator deploys an application that uses MSMQ.

  2. Queue settings. These settings, such as queue type and queue quota, are queue-specific. Queue settings are usually set as part of application deployment.

Migrating settings from an existing MSMQ server to a new MSMQ server is not a common scenario. For example, after replacing server hardware an administrator might want to perform such a migration. In this scenario, you should perform the following steps:

  1. Install MSMQ on the replacement server.

  2. Use PowerShell to read and display the MSMQ service and queue settings. Apply these settings to the replacement server.

  3. Quiesce all sending application(s). If you cannot quiesce all sending applications, block them from sending to the server (for example, by manipulating the firewall on the old server).

  4. Keep the receiving applications running until all enqueued messages have been consumed.

  5. If the old server is domain-joined, unjoin it from the domain. This step is particularly important if MSMQ is used in AD Integrated mode.

  6. Shut down and decommission the existing server.

  7. Assign the old server’s name and IP address to the replacement server.

  8. Restart the application(s) on the replacement server.

Steps 3 and 4 are not required if messages can be lost during the migration.

MSMQ supports operating system upgrades of a configured MSMQ server. An operating system upgrade preserves all server settings and queues, and the upgrade process automatically makes any changes required because of MSMQ version differences. If the you cannot safely automate these changes, you should document the manual steps that administrator must take in the Release Notes.

MSMQ supports SysPrep installation of MSMQ service settings when you deploy a new MSMQ server.

MSMQ provides PowerShell cmdlets that allow scripting of service and queue settings. Such scripts can configure the service instance and queue settings with default values. Alternatively, a script can read the service and queue settings from an existing server and apply them to a different server. A true clone of a MSMQ server is impossible because the new server and queues still have different GUIDs, encryption keys, certificates, and other features. Cloning a queue is also impossible because a queue on one machine is different from a queue with the same name on a different machine. For example, a queue named A that is created on machine2 is different from a queue of the same name on machine1. Although an administrator can configure machine2\A identically to machine1\A and reconfigure the application to use machine2\A, neither queue is a clone of the other; they are different queues that happen to perform the same function.

To deploy an MSMQ server using SysPrep

  1. Install Windows.

  2. Install MSMQ, and configure MSMQ service settings.

  3. Run SysPrep to get a deployable image.

  4. Deploy the image.

  5. On newly-deployed server do one of the following:

    1. Deploy the application. The application deployment process creates and configures queues as necessary.

    2. Use PowerShell to create and configure queues, then deploy the application.

To deploy an MSMQ Server without using SysPrep

  1. Install Windows.

  2. Use PowerShell and scripts to install MSMQ and MSMQ service settings.

  3. On newly-deployed server do one of the following:

    1. Deploy the application. The application deployment process creates and configures queues as necessary.

    2. Use PowerShell to create and configure queues. Then deploy the application.

Important

If you upgrade from Windows Server 2008 or Windows Server 2008 R2 to Windows Server 2012 the original 1024-bit public encryption keys will still be in place. You will have to renew them in order to get the new, improved 2048-bit keys

To retrieve the current MSMQ service settings use the Get-MsmqQueueManager cmdlet. To apply the service settings use the Set-MsmqQueueManager cmdlet.

To retrieve queue settings use the Get-MsmqQueue cmdlet. To apply the settings to a queue do one of the following:

  1. Use the Set-MsmqQueue cmdlet.

  2. Use the New-MsmqQueue cmdlet to create a new queue with the obtained settings.