HPE Firmware Management for VMware ESXi – Smart Update Tools Install Mode

As I explained in the introduction to this series, the HPE Firmware Management for VMware ESXi includes multiple components which must be coordinated with each other. This post will show how to configure and monitor the HPE Smart Update Tools Install Mode in a comfortable manner.

Typically the HPE Smart Update Tools are shipped with the custom installation iso or are added to the default image by vLCM Vendor Addon or an additional update manager patch bundle.

Smart Update Tools Install Mode

The install mode can be OnDemand, AutoStage, AutoDeploy, or AutoDeployReboot. A quick way to configure the Smart Update Tools is via the ESXi shell (SUT Executable or esxcli SUT Namespace).

sut -set mode=<OnDemand,AutoStage,AutoDeploy,AutoDeployReboot>
ModeStageInstallApply / Reboot
AutoDeployRebootxxx
AutoDeployxx
AutoStagex
OnDemand

The current Install Mode of the Smart Update Tool is also reflected in the HPE OneView Firmware status of each Server.

HPE Smart Update Tools Install Mode - HPE OneView

Set Install Mode with PowerCLI

To make the HPE Smart Update Tools (SUT) configuration a bit more comfortable I wrote a short PowerCLI script to set the SUT Install Mode and disable the ESXi Lockdown Mode if required. The script does also support the switch back to “Manual” aka “OnDemand” mode, including the re-activation of the ESXi Lockdown Mode.

## Preperation
# Import VMware Modukes
Get-Module -ListAvailable -Name VMware* | Import-Module
# Connect vCenter Server
Connect-VIServer vcenter.lab.local

## Vars
[String]$ClusterName = "lab"
[String]$SutMode = "AutoDeploy" # OnDemand or AutoDeploy

$VMHosts = Get-Cluster -Name $ClusterName | Get-VMHost | Sort-Object name

foreach ($VMhost in $VMHosts) {

    if ($SutMode -like "AutoDeploy") {
        #region: Disable Lockdown Mode
        $HostView = $VMHost | Get-View
        if (($HostView).config.LockdownMode -eq "lockdownNormal"){ ($HostView).ExitLockdownMode()}
        #endregion    
    }
    elseif ($SutMode -like "OnDemand") {
        #region: Stop and Disable Shell
        $ServiceList = Get-VMHostService -VMhost $VMhost
        $SSHservice = $ServiceList | Where-Object {$_.Key -eq "TSM-SSH"}
        If ($SSHservice.Running -eq $true) {Stop-VMHostService -HostService $SSHService -Confirm:$false}
        else {Write-Output "SSH Server on host '$VMhost' is already Stopped"}
        $Shellservice = $ServiceList | Where-Object {$_.Key -eq "TSM"}
        If ($Shellservice.Running -eq $true) {Stop-VMHostService -HostService $Shellservice -Confirm:$false}
        else {Write-Output "Shell Server on host '$VMhost' is alreadyStopped"}
        #endrefion

        #region: Enable Lockdown Mode
        $HostView = $VMHost | Get-View
        if (($HostView).config.LockdownMode -eq "lockdownDisabled"){ ($HostView).EnterLockdownMode()}
        else {Write-Output "LockdownMode on host '$VMhost' is already Enabled or in Strict Mode"}
        #endregion     
    }
    else {
        Throw "Unsupported SUT Mode"
    }
   

    #region: Set SUT
    $esxcli = Get-ESXCLI -VMHost $VMhost -v2
    $esxcliargs = $esxcli.sut.mode.set.CreateArgs()
    $esxcliargs.mode = $SutMode
    try {
         $esxcli.sut.mode.set.Invoke($esxcliargs)
    }
    catch [System.Exception]  {
        $ErrorMessage = $_.Exception.Message
        Write-Warning "Error during SUT Configuration: $ErrorMessage"
    }
    #endregion

}

Report Smart Update Tools Install Mode

To get an overview of the current configuration of all ESXi HPE SUT install modes I wrote another PowerShell script that uses the HPE OneView Module to gather the data from each hardware status. The ESXi SUT agent does not offer this functionality in the esxcli sut namespace, “sut -status” on the shell is the only option to get this detail on the ESXi host itself.

## Preperation
# Import VMware Modukes
Get-Module -ListAvailable -Name VMware* | Import-Module
# Connect vCenter Server
Connect-VIServer vcenter.lab.local
# Import OneView Modules
Get-Module -ListAvailable -Name HPEOneView.* | Import-Module
# Connect to OneView appliance
Connect-OVMgmt -Hostname oneview.lab.local -AuthLoginDomain "LAB.LOCAL"


$VMHosts = Get-VMHost
Clear-Variable VMHost, OVServer, OVSResponse -ErrorAction SilentlyContinue

$Report = @()
foreach ($VMHost in $VMHosts) {
    Clear-Variable OVServer, OVSResponse -ErrorAction SilentlyContinue
    $Output = "" | Select-Object VMHost, Mode

    $OVServer = Get-OVServer -ServerName $VMHost.Name -ErrorAction SilentlyContinue
    if ($OVServer) {
        $OVSResponse = Send-OVRequest -uri $OVServer.uri    
    }
    
    $Output.VMHost = $VMHost.Name
    $Output.Mode = $OVSResponse.serverSettings.hpSmartUpdateToolStatus.mode

    $Report += $Output

}

$Report | Sort-Object Mode, VMHost | Format-Table -AutoSize
HPE Smart Update Tools Install Mode - PowerShell Report

Other Parts of this series

Leave a Reply