4 ways to configure adv. settings in CLI

4 ways to configure adv. settings in CLI

There are a few CLI methods to configure advanced settings in ESXi Hosts. It depends on where you are (vMA/Linux, Windows Client, Console) and what you want to do (configure all hosts or just a specific host, …) which option fits best. Here I describe the options: native PowerCLI, esxcli (console), esxcli (get-esxcli), esxcli (get-esxcli -v2) to:

  • List
    • All settings
    • All settings in a specific Tree or Folder (eg.  /UserVars)
    • A specific option
    • All settings that differ from default settings (Delta)
  • Set
    • Integer
    • String.

esxcli (console)

List

  • All settings
    esxcli system settings advanced list
  • Folder
    esxcli system settings advanced list -t /UserVars
  • Value
    esxcli system settings advanced list -o /UserVars/VMAuthdDisabledProtocols
  • Delta
    esxcli system  settings advanced list -d

Set

  • Integer
    esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1
  • String
    esxcli system settings advanced set -o /UserVars/VMAuthdDisabledProtocols -s "tlsv1"
  • Reset to Default
    esxcli system settings advanced set -o /UserVars/SuppressShellWarning -d

esxcli (get-esxcli)

Read Cmdlet Reference for more information on get-esxcli. First create the esxcli-object

$cli1 = Get-VMHost hostname | Get-EsxCli

List

To list settings, you have 3 parameters to enter. These parameters have to be entered on the right position:

  1. Delta (Boolean)
  2. Option (String)
  3. Tree (String):
  • All settings
    $cli1.system.settings.advanced.list()
  • Folder
    $cli1.system.settings.advanced.list($false,  $null, "/UserVars")
  • Value
    $cli1.system.settings.advanced.list($false, "/UserVars/SuppressShellWarning", $null)
  • Delta
    $cli1.system.settings.advanced.list($true)

Set

To list settings, you have 4 parameters to enter. These parameters have to be entered on the right position:

  1. Default (Boolean)
  2. Integer (Integer)
  3. Option (String)
  4. String-Value (String):
  • Integer
    $cli1.system.settings.advanced.set($false, 1, "/UserVars/SuppressShellWarning", $null)
  • String
    $cli1.system.settings.advanced.set($false, $null, "/UserVars/VMAuthdDisabledProtocols", "tlsv1")
  • Reset to Default
    $cli1.system.settings.advanced.set($true, $null, "/UserVars/SuppressShellWarning", $null)

esxcli (get-esxcli; v2)

First create the esxcli-object

$cli2 = Get-VMHost hostname | Get-EsxCli -v2

List

  • All settings
    $cli2.system.settings.advanced.list.Invoke()
Option 1

In this option, you fill in a hashtable.

$adv = $cli2.system.settings.advanced.list.CreateArgs()

Keys in hashtable: option ([string], optional), tree ([string], optional), delta ([boolean], optional)

  • Folder
    $adv.tree = "/UserVars"
    $cli2.system.settings.advanced.list.Invoke($adv)
  • Value:
    $adv.option = "/UserVars/SuppressShellWarning"
    $cli2.system.settings.advanced.list.Invoke($adv)
  • Delta
    $adv.delta = $true
    $cli2.system.settings.advanced.list.Invoke($adv)
Option 2
  • Folder
    $cli2.system.settings.advanced.list.Invoke(@{tree="/UserVars"})
  • Value: $cli2.system.settings.advanced.list.Invoke(@{option="/UserVars/SuppressShellWarning"})
  • Delta
    $cli2.system.settings.advanced.list.Invoke(@{delta=$true})

Set

Option 1

$adv = $cli2.system.settings.advanced.set.CreateArgs()

Keys: default ([boolean], optional), option ([string]), stringvalue ([string], optional), intvalue ([long], optional)

  • Integer
    $adv.option = "/UserVars/SuppressShellWarning"
    $adv.intvalue = 1
    $cli2.system.settings.advanced.set.Invoke($adv)
  • String:
    $adv.option = "/UserVars/VMAuthdDisabledProtocols"
    $adv.stringvalue = "tlsv1"
    $cli2.system.settings.advanced.set.Invoke($adv)
  • Reset to Default:
    $adv.default = $true
    $adv.option = "/UserVars/VMAuthdDisabledProtocols" $cli2.system.settings.advanced.set.Invoke($adv)
Option 2
  • Integer $cli2.system.settings.advanced.set.Invoke(@{option="/UserVars/SuppressShellWarning"; intvalue=1})
  • String:
    $cli2.system.settings.advanced.set.Invoke(@{option="/UserVars/VMAuthdDisabledProtocols"; stringvalue="sslv3"})
  • Reset to Default: $cli2.system.settings.advanced.set.Invoke(@{option="/UserVars/VMAuthdDisabledProtocols"; default=$true})

PowerCLI

I did not find a way to handle default-values of advanced settings in native PowerCLI. See Cmdlet Reference for more info.

List

  • All settings
    Get-VMHost hostname | Get-AdvancedSetting | sort | ft -AutoSize
  • Value
    Get-VMHost hostname | Get-AdvancedSetting -Name UserVars.VMAuthdDisabledProtocols | select *

Set

  • Integer
    Get-VMHost hostname | Get-AdvancedSetting -Name UserVars.SuppressShellWarning | Set-AdvancedSetting -Value 1 -Confirm:$false
  • String
    Get-VMHost hostname | Get-AdvancedSetting -Name UserVars.VMAuthdDisabledProtocols | Set-AdvancedSetting -Value "sslv3" -Confirm:$false

One response to “4 ways to configure adv. settings in CLI”

  1. […] Keep in mind, this is a host-global setting, so when migration is finished, reset value back to 1. Here you can read more about setting advanced parameter using command […]

Leave a Reply

Your email address will not be published. Required fields are marked *