Table of contents
TLS
TOC
Collapse the table of content
Expand the table of content

Import-Certificate

Last Updated: 3/31/2017

SYNOPSIS

Imports one or more certificates into a certificate store.

SYNTAX

Import-Certificate [-FilePath] <String> [-CertStoreLocation <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Import-Certificate cmdlet imports one or more certificates into a certificate store.

EXAMPLES

EXAMPLE 1

PS C:\>$file = ( Get-ChildItem -Path C:\files\root.cer )



PS C:\>$file | Import-Certificate -CertStoreLocation cert:\CurrentUser\Root

This example imports the certificate from the file into the root store of the current user.

EXAMPLE 2

PS C:\>Set-Location -Path cert:\CurrentUser\My



PS C:\>Import-Certificate -Filepath "C:\files\intermediate.cert"

This example imports the certificate from the file into the current store.

PARAMETERS

-CertStoreLocation

Specifies the path to the certificate store where the certificates will be imported. If the path to the certificate store is not specified, then the current store is used.

Type: String
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-FilePath

Specifies the path to a certificate file to be imported. Acceptable formats include .sst, .p7b, and .cert files. If the file contains multiple certificates, then each certificate will be imported to the destination store.

Type: String
Parameter Sets: (All)
Aliases: FullName

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

A String containing the file path.

OUTPUTS

System.Security.Cryptography.X509Certificates.X509Certificate2[]

The output is an array of X509Certificate2[] objects.

NOTES

Get-ChildItem

Set-Location

Export-Certificate

© 2017 Microsoft