Changing the MSMQ Storage location

Some people have the situation where they have set up MSMQ using defaults and now find that the storage disk, usually the system drive C:, has insufficient space for the message volume they are seeing. If there are a number of these machines, or maybe they are in remote locations, a scripted solution for moving the storage location to a large data drive would be desirable.

Unfortunately, it is not possible to automate this change. Right at the bottom of this TechNet article, Message storage, there is a warning:

  • The message store location must only be modified using the Storage tab, in Computer Management, Services and Applications, Message Queuing properties.

(or, if you have Windows 2008, it's under "Features" instead of "Service and Applications".)

Changing the storage locations performs several operations:

  • Checks the disk choice is valid (e.g. not a mapped drive to a network share)
  • Creates the directory structure
  • Sets permissions
  • Moves the data to the new location

Because of the range of problems that could arise to block any of these steps, it was decided to ensure that an administrator was interactively performing the operation. A scripted approach could result in a broken storage migration without anybody realising until problems with MSMQ messaging were reported.

So there is no API call you can make to cause MSMQ to change the storage location.

Also, editing the registry locations that MSMQ uses to locate its storage and then moving the files to the new location may result in a broken installation. I have included these below for reference purposes only - modifying them yourself is not supported by Microsoft.  

Registry value Description
StoreInSeqLogPath (MSMQ 2.0) Location of exactly-once-delivery checkpoint files.
StoreJournalPath Location of journal message files. Journal messages are copies of incoming or outgoing messages that a server processes.
StoreLogPath Location of the log files associated with persistent message files.
StoreMqLogPath (MSMQ 2.0) Location of the transaction log file, also known as the QM log. Message Queuing stores the current state of active transactions and incoming transacted messages in the transaction log file.
StorePersistentPath Location of persistent message files.
StoreReliablePath Location of express message files.
StoreXactLogPath Location of transaction checkpoint files.

The values are located under the HKLM\SOFTWARE\Microsoft\MSMQ\Parameters branch.

Note - It is not supported to change the locations for a clustered MSMQ resource and no UI is available to allow you to do this. If you manually edit the registry values under HKLM\SOFTWARE\Microsoft\MSMQ\Clustered QMs\MSMQ$My Resource\Parameters then the changes will be returned to the defaults on service startup.