Configure MSDTC using PowerShell

As of blackpearl v4.6.7, MSDTC is a requirement to deploy workflows.

You can use the following script to automate the MSDTC configuration during VM provisioning.

Note: Execution policy might have to be changed to run this script. (Set-ExecutionPolicy RemoteSigned –Force)

# ———————————
# Enable MSDTC for Network Access
# ———————————
Write-Host “Enabling MSDTC for Network Access…” foregroundcolor yellow
$System_OS=(Get-WmiObject class Win32_OperatingSystem).Caption
If ($System_OS match “2012 R2”)
    Set-DtcNetworkSetting DtcName Local AuthenticationLevel Incoming InboundTransactionsEnabled OutboundTransactionsEnabled RemoteClientAccessEnabled confirm:$false
    .\ConfigureMSDTC.ps1 Out-Null
    Restart-Service MSDTC
Write-Host “——MSDTC has been configured—–” foregroundcolor green

The above script uses the inbuilt cmdlet if your OS is Windows Server 2012 R2, else it will use the traditional approach of modifying the registry.

# Save the following script as a separate file: ConfigureMSDTC.ps1
$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
                    Set-ItemProperty path $RegPath name “TurnOffRpcSecurity” value 0
                    Set-ItemProperty path $RegPath name “AllowOnlySecureRpcCalls” value 1
                    Set-ItemProperty path $RegPath name “FallbackToUnsecureRPCIfNecessary” value 0


One thought on “Configure MSDTC using PowerShell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s