如何对Windows 2008 R2服务器上的msmq存储位置进行脚本更改

有没有通过批处理或PowerShell脚本做到这一点? 我正在寻找一种方法来设置几个新的服务器。

我在这个主题上发现的唯一的东西让我相信你不能:从: http : //technet.microsoft.com/en-us/library/cc785060.aspx

只能使用计算机pipe理,服务和应用程序,消息队列属性中的“存储”选项卡来修改消息存储位置。

编辑 – 我也发现这篇文章。 它列出了一些registry值,但是又build议反对它http://blogs.msdn.com/b/johnbreakwell/archive/2009/02/09/changing-the-msmq-storage-location.aspx

资料来源: 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