Skip to content

Instantly share code, notes, and snippets.

@serbrech
Created May 29, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serbrech/164eeaea3635bfccdcd4d95ec0cbd433 to your computer and use it in GitHub Desktop.
Save serbrech/164eeaea3635bfccdcd4d95ec0cbd433 to your computer and use it in GitHub Desktop.
Script MsmqStoragePath
{
DependsOn = '[File]MSMQDirectories'
GetScript = {
$manager = Get-MsmqQueueManager
return @{
Result = $manager
GetScript = $GetScript
TestScript = $TestScript
SetScript = $SetScript
}
}
TestScript = {
$manager = Get-MsmqQueueManager
$expectedStoreLocation = 'E:\msmq'
$shouldRun = ($manager.MessageStoreLocation -eq $expectedStoreLocation)`
-and ($manager.MessageLogStoreLocation -eq $expectedStoreLocation)`
-and ($manager.TransactionLogStoreLocation -eq $expectedStoreLocation)
return $shouldRun
}
SetScript = {
takeown /F 'E:\msmq' /R /D y #this should give me ownership of both msmq and LQS folder
icacls 'E:\msmq' /reset /T /C
icacls 'E:\msmq' "/grant:r" "NT AUTHORITY\NetworkService:(OI)(CI)(M)" /T /C
$ConfirmPreference = 'None' # Make sure you don't get a prompt, even when testing
Set-MsmqQueueManager -MsgStore 'E:\msmq' -MsgLogStore 'E:\msmq' -TransactionLogStore 'E:\msmq' -MessageQuota 10097152 #10gb
# Make sure the service is up.
Start-Service msmq
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment