Uninstall-HgsServer 
	Removes a local node from a Host Guardian Service and from the domain.
Syntax
Default (Default)
Uninstall-HgsServer
    [-LocalAdministratorPassword] <SecureString>
    [-HgsDomainCredential <PSCredential>]
    [-Force]
    [-Restart]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Description
The Uninstall-HgsServer cmdlet removes a local node from a Host Guardian Service (HGS).
This cmdlet makes the following configuration changes in order to remove the HGS configuration from the additional HGS node:
- Unregisters the Attestation Service web application with the IIS service.
- Unregisters the Key Protection Service web application with the IIS service.
- Disables Just Enough Administration on the local node.
- Removes the local node from the existing failover cluster.
- Removes the local node from being a domain controller.
This cmdlet makes the following configuration changes in order to remove the HGS configuration from the last HGS node:
- Unregisters the Attestation Service web application with the IIS service.
- Unregisters the Key Protection Service web application with the IIS service.
- Removes the distributed network name (DNN) resource corresponding to the HGS name.
- Disables Just Enough Administration on the local node.
- Destroys the cluster on the local node.
- Removes the local node from being a domain controller and removes the HGS domain.
For more information about the scenario terms, see Security and Assurance.
Examples
Example 1: Remove the node from HGS
PS C:\> $Cred = Get-Credential
PS C:\> Uninstall-HgsServer -HgsDomainCredential $cred -LocalAdministratorPassword $secureString
This example removes the node from an existing HGS setup. If the second command removes the final node, then it also destroys the cluster.
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 | 
-HgsDomainCredential  
		Specifies the Active Directory domain administrator credentials for the primary HGS server.
Parameter properties
| Type: | PSCredential | 
| 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 | 
-LocalAdministratorPassword  
		Specifies the password for the local administrator account when the computer is no longer a domain controller.
Parameter properties
| Type: | SecureString | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | 1 | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-Restart
Indicates that a reboot is initiated automatically after running this command.
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 | 
-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.