Search code examples
powershellmsmq

Remove MSMQ storage limits with powershell


How do I remove storage limits (queue quota) on specific queues with powershell?

To set storage limits to some value with powershell, we can use the Set-MsmqQueue cmdlet:

Get-MsmqQueue myQueue | Set-MsmqQueue -QueueQuota  50000

To remove the setting I have tried

... | Set-MsmqQueue -QueueQuota $false # (does nothing)
... | Set-MsmqQueue -QueueQuota 0 # (does nothing)
... | Set-MsmqQueue -QueueQuota -1 # (fails; queue quota must be positive integer)
... | Set-MsmqQueue -QueueQuota ([System.Int32]::MaxValue) # (successfully sets quota to 2147483647)
... | Set-MsmqQueue -QueueQuota ([System.Int64]::MaxValue) # (fails; Invalid value 9223372036854775807 for property MaximumQueueSize.)

The powershell documentation does not specify how to accomplish this. Does anyone know how to do this?


Solution

  • Basically you want to set the queue to "unlimited".

    My understanding is that the maximum size is 4294967295 (4 TB). Try setting it to that.