Edit

Share via


Import-HgsKeyProtectionState

Imports previously exported Key Protection Service configuration and certificates.

Syntax

File

Import-HgsKeyProtectionState
    [[-Path] <String>]
    -Password <SecureString>
    [-Force]
    [-IgnoreImportFailures]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

XML

Import-HgsKeyProtectionState
    [[-Xml] <XmlDocument>]
    -Password <SecureString>
    [-Force]
    [-IgnoreImportFailures]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Import-HgsKeyProtectionState cmdlet imports previously exported configuration of Key Protection Service from a file referenced by the path parameter. If the path parameter is not provided, the configuration state can be passed in as an XmlDocument to the Xml parameter. If the configuration contains certificates that were added to the service with pfx (containing private key), then the cmdlet also imports those certificates. If the configuration contains certificates that were previously added to Key Protection Certificate as pfx, then the password supplied must match the password that was provided at the time of exporting the configuration.

Examples

Example 1: Import Key Protection Service state from a file

PS C:\> Import-HgsKeyProtectionState -Path "C:\example\kps.config" -Password $Password

This command imports configuration state to a Key Protection Service from the file referenced by the path parameter. If the file contains private keys for certificates, then the password must be supplied by a secure string referenced by the $Password variable.

Example 2: Import Key Protection Service state from an XML document

PS C:\> Import-HgsKeyProtectionState -Xml $XmlDoc -Password $Password

This command imports configuration state to a Key Protection Service from an XML document referenced by the XML parameter. If the file contains private keys for certificates, then the password must be supplied by a secure string referenced by the $Password variable.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IgnoreImportFailures

Indicates that this cmdlet ignores import failures.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Password

The Import-HgsKeyProtectionState cmdlet imports previously exported configuration of Key Protection Service from a file referenced by the path parameter. If the path parameter is not provided, the configuration state can be passed in as an XmlDocument to the Xml parameter. If the configuration contains certificates that were added to the service with pfx (containing private key), then the cmdlet also imports those certificates. If the configuration contains certificates that were previously added to Key Protection Certificate as pfx, then the password supplied must match the password that was provided at the time of exporting the configuration.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

The Import-HgsKeyProtectionState cmdlet imports previously exported configuration of Key Protection Service from a file referenced by the path parameter. If the path parameter is not provided, the configuration state can be passed in as an XmlDocument to the Xml parameter. If the configuration contains certificates that were added to the service with pfx (containing private key), then the cmdlet also imports those certificates. If the configuration contains certificates that were previously added to Key Protection Certificate as pfx, then the password supplied must match the password that was provided at the time of exporting the configuration.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

File
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Xml

The Import-HgsKeyProtectionState cmdlet imports previously exported configuration of Key Protection Service from a file referenced by the path parameter. If the path parameter is not provided, the configuration state can be passed in as an XmlDocument to the Xml parameter. If the configuration contains certificates that were added to the service with pfx (containing private key), then the cmdlet also imports those certificates. If the configuration contains certificates that were previously added to Key Protection Certificate as pfx, then the password supplied must match the password that was provided at the time of exporting the configuration.

Parameter properties

Type:XmlDocument
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

XML
Position:0
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

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

Inputs

None

You cannot pipe input to this cmdlet.

Outputs

None

This cmdlet does not generate any output.