Created
May 29, 2016 15:16
-
-
Save serbrech/164eeaea3635bfccdcd4d95ec0cbd433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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