The Get-Cluster -Name $vCluster | Get-vmHost gets all hosts in a cluster.
Change to Get-vmHost -Name $fqdn for a single host.
Original Message:
Sent: 11/3/2025 12:28:00 PM
From: Carl Power
Subject: RE: Get compliance of a standalone single image (VCF PowerCLI 9.0)
But this won't work with witnesses, as from vCenter 8.0, even vSAN virtual witnesses are now treated as a standalone host, not part of a cluster.
-------------------------------------------
Original Message:
Sent: Nov 02, 2025 08:22 AM
From: john Wantland
Subject: Get compliance of a standalone single image (VCF PowerCLI 9.0)
I use the following in an ESXi patch script:
$vCluster is the cluster that's being patched
$baseline is a single baseline that has a beginning/end date. keeps all hosts in different clusters sync'd, we have 160 hosts, so sometimes new patches are released during our patch runs.
#list compliant/noncompliant hosts
#Test-Compliance -Entity $vCluster -UpdateType HostPatch > $null
Try {
$Compliant_hosts = (Get-Cluster -Name $vCluster | Get-vmHost | Sort-Object | Get-Compliance -Baseline $Baselines | Where-Object { $_.Status -eq 'Compliant' }).Entity.Name
$nonCompliant_hosts = (Get-Cluster -Name $vCluster | Get-vmHost | Sort-Object | Get-Compliance -Baseline $Baselines | Where-Object { $_.Status -ne 'Compliant' }).Entity.Name
}
Catch {
$ErrorMessage = $_.Exception.Message
Write-Error $ErrorMessage
exit_stage_left
}
Original Message:
Sent: Oct 27, 2025 04:13 PM
From: Carl Power
Subject: Get compliance of a standalone single image (VCF PowerCLI 9.0)
Hi team,
I have created a PowerCLI script to sort through nearly 650 VMhosts to identify my virtual vSAN witness appliance hosts, which I then plan to remediate against a single image.
My script then identifies nearly 320 witnesses, which I confirm the image against a known good golden image.
My final stage is to remediate the witness, which I could just attempt to remediate blind, which will then skip if the single image is already compliant, but not before it does a rescan of the image compliance - this all wastes time and compute.
Is there a way that I can get the current compliance of the image without checking its compliance, as the vCenter is already showing the image as compliant in the GUI?


-------------------------------------------