forked from mrahhal/MR.AspNetCore.Jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigureMSDTC.ps1
40 lines (34 loc) · 1.53 KB
/
ConfigureMSDTC.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ————————————
# Enable MSDTC
# ————————————
Write-Host "Enabling MSDTC..." -ForegroundColor Yellow
$DTCSecurity = "Incoming"
$RegPath = "HKLM:\SOFTWARE\Microsoft\MSDTC\"
#Set Security and MSDTC path
$RegSecurityPath = "$RegPath\Security"
Set-ItemProperty –path $RegSecurityPath –name "NetworkDtcAccess" –value 1
Set-ItemProperty –path $RegSecurityPath –name "NetworkDtcAccessClients" –value 1
Set-ItemProperty –path $RegSecurityPath –name "NetworkDtcAccessTransactions" –value 1
Set-ItemProperty –path $RegSecurityPath –name "NetworkDtcAccessInbound" –value 1
Set-ItemProperty –path $RegSecurityPath –name "NetworkDtcAccessOutbound" –value 1
Set-ItemProperty –path $RegSecurityPath –name "LuTransactions" –value 1
if ($DTCSecurity –eq "None")
{
Set-ItemProperty –path $RegPath –name "TurnOffRpcSecurity" –value 1
Set-ItemProperty –path $RegPath –name "AllowOnlySecureRpcCalls" –value 0
Set-ItemProperty –path $RegPath –name "FallbackToUnsecureRPCIfNecessary" –value 0
}
elseif ($DTCSecurity –eq "Incoming")
{
Set-ItemProperty –path $RegPath –name "TurnOffRpcSecurity" –value 0
Set-ItemProperty –path $RegPath –name "AllowOnlySecureRpcCalls" –value 0
Set-ItemProperty –path $RegPath –name "FallbackToUnsecureRPCIfNecessary" –value 1
}
else
{
Set-ItemProperty –path $RegPath –name "TurnOffRpcSecurity" –value 0
Set-ItemProperty –path $RegPath –name "AllowOnlySecureRpcCalls" –value 1
Set-ItemProperty –path $RegPath –name "FallbackToUnsecureRPCIfNecessary" –value 0
}
Restart-Service MSDTC
Write-Host "——MSDTC has been configured—–" –foregroundcolor green