Skip to content

Set-PowerCLIConfiguration

VMware: Modifies the VMware PowerCLI configuration

#Requires -Version 5.1
[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [ValidateSet("Session", "User", "AllUsers")]
    [string]$Scope = "User",
    [ValidateSet("Fail", "Ignore", "Prompt", "Unset", "Warn")]
    [string]$InvalidCertificateAction,
    [ValidateSet("Multiple", "Single")]
    [string]$DefaultVIServerMode,
    [bool]$DisplayDeprecationWarnings,
    [int32]$WebOperationTimeoutSeconds,
    [ValidateSet("UseSystemProxy", "NoProxy")]
    [string]$ProxyPolicy,
    [bool]$ParticipateInCEIP,
    [ValidateSet("UseSystemProxy", "NoProxy")]
    [string]$CEIPDataTransferProxyPolicy
)
Process {
    try {
        $setArgs = @{ ErrorAction = 'Stop'; Scope = $Scope; Confirm = $false }
        if ($WebOperationTimeoutSeconds -gt 0) { $null = Set-PowerCLIConfiguration @setArgs -WebOperationTimeoutSeconds $WebOperationTimeoutSeconds }
        if (-not [System.String]::IsNullOrWhiteSpace($InvalidCertificateAction)) { $null = Set-PowerCLIConfiguration @setArgs -InvalidCertificateAction $InvalidCertificateAction }
        if (-not [System.String]::IsNullOrWhiteSpace($DefaultVIServerMode)) { $null = Set-PowerCLIConfiguration @setArgs -DefaultVIServerMode $DefaultVIServerMode }
        if (-not [System.String]::IsNullOrWhiteSpace($ProxyPolicy)) { $null = Set-PowerCLIConfiguration @setArgs -ProxyPolicy $ProxyPolicy }
        if ($PSBoundParameters.ContainsKey('DisplayDeprecationWarnings')) { $null = Set-PowerCLIConfiguration @setArgs -DisplayDeprecationWarnings $DisplayDeprecationWarnings }
        if ($PSBoundParameters.ContainsKey('ParticipateInCEIP')) { $null = Set-PowerCLIConfiguration @setArgs -ParticipateInCEIP $ParticipateInCEIP }
        if (-not [System.String]::IsNullOrWhiteSpace($CEIPDataTransferProxyPolicy)) { $null = Set-PowerCLIConfiguration @setArgs -CEIPDataTransferProxyPolicy $CEIPDataTransferProxyPolicy }
        $result = Get-PowerCLIConfiguration -Scope $Scope -ErrorAction Stop | Format-List
        Write-Output $result
    }
    catch { throw }
}

Scope: Session, User, or AllUsers

Action on certificate errors: Fail, Ignore, Prompt, Unset, Warn

Server connection mode: Multiple or Single

Show warnings about deprecated elements

Timeout for Web operations

System proxy usage: UseSystemProxy or NoProxy

Send anonymous usage information to VMware

Proxy policy for CEIP data transfer

An interactive directory of PowerShell scripts.