powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Disconnect-VIServer



NAME
Disconnect-VIServer

SYNOPSIS
Disconnects from a vSphere server.

SYNTAX
Disconnect-VIServer [[-Server] ] [-Force] [-WhatIf] [-Confirm] []


DESCRIPTION
Disconnects from a vSphere server. In PowerCLI, you can have multiple connections to a server. In order to disconne
ct 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 t
he 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
-Server
Specify the vSphere servers you want to disconnect from.

Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Force
Indicate that you want to close all active connections to the specified server and disconnect from it. If the v
alue 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
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf
Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modi
fied.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Confirm
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


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
None


NOTES




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

C:\PS>$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 variabl
e. Then disconnects from the specified server.





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

C:\PS>Disconnect-VIServer -Server $global:DefaultVIServers -Force


Closes all connections to the default servers.





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

C:\PS>Disconnect-VIServer -Server * -Force


Disconnects all server connections.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Disconnect-VIServer.html
Connect-VIServer