Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/HewlettPackard/POSH-HPEOneView/llms.txt

Use this file to discover all available pages before exploring further.

Synopsis

Log off from one or more HPE OneView appliances and remove the corresponding entries from $ConnectedSessions.

Syntax

Disconnect-OVMgmt
    [[-ApplianceConnection] <Object>]
    [<CommonParameters>]

Description

Disconnect-OVMgmt sends a DELETE request to the appliance session endpoint for each specified connection, invalidating the session token server-side, and then removes the connection from the $Global:ConnectedSessions tracker. When called without arguments the cmdlet disconnects the current default connection. You can also pass:
  • A connection object (e.g. from $ConnectedSessions) directly or through the pipeline.
  • A hostname string to look up and disconnect a named connection.
  • A connection ID integer to target a specific connection by its numeric ID.
After the operation, if only one connection remains in $ConnectedSessions and no default is marked, that remaining connection is automatically promoted to the default. The cmdlet returns the updated $ConnectedSessions collection after all requested disconnections have been processed.

Parameters

ApplianceConnection
Object
The connection(s) to disconnect. Accepts an HPEOneView.Appliance.Connection object, a hostname string, or a connection ID integer. Accepts pipeline input and the aliases Appliance, ApplianceSession, and Hostname.Defaults to the current default connection ($ConnectedSessions | Where-Object Default) when not specified.

Return value

Returns the updated $Global:ConnectedSessions collection after all specified connections have been removed.

Examples

Example 1: Disconnect the default appliance

Disconnect-OVMgmt

Example 2: Disconnect a specific appliance by hostname

Disconnect-OVMgmt -ApplianceConnection ov2.example.com

Example 3: Disconnect all connected appliances

# Pipe the entire ConnectedSessions collection
$ConnectedSessions | Disconnect-OVMgmt

Example 4: Disconnect by connection ID

# Connection IDs are visible in $ConnectedSessions.ConnectionId
Disconnect-OVMgmt -ApplianceConnection 2

Example 5: Disconnect a connection stored in a variable

$conn = Connect-OVMgmt -Hostname ov1.example.com -Credential (Get-Credential)
# ... do work ...
Disconnect-OVMgmt -ApplianceConnection $conn

Build docs developers (and LLMs) love