< Back

Disconnect-VIServer

Sun Jan 19, 2020 6:48 pm

NAME Disconnect-VIServer



SYNOPSIS

This cmdlet closes the connection to a vCenter Server system.





SYNTAX

Disconnect-VIServer [[-Server] <VIServer[]>] [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

This cmdlet closes the connection to a vCenter Server system. In PowerCLI, you can have multiple connections to a

server. In order to disconnect from a server, you must close all active connections to it. By default,

Disconnect-VIServer closes only the last connection to the specified server. To close all active connections to a

server, use the Force parameter or run the cmdlet for each connection. When a server is disconnected, it is

removed from the default servers list. For more information about default servers, see the description of

Connect-VIServer.





PARAMETERS

-Force [<SwitchParameter>]

Indicates that you want to close all active connections to the specified server and disconnect from it. If the

value is $false, the cmdlet closes only the last connection to the specified server and you must run

Disconnect-VIServer for each active connection to this server in order to disconnect from it.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Server <VIServer[]>

Specifies the vCenter Server systems you want to disconnect from.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? 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.



Required? false

Position? named

Default value $true

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

None







NOTES









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



$Server = Connect-VIServer 10.23.112.235



Disconnect-VIServer -Server $Server



Connects to a server with an IP address 10.23.112.235 and saves the returned VIServer object in the $Server

variable. Then disconnects from the specified server.

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



Disconnect-VIServer -Server $global:DefaultVIServers -Force



Closes all connections to the default servers.

-------------------------- Example 3 --------------------------



Disconnect-VIServer -Server * -Force



Disconnects all server connections.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... erver.html

Connect-VIServer