     OSQueryFailed = "Failed to query operating system of {0}."
        VersionNotSupported = "Testing DTC on Windows versions below {0} is not supported with this cmdlet."
        FailedToCreateCimSession = "Failed to create a CIM Session to {0}."
        NotARemoteComputer = "{0} is not a remote computer."
        PingingSucceeded = "Pinging computer {0} from {1} succeeded. "
        PingingFailed = "Pinging computer {0} from {1} failed."
        SameCids = "The {0} CID on {1} and {2} is the same. The CID should be unique to each computer."
        DiagnosticTestPrompt = "This diagnostic test will attempt to carry out a transaction propagation between {0} and {1}. It requires that a TCP port is opened on {0} so that a Test Resource Manager can participate in network transactions."
        DefaultPortDescription = "The default port is {0} and you can change it using the 'ResourceManagerPort' parameter and rerunning the test. "
        PortDescription = "You have specified {0} as the 'ResourceManagerPort'."
        FirewallRequest = "Please open port {0} in the firewall to proceed with the test."
        QueryText = "Do you want to proceed with the test?"
        InvalidDefaultCluster = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcClusterDefault' cmdlet configure the default DTC on this computer."
        InvalidDefault = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcDefault' cmdlet to configure the default DTC on this computer."
        NeedDtcSecurityFix = "DTC security settings and firewall settings should be fixed in order to complete the transactions propagation test."
        StartResourceManagerFailed = "Test resource manager creation failed."
        ResourceManagerStarted = "Test resource manager started."
        PSSessionCreated = "A new PSSession to {0} created."
        TransactionPropagated = "Transaction propagated from {0} to {1} using {2} propagation."
        TransactionPropagationFailed = "Transaction propagation {0} to {1} failed using {2} propagation."
        TestRMVerboseLog = "Test Resource Manager Verbose Log:"
        TestRMWarningLog = "Test Resource Manager Warning Log:"
        InvalidParameters = "At least one of LocalComputerName or RemoteComputerName parameters should be specified."
    }
}


function IsLocalComputer
{
    param(
        $computerName = $null
        )
    PROCESS 
    {
        $found = $false
        $dtcs = Get-Dtc
        if ($dtcs -eq $null)
        {
            throw
        }
        else
        {
            if ($dtcs.GetType().IsArray)
            {
                foreach ($dtc in $dtcs)
                {
                    if ([string]::Compare($dtc.VirtualServerName, $computerName, $true) -eq 0)
                    {
                        $found = $true
                        break 
                    }
                }
            }
            else
            {
                if ([string]::Compare($dtcs.VirtualServerName, $computerName, $true) -eq 0)
                {
                    $found = $true
                }
            }
        }
        return $found
    }
}

function CheckFirewallRule
{
    param(
        $computerName = $null,
        $ruleId = $null,
        $ruleDesription = $null
    )
    PROCESS 
    {
        $success = $false
        $errorVariable = $null
        if ($computerName -eq $null)
        {
            $rule = Get-NetFirewallRule -ID $ruleId  -ErrorVariable errorVariable    
        }
        else
        {
            $rule = Get-NetFirewallRule -ID $ruleId -CimSession  $computerName  -ErrorVariable errorVariable    
        }

        if ($rule -eq $null)
        {
            if ($errorVariable -ne $null)
            {
                throw $errorVariable
            }
            else
            {
                throw ([string]::Format($Strings.CmdletFailed, "Get-NetFirewallRule", "networksecurity"))
            }
    
        }
        else
        {
            if ($rule.Enabled -eq 1)
            {
                Write-Verbose ([string]::Format($Strings.FirewallRuleEnabled, $computerName, $ruleDesription))
                $success = $true
            }
            else
            {
                Write-Warning ([string]::Format($Strings.FirewallRuleDisabled, $computerName, $ruleDesription))
            }
        }
        return $success
    }    
}

function CheckFirewallRules
{ 
    param(
        $ComputerName = $null
        )   
    $rpcEPRuleId = "MSDTC-RPCSS-In-TCP"
    $dtcOutRule = "MSDTC-Out-TCP"
    $dtcInRule = "MSDTC-In-TCP"
   
    $rpcOutcss = CheckFirewallRule $ComputerName $rpcEPRuleId $Strings.RPCEndpointMapper
    $dtcIn = CheckFirewallRule $ComputerName $dtcInRule $Strings.DtcIncomingConnection
    $dtcOut = CheckFirewallRule $ComputerName $dtcOutRule $Strings.DtcOutgoingConnection

    return ($rpcOutcss -and $dtcOutRule -and $dtcInRule)
}

function FindDtc
{
    param(
        $ComputerName = $null,
        $CimSession = $null
        )   
        
    $matchedDtc = $null
    $errorVariable = $null
    if ($cimsession -eq $null)
    {
        $dtcs = Get-Dtc -ErrorVariable $errorVariable
    }
    else
    {
        $dtcs = Get-Dtc -CimSession $CimSession -ErrorVariable errorVariable
    }

    if ($dtcs -eq $null)
    {
        if ($errorVariable -ne $null)
        {
            throw $errorVariable
        }
        else
        {
            throw ([string]::Format($Strings.CmdletFailed, "Get-Dtc", "MSDTC"))
        }
    }
    else
    {
        if ($dtcs.GetType().IsArray -eq $true)
        {
            foreach ($dtc in $dtcs)
            {
                if ($dtc.VirtualServerName -eq $computerName)
                {
                    $matchedDtc = $dtc
                    break
                }
            }
        }
        else
        {
            $matchedDtc = $dtcs
        }
    }

    if ($matchedDtc -eq $null)
    {
        throw ([string]::Format($Strings.MatchingDtcNotFound, $computerName))
    }

    return $matchedDtc
}

function CheckDtcSecurity
{ 
    param(
        $DtcNetworkSetting = $null,
        $ComputerName = $nul
        )   
    PROCESS 
    {
        Write-Verbose ([string]::Format("{0}: AuthenticationLevel: {1}", $ComputerName, $DtcNetworkSetting.AuthenticationLevel))
        Write-Verbose ([string]::Format("{0}: InboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.InboundTransactionsEnabled))
        if ($DtcNetworkSetting.InboundTransactionsEnabled -eq $false)
        {
            Write-Warning ([string]::Format($Strings.InboundDisabled, $ComputerName))
        }

        Write-Verbose ([string]::Format("{0}: OutboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.OutboundTransactionsEnabled))
        if ($DtcNetworkSetting.OutboundTransactionsEnabled -eq $false)
        {
            Write-Warning ([string]::