< Back
Install-CCertificate
Post
NAME Install-CCertificate
SYNOPSIS
Installs a certificate in a given store.
SYNTAX
Install-CCertificate [-Path] <String> -StoreLocation {CurrentUser | LocalMachine} -StoreName {AddressBook |
AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher} [-Exportable]
[-Password <Object>] [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Path] <String> -StoreLocation {CurrentUser | LocalMachine} -CustomStoreName <String>
[-Exportable] [-Password <Object>] [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Certificate] <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine}
-CustomStoreName <String> [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Certificate] <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine} -StoreName
{AddressBook | AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher}
[-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Uses the .NET certificates API to add a certificate to a store for the machine or current user. The user
performing the action must have permission to modify the store or the installation will fail.
To install a certificate on a remote computer, create a remoting session with the `New-PSSession` cmdlet, and pass
the session object to this function's `Session` parameter. When installing to a remote computer, the certificate's
binary data is converted to a base-64 encoded string and sent to the remote computer, where it is converted back
into a certificate. If installing a certificate from a file, the file's bytes are converted to base-64, sent to
the remote computer, saved as a temporary file, installed, and the temporary file is removed.
The ability to install a certificate on a remote computer was added in Carbon 2.1.0.
PARAMETERS
-Path <String>
The path to the certificate file.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Certificate <X509Certificate2>
The certificate to install.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StoreLocation
The location of the certificate's store. To see a list of acceptable values, run:
> [Enum]::GetValues([Security.Cryptography.X509Certificates.StoreLocation])
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StoreName
The name of the certificate's store. To see a list of acceptable values run:
> [Enum]::GetValues([Security.Cryptography.X509Certificates.StoreName])
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CustomStoreName <String>
The name of the non-standard, custom store where the certificate should be installed.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Exportable [<SwitchParameter>]
Mark the private key as exportable. Only valid if loading the certificate from a file.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Password <Object>
The password for the certificate. Should be a `System.Security.SecureString`.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Session <PSSession[]>
Use the `Session` parameter to install a certificate on remote computer(s) using PowerShell remoting. Use
`New-PSSession` to create a session.
This parameter was added in Carbon 2.1.0.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
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
System.Security.Cryptography.X509Certificates.X509Certificate2. An X509Certificate2 object representing the newly
installed certificate.
-------------------------- EXAMPLE 1 --------------------------
>Install-CCertificate -Path C:\\Users\\me\\certificate.cer -StoreLocation LocalMachine -StoreName My -Exportable
-Password My5up3r53cur3P@55w0rd
Installs the certificate (which is protected by a password) at C:\\Users\\me\\certificate.cer into the local
machine's Personal store. The certificate is marked exportable.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Install-CCertificate -Path C:\\Users\\me\\certificate.cer -StoreLocation LocalMachine -StoreName My
-ComputerName remote1,remote2
Demonstrates how to install a certificate from a file on the local computer into the local machine's personal
store on two remote cmoputers, remote1 and remote2. Use the `Credential` parameter to connect as a specific
principal.
RELATED LINKS
SYNOPSIS
Installs a certificate in a given store.
SYNTAX
Install-CCertificate [-Path] <String> -StoreLocation {CurrentUser | LocalMachine} -StoreName {AddressBook |
AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher} [-Exportable]
[-Password <Object>] [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Path] <String> -StoreLocation {CurrentUser | LocalMachine} -CustomStoreName <String>
[-Exportable] [-Password <Object>] [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Certificate] <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine}
-CustomStoreName <String> [-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Install-CCertificate [-Certificate] <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine} -StoreName
{AddressBook | AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher}
[-Session <PSSession[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Uses the .NET certificates API to add a certificate to a store for the machine or current user. The user
performing the action must have permission to modify the store or the installation will fail.
To install a certificate on a remote computer, create a remoting session with the `New-PSSession` cmdlet, and pass
the session object to this function's `Session` parameter. When installing to a remote computer, the certificate's
binary data is converted to a base-64 encoded string and sent to the remote computer, where it is converted back
into a certificate. If installing a certificate from a file, the file's bytes are converted to base-64, sent to
the remote computer, saved as a temporary file, installed, and the temporary file is removed.
The ability to install a certificate on a remote computer was added in Carbon 2.1.0.
PARAMETERS
-Path <String>
The path to the certificate file.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Certificate <X509Certificate2>
The certificate to install.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StoreLocation
The location of the certificate's store. To see a list of acceptable values, run:
> [Enum]::GetValues([Security.Cryptography.X509Certificates.StoreLocation])
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StoreName
The name of the certificate's store. To see a list of acceptable values run:
> [Enum]::GetValues([Security.Cryptography.X509Certificates.StoreName])
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CustomStoreName <String>
The name of the non-standard, custom store where the certificate should be installed.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Exportable [<SwitchParameter>]
Mark the private key as exportable. Only valid if loading the certificate from a file.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Password <Object>
The password for the certificate. Should be a `System.Security.SecureString`.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Session <PSSession[]>
Use the `Session` parameter to install a certificate on remote computer(s) using PowerShell remoting. Use
`New-PSSession` to create a session.
This parameter was added in Carbon 2.1.0.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
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
System.Security.Cryptography.X509Certificates.X509Certificate2. An X509Certificate2 object representing the newly
installed certificate.
-------------------------- EXAMPLE 1 --------------------------
>Install-CCertificate -Path C:\\Users\\me\\certificate.cer -StoreLocation LocalMachine -StoreName My -Exportable
-Password My5up3r53cur3P@55w0rd
Installs the certificate (which is protected by a password) at C:\\Users\\me\\certificate.cer into the local
machine's Personal store. The certificate is marked exportable.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Install-CCertificate -Path C:\\Users\\me\\certificate.cer -StoreLocation LocalMachine -StoreName My
-ComputerName remote1,remote2
Demonstrates how to install a certificate from a file on the local computer into the local machine's personal
store on two remote cmoputers, remote1 and remote2. Use the `Credential` parameter to connect as a specific
principal.
RELATED LINKS