Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaCmConnection on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaCmConnection.
Generates a connection object for use in remote computer management.
Generates a connection object for use in remote computer management.
Those objects are used for the purpose of cim/wmi queries, caching which protocol worked, optimizing performance and minimizing authentication errors.
New-DbaCmConnection will create a NEW object and overwrite any existing ones for the specified computer.
Furthermore, information stored in the input beyond the computername will be discarded in favor of the new settings.
Unless the connection cache has been disabled, all connections will automatically be registered in the cache, so no further action is necessary.
The output is primarily for information purposes, however it may be used to pass objects and circumvent the cache with those.
NOTE: Generally, this function need not be used, as a first connection to a computer using any connecting function such as "Get-DbaCmObject" will automatically register a new default connection for it.
This function exists to be able to preconfigure connections.
New-DbaCmConnection
[-ComputerName <DbaCmConnectionParameter[]>]
[-Credential <PSCredential>]
[-OverrideExplicitCredential]
[-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
[-DisableBadCredentialCache]
[-DisableCimPersistence]
[-DisableCredentialAutoRegister]
[-EnableCredentialFailover]
[-WindowsCredentialsAreBad]
[-CimWinRMOptions <WSManSessionOptions>]
[-CimDCOMOptions <DComSessionOptions>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-DbaCmConnection
[-ComputerName <DbaCmConnectionParameter[]>]
[-UseWindowsCredentials]
[-OverrideExplicitCredential]
[-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
[-DisableBadCredentialCache]
[-DisableCimPersistence]
[-DisableCredentialAutoRegister]
[-EnableCredentialFailover]
[-CimWinRMOptions <WSManSessionOptions>]
[-CimDCOMOptions <DComSessionOptions>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> New-DbaCmConnection -ComputerName sql2014 -UseWindowsCredentials -OverrideExplicitCredential -DisabledConnectionTypes CimRM
Returns a new configuration object for connecting to the computer sql2014.
PS C:\> Get-Content computers.txt | New-DbaCmConnection -Credential $cred -CimWinRMOptions $options -DisableBadCredentialCache -OverrideExplicitCredential
Gathers a list of computers from a text file, then creates and registers connections for each of them, setting them to ...
The computer to build the connection object for.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value | $env:COMPUTERNAME |
The credential to register.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Whether using the default windows credentials is legit.
Not setting this will not exclude using windows credentials, but only not pre-confirm them as working.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Setting this will enable the credential override.
The override will cause the system to ignore explicitly specified credentials, so long as known, good credentials are available.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Explicitly disable connection types.
These types will then not be used for connecting to the computer.
Alias | |
Required | False |
Pipeline | false |
Default Value | None |
Will prevent the caching of credentials if set to true.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Will prevent Cim-Sessions to be reused.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Will prevent working credentials from being automatically cached
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Will enable automatic failing over to known to work credentials, when using bad credentials.
By default, passing bad credentials will cause the Computer Management functions to interrupt with a warning (Or exception if in silent mode).
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Will prevent the windows credentials of the currently logged on user from being used for the remote connection.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Specify a set of options to use when connecting to the target computer using CIM over WinRM.
Use 'New-CimSessionOption' to create such an object.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specify a set of options to use when connecting to the target computer using CIM over DCOM.
Use 'New-CimSessionOption' to create such an object.
Alias | |
Required | False |
Pipeline | false |
Default Value |
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 |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |