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

Designate a specific HPEOneView.Appliance.Connection as the default connection used by all cmdlets that rely on $ConnectedSessions.

Syntax

Set-OVApplianceDefaultConnection
    [-ApplianceConnection] <Object>
    [<CommonParameters>]

Description

When multiple HPE OneView appliances are connected simultaneously, cmdlets that do not receive an explicit -ApplianceConnection argument operate against the default connection. Set-OVApplianceDefaultConnection lets you switch which connection holds that default status. The cmdlet:
  1. Locates the connection matching the supplied value in $Global:ConnectedSessions.
  2. Clears the default flag on whichever connection currently holds it.
  3. Sets the default flag on the targeted connection.
If only one connection exists in $ConnectedSessions, the cmdlet issues a warning and ensures that single connection is marked as default rather than performing a switch. Accepts either an HPEOneView.Appliance.Connection object (e.g. from $ConnectedSessions) or a name string. Pipeline input is supported. The cmdlet returns the updated $Global:ConnectedSessions collection.

Parameters

ApplianceConnection
Object
required
The connection to promote to the default. Accepts an HPEOneView.Appliance.Connection object or a connection name string. Pipeline input is supported. Accepts the aliases Appliance and Connection.

Return value

Returns the full $Global:ConnectedSessions collection with the updated default flag.

Examples

Example 1: Set the default connection by passing a connection object

$cred = Get-Credential
Connect-OVMgmt -Hostname ov1.example.com -Credential $cred
$conn2 = Connect-OVMgmt -Hostname ov2.example.com -Credential $cred

# Switch default to the second appliance
Set-OVApplianceDefaultConnection -ApplianceConnection $conn2

Example 2: Set the default connection by name string

Set-OVApplianceDefaultConnection -ApplianceConnection 'ov1.example.com'

Example 3: Select via the pipeline

$ConnectedSessions | Where-Object Name -eq 'ov2.example.com' | Set-OVApplianceDefaultConnection

Example 4: Interactively choose from connected sessions

$ConnectedSessions | Out-GridView -Title 'Select default connection' -OutputMode Single |
    Set-OVApplianceDefaultConnection