commands

^

Add-DbaComputerCertificate

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows only

 

Synopsis

Adds a computer certificate - useful for older systems.

Description

Adds a computer certificate from a local or remote computer.

Syntax

Add-DbaComputerCertificate
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [[-SecurePassword] <SecureString>]
    [[-Certificate] <X509Certificate2[]>]
    [[-Path] <String>]
    [[-Store] <String>]
    [[-Folder] <String>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Add-DbaComputerCertificate -ComputerName Server1 -Path C:\temp\cert.cer

Adds the local C:\temp\cert.cer to the remote server Server1 in LocalMachine\My (Personal).

Example: 2
PS C:\> Add-DbaComputerCertificate -Path C:\temp\cert.cer

Adds the local C:\temp\cert.cer to the local computer's LocalMachine\My (Personal) certificate store.

Optional Parameters

-ComputerName

The target SQL Server instance or instances. Defaults to localhost.

Alias
Required False
Pipeline false
Default Value $env:COMPUTERNAME
-Credential

Allows you to login to $ComputerName using alternative credentials.

Alias
Required False
Pipeline false
Default Value
-SecurePassword

The password for the certificate, if it is password protected.

Alias Password
Required False
Pipeline false
Default Value
-Certificate

The target certificate object.

Alias
Required False
Pipeline true (ByValue)
Default Value
-Path

The local path to the target certificate object.

Alias
Required False
Pipeline false
Default Value
-Store

Certificate store. Default is LocalMachine.

Alias
Required False
Pipeline false
Default Value LocalMachine
-Folder

Certificate folder. Default is My (Personal).

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

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
-Confirm

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

 

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