commands

^

Test-DbaCmConnection

Author Friedrich Weinmann (@FredWeinmann)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Test-DbaCmConnection on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaCmConnection.

Synopsis

Tests over which paths a computer can be managed.

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.

Syntax

Test-DbaCmConnection
    [[-ComputerName] <DbaCmConnectionParameter[]>]
    [[-Credential] <PSCredential>]
    [[-Type] {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
    [-Force]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

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.

Optional Parameters

-ComputerName

The computer to test against.

Alias
Required False
Pipeline true (ByValue)
Default Value $env:COMPUTERNAME
-Credential

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.

Alias
Required False
Pipeline false
Default Value
-Type

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"

Alias
Required False
Pipeline false
Default Value @("CimRM", "CimDCOM", "Wmi", "PowerShellRemoting")
-Force

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

Alias
Required False
Pipeline false
Default Value False
-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.

Alias
Required False
Pipeline false
Default Value False