NAME
Import-PfxCertificate
SYNOPSIS
Imports certificates and private keys from a Personal Information Exchange (PFX) file to the destination store.SYNTAX
Import-PfxCertificate [-FilePath]
[[-CertStoreLocation] ] [-Exportable] [-Password
] [-Confirm] [-WhatIf] [ ] DESCRIPTION
The Import-PfxCertificate cmdlet imports certificates and private keys from a PFX file to the destination store.
Certificates with and without private keys in the PFX file are imported, along with any external properties that are present. Delegation may be required when using this cmdlet with Windows PowerShellr remoting and changing user configuration.PARAMETERS
-CertStoreLocation [
Specifies the path of the store to which certificates will be imported. If this parameter is not specified, then the current path is used as the destination store. Required? false Position? 2 Default value none Accept pipeline input? false Accept wildcard characters? false] -Exportable [
Specifies whether the imported private key can be exported. If this parameter is not specified, then the private key cannot be exported. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -FilePath
Specifies the path for the PFX file. Required? true Position? 1 Default value noneAccept pipeline input? true (ByPropertyName)
Accept wildcard characters? false-Password [
Specifies the password for the imported PFX file in the form of a secure string. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -Confirm [
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet. Required? false Position? named Default value false Accept pipeline input? false Accept wildcard characters? false] -WhatIf [
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run. Required? false Position? named Default value false Accept pipeline input? false Accept wildcard characters? false] 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
System.String A String containing the path to the PFX file.OUTPUTS
System.Security.Cryptography.X509Certificates.X509Certificate2 The imported X509Certificate2 object contained in the PFX file that is associated with private keys.EXAMPLE 1
PS C:\>$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
PS C:\>Import-PfxCertificate -FilePath C:\mypfx.pfx cert:\localMachine\my -Password $mypwd
This example imports the PFX file my.pfx with a private non-exportable key into the My store for the machine
account.EXAMPLE 2
PS C:\>Get-ChildItem -Path c:\mypfx\my.pfx | Import-PfxCertificate -CertStoreLocation Cert:\CurrentUser\My
-Exportable
This example imports the PFX file my.pfx with a private non-exportable key into the My store for the current user
with private key exportable. The Password parameter is not required since this PFX file is not password protected.EXAMPLE 3
PS C:\>Set-Location -Path cert:\localMachine\my
PS C:\>Import-PfxCertificate -FilePath c:\mypfx.pfx
This example imports the PFX file mypfx.pfx into the My store for the machine account. The Password parameter is not required since this PFX file is protected using the domain account of this machine. This requires a Windows Serverr 2012 domain controller.RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287534ConvertTo-SecureString
Get-ChildItem
Set-Location
Export-PfxCertificate