Export-HgsServerState  
	Exports the local Host Guardian Service instance's state to enable recovery scenarios.
Syntax
Default (Default)
Export-HgsServerState
    [[-Path] <String>]
    -Password <SecureString>
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Description
The Export-HgsServer cmdlet exports the Host Guardian Service (HGS) state to enable recovery scenarios.
The cmdlet causes the following Host Guardian Service state to be exported to the specified output file:
- Attestation Service policies
- Attestation Service configuration data
- Key Protection policies
- Key Protection configuration data
- Key Protection Signer Certificates and private keys
- Key Protection Encryption Certificates and private keys
For more information about the scenario terms, see Security and Assurance.
Examples
Example 1: Export HGS server state and protect it with a password
PS C:\> Export-HgsServerState -Path "C:\HGS\ExportState.xml" -Password $Pass
Encrypted HGS Server State stored at the specified location
This command exports the HGS server state and protects the exported state using a password. The exported state is stored at the file specified by the Path parameter.
Use the ConvertTo-SecureString cmdlet to generate a secure string that represents the password.
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 | 
-Password
Specifies the password with which to encrypt the keys.
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
Specifies the path for the exported file.
Parameter properties
| Type: | String | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
| Aliases: | FilePath | 
Parameter sets
(All)
| Position: | 1 | 
| 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 | 
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.