Import-HgsKeyProtectionState

Imports previously exported Key Protection Service configuration and certificates.

Syntax

Import-HgsKeyProtectionState
      -Password <SecureString>
      [-Force]
      [-IgnoreImportFailures]
      [[-Path] <String>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Import-HgsKeyProtectionState
      -Password <SecureString>
      [-Force]
      [-IgnoreImportFailures]
      [[-Xml] <XmlDocument>]
      [-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.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

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

-IgnoreImportFailures

Indicates that this cmdlet ignores import failures.

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

-Password

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

-Path

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Xml

Type:XmlDocument
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

None

You cannot pipe input to this cmdlet.

Outputs

None

This cmdlet does not generate any output.