PowerCLI

 View Only

 How do I remediate a standalone host with a single image

Carl Power's profile image
Carl Power posted Jun 30, 2025 04:56 PM

So I have a host, lets call it vmserver01, and it has a single image defined - how do I check then remediate it with my single image?

$GetHostState = Get-VMHost "vmserver01.domain.com"
$ReqEsxiBld = "24674464"

I found the following commands, but I'm missing something in the Initialize-SettingsHostsSoftwareCheckSpec command

$LcmCheck = Initialize-SettingsHostsSoftwareCheckSpec -Commit "24674464"
Invoke-CheckHostSoftwareAsync -Host $GetHostState.ExtensionData.MoRef.Value -SettingsHostsSoftwareCheckSpec $LcmCheck
Invoke-ApplyHostSoftwareAsync -Host $GetHostState.ExtensionData.MoRef.Value -SettingsHostsSoftwareApplySpec $LcmCheck

The guides are not clear on what is required in the "-Commit" argument

I wonder if I am missing something else in the argument as well, as its not even picking up the host name, even when a Get-VMHost returns a valid hostname.

Invoke-vSphereApiClient : InvocationException: [NOT_FOUND]
Entity 'vmserver01.domain.com' does not exist or is not of type 'host'.
 ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
   --- End of inner exception stack trace ---
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.Sdk.vSphere.Esx.Settings\Api\SoftwareApi.ps1:4077 char:33
+                 $invokeResult = Invoke-vSphereApiClient @invokeParams
+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-vSphereApiClient
 
Invoke-vSphereApiClient : InvocationException: [NOT_FOUND]
Entity 'vmserver01.domain.com' does not exist or is not of type 'host'.
 ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
   --- End of inner exception stack trace ---
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.Sdk.vSphere.Esx.Settings\Api\SoftwareApi.ps1:4077 char:33
+                 $invokeResult = Invoke-vSphereApiClient @invokeParams
+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-vSphereApiClient