NicoWeytens
Contributor
Contributor

Removing vib fails saying [NoMatchError]

A colleague asked me to remove a vib called 'smx-provider' from all our ESXi hosts. I found a few examples to do this with PowerCLI.
As v1 of Get-EsxCLI throws a warning about it being deprecated, I'm trying to do it with the -V2 switch. I cannot get it to work though.

An extremely simplified version of my script:

$VibName = "smx-provider"
$VMHost = Get-VMHost "ESX.FQDN"
$esxcli = Get-EsxCli -VMHost $VMHost -V2
$vib = $esxcli.software.vib.list.Invoke() | Where-Object {$_.Name -match $VibName }
$esxcliRemoveVibArgs = $esxcli.software.vib.remove.CreateArgs()
$esxcliRemoveVibArgs.dryrun = $true       #Change this to $false to actually perform the uninstall
$esxcliRemoveVibArgs.vibname = $vib.Name
$esxcli.software.vib.remove.Invoke($esxcliRemoveVibArgs)

fails with:
Message: EsxCLI.CLIFault.summary;
InnerText: [NoMatchError] No VIB matching VIB search specification 'smx-provider'. Please refer to the log file for more details.EsxCLI.CLIFault.summary

$vib is populated with that smx-provider, so I don't understand why there's no match when removing it.
What am I missing??

0 Kudos
2 Replies
LucD
Leadership
Leadership

Strange.

Since you are doing a DryRun, do you get the same error when selecting another vib that is present?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
NicoWeytens
Contributor
Contributor

I changed $VibName to "sut" (=Integrated Smart Update Tools for VMware ESX), and that resulted in:

Message : Dryrun only, host not changed. The following installers will be applied: [BootBankInstaller]
RebootRequired : true
VIBsInstalled :
VIBsRemoved : {HPE_bootbank_sut_701.2.9.0.44-1OEM.701.0.0.16850804}
VIBsSkipped :

I assume this is the correct result. I was evaluating my code in our test environment, and I assume there must be something wrong with the host I was working with.
So I switched to one of our prod vCenters. Should be OK with the dryrun set to $true... Suspicion confirmed: there's nothing wrong with my code. It's just that non-prod ESXi host acting funny.

Case closed, sorry to have bothered everyone 😊

0 Kudos