## PowerCLI Reference

# Disconnect-HVServer

## Synopsis

This cmdlet closes the connection to one or more Horizon API services that run on one or more instances of Horizon Connection servers.

Syntax

Disconnect-HVServer [[-Server] [<ViewServer[]>]] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Connect-HVServer

Detailed Description

This cmdlet disconnects the connection to a Horizon API service that runs on an instance of the Horizon Connection server specified by the -Server parameter.
When there are no active connections to the server, the server is disconnected and removed from the $DefaultHVServers variable. For more information about this variable, see Connect-HVServer.
When no server and no user parameter is specified, and if there is only one connected server in the $DefaultHVServers variable, this server is disconnected. If there is no connected server or multiple servers, the cmdlet throws a terminating error.
This functionality uses the reference counting mechanism. A disconnect decreases the RefCount for that server. For more information about the mechanism, see Connect-HVServer.
If -Force is specified, the server is disconnected even if there is more than one connection to it.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Server | ViewServer[] | Specifies the Horizon API service that runs on an instance of a Horizon Connection server that you want to disconnect from. | false | true
Confirm | SwitchParameter | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. | false | false
Force |  | Specifies that you want to remove all existing connections to the specified servers. | false | false
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false

Return Type

None

Notes

Examples

-------------- Example 1 --------------

    $HVServer = Connect-HVServer -Server server; Disconnect-HVServer -server $HVServer

Disconnects the connection to the specified Horizon API service that runs on an instance of a Horizon Connection server.

-------------- Example 2 --------------

    $HVServer = Connect-HVServer -Server server; Disconnect-HVServer -Force *

Disconnects all connected Horizon API services that run on instances of Horizon Connection servers.

Copyright © VMware, Inc. All rights reserved.