< Back

Test-DbaCmConnection

Mon Jan 13, 2020 6:01 pm

NAME Test-DbaCmConnection



SYNOPSIS

Tests over which paths a computer can be managed.





SYNTAX

Test-DbaCmConnection [[-ComputerName] <Sqlcollaborative.Dbatools.Parameter.DbaCmConnectionParameter[]>]

[[-Credential] <Pscredential>] [[-Type] <Sqlcollaborative.Dbatools.Connection.ManagementConnectionType[]>] [-Force

<Switch>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Tests over which paths a computer can be managed.



This function tries out the connectivity for:



- Cim over WinRM



- Cim over DCOM



- Wmi



- PowerShellRemoting



Results will be written to the connectivity cache and will cause Get-DbaCmObject and Invoke-DbaCmMethod to connect

using the way most likely to succeed. This way, it is likely the other commands will take less time to execute.

These others too cache their results, in order to dynamically update connection statistics.



This function ignores global configuration settings limiting which protocols may be used.





PARAMETERS

-ComputerName [<Sqlcollaborative.Dbatools.Parameter.DbaCmConnectionParameter[]>]

The computer to test against.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Credential [<Pscredential>]

The credentials to use when running the test. Bad credentials are automatically cached as non-working. This

behavior can be disabled by the 'Cache.Management.Disable.BadCredentialList' configuration.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Force [<Switch>]

If this switch is enabled, the Alert will be dropped and recreated on Destination.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Type [<Sqlcollaborative.Dbatools.Connection.ManagementConnectionType[]>]

The connection protocol types to test.

By default, all types are tested.



Note that this function will ignore global configurations limiting the types of connections available and test

all connections specified here instead.



Available connection protocol types: "CimRM", "CimDCOM", "Wmi", "PowerShellRemoting"



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: ComputerManagement, CIM

Author: Friedrich Weinmann (@FredWeinmann)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



**This function should not be called from within dbatools. It is meant as a tool for users only.**



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-DbaCmConnection -ComputerName sql2014



Performs a full-spectrum connection test against the computer sql2014. The results will be reported and

registered. Future calls from Get-DbaCmObject will recognize the results and optimize the query.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-DbaCmConnection -ComputerName sql2014 -Credential $null -Type CimDCOM, CimRM



This test will run a connectivity test of CIM over DCOM and CIM over WinRM against the computer sql2014 using

Windows Authentication.



The results will be reported and registered. Future calls from Get-DbaCmObject will recognize the results and

optimize the query.



RELATED LINKS

https://dbatools.io/Test-DbaCmConnection