Fonte: link
$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