Hi,
So I've created a Script for updating Host. but when I'm trying to update any old version to 8.0
many of the tries, it fails. but it fails over VIBs it looks like.
this is an example of the errors
Install-VMHostPatch The following error occured while updating host: The image profile could not be validated. File path of '/lib64/python3.8/idlelib/calltip_w.pyc' is claimed by multiple
non-overlay VIBs: {'VMware_bootbank_esx-base_8.0.0-1.0.20513097', 'VMware_bootbank_esxio-base_8.0.0-1.0.20513097'} File path of '/usr/lib64/cim/libomc_battery_provider.so' is claimed by multiple non-overlay VIBs:
{'VMware_bootbank_esx-base_8.0.0-1.0.20513097', 'VMware_bootbank_esxio-base_8.0.0-1.0.20513097'}
and so on and so forth. (and the list is going of for a couple of hundreds or even thousands like this)
when I try to do the update via the CLI with simple
esxcli software profile update -d
I nothing that with that its doing what ever need to be done with the VIBs, either removing or upgrading or installing the ones it need for version 8.0
my question is either how can I do that with Install-VMHostPatch so it will either skip the VIBs part, or do what ever need to be done with them, remove\upgrade\install vibs.
or perhaps will be easier to use the esxcli commands within powershell?
Thanks
I would advise using the V2 switch on the Get-EsxCli cmdlet.
That way you have the ease of using the CreateArgs method, which will give you a hash table with the parameters.
See PowerCLI 6.3 R1: Get-ESXCLI Why the V2?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could use the Get-EsxCli cmdlet instead of Install-VMHostPatch.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
so if for example I want to imitate the behavior over the host's cli to powershell so this
esxcli software sources profile list -d /vmfs/path/depot.zip
esxcli software profile update -d /vmfs/path/depot.zip -p ESXi-XYZ-standard
should be something like this this? (more or less)
$standard = $esxcli.software.sources.profile.list -depot /vmfs/path/depot.zip
$install = $esxcli.software.profile.update -dryrun /vmfs/path/depot.zip -profile $standard.Name
I would advise using the V2 switch on the Get-EsxCli cmdlet.
That way you have the ease of using the CreateArgs method, which will give you a hash table with the parameters.
See PowerCLI 6.3 R1: Get-ESXCLI Why the V2?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes I am using V2 Get-EsxCli
getting issues
Message: EsxCLI.CLIFault.summary;
InnerText: [ValueError] Only server local file path is supported for offline bundles. (vmstores:\VC@443\Datacenter\DS\*depot.zip) seem to be remote URIs. Please refer to the log file for more
this is what I've done... please help me find my mistake(s)
I'm trying to understand how the path suppose to be
$dsPath = $($zipFile.FullName)
New-PSDrive -Name DS -Root \ -PSProvider VimDatastore -Datastore $ds | Out-Null -Verbose
$depotFile = Get-ChildItem -Path DS:/ | where{$_.Name -eq $zipFile}
Remove-PSDrive -Name DS -Confirm:$false -Verbose
$stdParm = @{
depot = $depotFile.FullName
}
Add-Type -AssemblyName PresentationFramework
$esxcli = Get-EsxCli -VMHost $hosts -V2
$standard = $esxcli.software.sources.profile.list.Invoke($stdParm)
$insParm = @{
depot = $depotFile.FullName
profile = $standard
}
$install = $esxcli.software.profile.update.Invoke($insParm)
You probably have to use a path ('/vmfs/volumes/...') like I explained in the other thread.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
question.
in Install-VMHostPatch there is NeedsRestart option that I can check if the host need restart after the command, and restart it.
I dont see anything like that in $esxcli.software.profile.update
how can I perform a restart needed check after that cli command is finished?
does the host it self have such options at all? like i can do
$hosts = Get-VMHost
$instProfile = $esxcli.software.profile.update.Invoke($installParam)
if ($instProfile -ne $null) {
if ($hosts.NeedsRestart) {
$hosts | Restart-VMHost -Confirm:$false
}
}
only it does not recognize $hosts.NeedsRestart
Isn't there a kind of 'reboot required' property in $instProfile?
What does
$instProfile | Get-Member
show?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
I have got some issue on some hosts which states CPU Support warning.
Error: Message: EsxCLI.CLIFault.summary;
InnerText: [HardwareError] Hardware precheck of profile ESXi-8.0a-20842819-standard failed with warnings: <CPU_SUPPORT WARNING: The CPU in this host may not be supported in future ESXi releases. Please plan accordingly.> Apply --no-hardware-warning option t
o ignore the warnings and proceed with the transaction. Please refer to the log file for more details.EsxCLI.CLIFault.summary
as mentioned in the error, by applying --no-hardware-warning will solve it.
but I did not find a way to apply that inside the powershell command.
is there anyway to check all flags for the $esxcli.software.profile.update are? or how to apply that within powershell the flat --no-hardware-warning
Thanks!
Did you check if that parameter is in the hash table generated by
$esxcli.software.profile.update.CreateArgs()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks!
so I need to do it with 2 commands then?
EDITED:
$esxcli.software.profile.update.CreateArgs()
$insParm = @{
depot = $insPath
profile = $stdName
nohardwarewarning = $true
}
$insProfile = $esxcli.software.profile.update.Invoke($insParm)
is that in correct order?
If you know the content of the hash table by heart, you can create it as such.
Using the CreateArgs method is easier, and you will also get all optional parameters
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't know it by heart, just checked it as you suggested, and one of the args was indeed 'nohardwarewarning' written like this
so my question is, how would you do it?
like I did it? or different way for the 'nohardwarewarning' ?
Yes, like you did it.
The method with CreateArgs is the safest.
It also handles the case when new parameters are added or some are removed.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference