Thor Logo dbatools

Get-DbaCmConnection

View Source
Friedrich Weinmann (@FredWeinmann)
Windows, Linux, macOS

Synopsis

Retrieves cached Windows Management and CIM connections used by dbatools commands

Description

Shows which remote computer connections are currently cached by dbatools for Windows Management and CIM operations. This helps you understand what authentication contexts are active and troubleshoot connection issues when running dbatools commands against remote SQL Server instances. Cached connections are automatically created when you run dbatools commands that need to access Windows services, registry, or file system on remote servers.

Syntax

Get-DbaCmConnection
    [[-ComputerName] <String[]>]
    [[-UserName] <String>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaCmConnection

List all cached connections.

Example: 2
PS C:\> Get-DbaCmConnection sql2014

List the cached connection - if any - to the server sql2014.

Example: 3
PS C:\> Get-DbaCmConnection -UserName "*charles*"

List all cached connection that use a username containing “charles” as default or override credentials.

Optional Parameters

-ComputerName

Filters cached connections by computer name or server name. Supports wildcards for pattern matching.
Use this to check connections to specific SQL Server hosts or to search for connections matching a pattern like “sqlprod”.

PropertyValue
AliasFilter
RequiredFalse
Pipelinetrue (ByValue)
Default Value*
-UserName

Filters cached connections by the username in the stored credentials. Supports wildcards for pattern matching.
Use this to find connections using specific service accounts or domain credentials. Will not match connections using integrated Windows authentication.

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