Import-PfxCertificate
Import-PfxCertificate
Imports certificates and private keys from a Personal Information Exchange (PFX) file to the destination store.
構文
Parameter Set: Default
Import-PfxCertificate [-FilePath] <String> [[-CertStoreLocation] <String> ] [-Exportable] [-Password <SecureString> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
詳細説明
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 PowerShell® remoting and changing user configuration.
パラメーター
-CertStoreLocation<String>
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.
Aliases |
none |
必須/オプション |
false |
位置 |
2 |
既定値 |
none |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-Exportable
Specifies whether the imported private key can be exported. If this parameter is not specified, then the private key cannot be exported.
Aliases |
none |
必須/オプション |
false |
位置 |
named |
既定値 |
none |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-FilePath<String>
Specifies the path for the PFX file.
Aliases |
FullName |
必須/オプション |
true |
位置 |
1 |
既定値 |
none |
パイプライン入力の受け入れ |
true (ByPropertyName) |
ワイルドカード文字の受け入れ |
false |
-Password<SecureString>
Specifies the password for the imported PFX file in the form of a secure string.
Aliases |
none |
必須/オプション |
false |
位置 |
named |
既定値 |
none |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-Confirm
コマンドレットを実行する前に確認メッセージを表示します。
必須/オプション |
false |
位置 |
named |
既定値 |
false |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-WhatIf
コマンドレットが実行された場合に何が起きるのかを示します。コマンドレットは実行されません。
必須/オプション |
false |
位置 |
named |
既定値 |
false |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
<CommonParameters>
このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
System.String
A String containing the path to the PFX file.
出力
出力型は、コマンドレットが出力するオブジェクトの型です。
System.Security.Cryptography.X509Certificates.X509Certificate2
The imported X509Certificate2 object contained in the PFX file that is associated with private keys.
使用例
EXAMPLE 1
This example imports the PFX file my.pfx with a private non-exportable key into the My store for the machine account.
PS C:\> $mypwd = ConvertTo-SecureString -String "1234" -Force –AsPlainText
PS C:\> Import-PfxCertificate –FilePath C:\mypfx.pfx cert:\localMachine\my -Password $mypwd
EXAMPLE 2
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.
PS C:\> Get-ChildItem -Path c:\mypfx\my.pfx | Import-PfxCertificate -CertStoreLocation Cert:\CurrentUser\My –Exportable
EXAMPLE 3
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 Server® 2012 domain controller.
PS C:\> Set-Location -Path cert:\localMachine\my
PS C:\> Import-PfxCertificate –FilePath c:\mypfx.pfx