Thor Logo dbatools

Get-DbaMsdtc

View Source
Klaas Vandenberghe (@powerdbaklaas)
Windows, Linux, macOS

Synopsis

Retrieves Microsoft Distributed Transaction Coordinator (MSDTC) service status and configuration details

Description

Returns comprehensive MSDTC information including service state, security settings, and component identifiers (CIDs) from target servers. MSDTC is essential for SQL Server distributed transactions, linked server operations, and cross-database transactions that span multiple servers or instances.

This function helps DBAs troubleshoot distributed transaction failures, verify MSDTC configuration for linked servers, and audit security settings across multiple servers. It queries both the Windows service status and registry settings to provide a complete picture of the MSDTC configuration.

Requires: Windows administrator access on target servers

Syntax

Get-DbaMsdtc
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaMsdtc -ComputerName srv0042

Get DTC status for the server srv0042

Example: 2
PS C:\> $Computers = (Get-Content D:\configfiles\SQL\MySQLInstances.txt | % {$_.split('\')[0]})
PS C:\> $Computers | Get-DbaMsdtc

Get DTC status for all the computers in a .txt file

Example: 3
PS C:\> Get-DbaMsdtc -Computername $Computers | Where-Object { $_.dtcservicestate -ne 'running' }

Get DTC status for all the computers where the MSDTC Service is not running

Example: 4
PS C:\> Get-DbaMsdtc -ComputerName srv0042 | Out-Gridview

Get DTC status for the computer srv0042 and show in a grid view

Optional Parameters

-ComputerName

Specifies the server or computer names where MSDTC information should be retrieved. Accepts multiple values and supports pipeline input.
Use this when checking MSDTC configuration across multiple SQL Server hosts, especially when troubleshooting distributed transactions or linked server issues.

PropertyValue
Aliascn,host,Server
RequiredFalse
Pipelinetrue (ByValue)
Default Value$env:COMPUTERNAME
-Credential

Alternative credential

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse