How do I script a change to the msmq storage location on Windows 2008 R2 server
Is there any way of doing this through a batch or powershell script? I'm looking for a way to set up several new servers.
The only thing I found on the subject leads me to believe you cannot: from :http://technet.microsoft.com/en-us/library/cc785060.aspx
The message store location must only be modified using the Storage tab, in Computer Management, Services and Applications, Message Queuing properties.
Edit - I also found this article. It lists some registry values, but again advises against it http://blogs.msdn.com/b/johnbreakwell/archive/2009/02/09/changing-the-msmq-storage-location.aspx
Source: http://www.erbrech.com/blog/2016/05/29/Move-msmq-storage-location-with-powershell-and-Desired-State-Configuration.html
$Location = 'E:\msmq\storage'
If(!(test-path $Location))
{
New-Item -ItemType Directory -Force -Path $Location
}
takeown /F $Location /R /D y #this should give me ownership of both msmq and LQS folder
icacls $Location /reset /T /C
icacls $Location "/grant:r" "NT AUTHORITY\NetworkService:(OI)(CI)(M)" /T /C
$ConfirmPreference = 'None'
Set-MsmqQueueManager -MsgStore $Location -TransactionLogStore $Location -MsgLogStore $Location
Start-Service MSMQ