VMware Cloud Community
Vlad_Belo
Enthusiast
Enthusiast
Jump to solution

ESXi Upgrading to 8 gets VIB error

Hi All,

So I'm trying to upgrade host with powershell script I've made to version 8.

and got into an issue of "not compatible" VIB

need help to get around it... I want to run a check before the upgrade, that does the following:

check if there VIBs that does not have sha-256 gunzip checksum (from what I've searched, its always VIBS that 'AcceptanceLevel' is not 'VMwareCertified'. for example got 1 host that have VIB that is 'CommunitySupported' acceptance level.)

remove that VIB - pop up a window that ask you if you want to remove that VIB : YES = remove the VIB. NO = error the script and exit

 

BONUS: if its any way possible to save that said VIB (one or plural) and install it back after the upgrade. 
or if its possible just to upgrade said VIBs to a version that compatible with esxi8 

 

I tried to use LucD's script for starters just to get the list of VIBs that AcceptanceLevel is not VMwareCertified (with a little switch of my own) :

 

$msgType = [System.Windows.MessageBoxButton]::YesNo
$msgTitle = 'Remove VIB'
$msgBody = 'Are you sure you want to Remove VIB '+$vib
$msgIcon = [System.Windows.MessageBoxImage]::Warning
$msgBox = {[System.Windows.MessageBox]::Show($msgBody,$msgTitle,$msgType,$msgIcon)}
$msgBoxInput =  Invoke-command $msgBox

switch  ($msgBoxInput) {
    'Yes' {
        ## Remove the VIB
    }
    'No' {
        ## error and exit
    }
}

$esxcli = Get-EsxCli -VMHost $hosts -V2
$esxcli.software.vib.list.Invoke() |
ForEach-Object -Process {
        New-Object -TypeName PSObject -Property ([ordered]@{
            'VIB Name' = $_.Name
            'VIB Version' = $_.Version
            'Acceptance Level' = ($_.AcceptanceLevel | ?{$_.AcceptanceLevel -ne "VMwareCertified"})
        })
}

 

 

but its still showing  the full list and not only the ones that not 'VMwareCertified"

 

I'm sure that kind of script will be complex to make with the pop up window and YES \ NO buttons and reactions.

so any help with that will be most appreciated!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I would make a few adjustments.
Something like this

Add-Type -AssemblyName PresentationCore, PresentationFramework

$esxcli = Get-EsxCli -VMHost $hosts -V2
$vib = $esxcli.software.vib.list.Invoke() |
Where-Object { $_.AcceptanceLevel -ne "VMwareCertified" } |
ForEach-Object -Process {
    New-Object -TypeName PSObject -Property ([ordered]@{
        'VIB Name' = $_.Name
        'VIB Version' = $_.Version
        'Acceptance Level' = $_.AcceptanceLevel
    })
}

$msgType = [System.Windows.MessageBoxButton]::YesNo
$msgTitle = 'Remove VIB'
$msgBody = 'Remove VIB(s)' + [System.Environment]::NewLine
$vib | %{
    $msgBody = $msgBody + [System.Environment]::NewLine + "$($_.'VIB Name')"
}
$msgIcon = [System.Windows.MessageBoxImage]::Warning
$msgBox = { [System.Windows.MessageBox]::Show($msgBody, $msgTitle, $msgType, $msgIcon) }
$msgBoxInput = Invoke-Command $msgBox

switch ($msgBoxInput) {
    'Yes' {
        ## Remove the VIB(s)
        $vib | ForEach-Object -Process {
            $esxcli.software.vib.remove.Invoke(@{vibname="$($_.'VIB Name')"})
        }
    }
    'No' {
        ## error and exit
        throw 'error VIB does not have sha-256'
        exit
    }
}


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

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

Are you sure the text is exactly 'VMwareCertified'?
Perhaps try with a -notmatch instead of a -ne

'Acceptance Level' = ($_.AcceptanceLevel | ?{$_.AcceptanceLevel -notmatch "VMwareCertified"})

  


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

0 Kudos
Vlad_Belo
Enthusiast
Enthusiast
Jump to solution

yes the text is exactly 'VMwareCertified'

and same for -notmatch as for -ne is not working just keep showing all VIB list

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Just realised, you probably have to place the Where-clause higher up.

$esxcli = Get-EsxCli -VMHost $hosts -V2
$esxcli.software.vib.list.Invoke() |
where{$_.AcceptanceLevel -ne "VMwareCertified"} |
ForEach-Object -Process {
        New-Object -TypeName PSObject -Property ([ordered]@{
            'VIB Name' = $_.Name
            'VIB Version' = $_.Version
            'Acceptance Level' = $_.AcceptanceLevel
        })
}


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

0 Kudos
Vlad_Belo
Enthusiast
Enthusiast
Jump to solution

you are correct sir. it worked

now is it right to pack all this into a variable for the YesNo pop up?

like so:

 

$vib = {$esxcli = Get-EsxCli -VMHost $hosts -V2
$esxcli.software.vib.list.Invoke() |
?{$_.AcceptanceLevel -ne "VMwareCertified"} |
ForEach-Object -Process {
    New-Object -TypeName PSObject -Property ([ordered]@{
        'VIB Name' = $_.Name
        'VIB Version' = $_.Version
        'Acceptance Level' = $_.AcceptanceLevel  
    })
}}

$msgType = [System.Windows.MessageBoxButton]::YesNo
$msgTitle = 'Remove VIB'
$msgBody = 'Are you sure you want to Remove VIB '+$vib
$msgIcon = [System.Windows.MessageBoxImage]::Warning
$msgBox = {[System.Windows.MessageBox]::Show($msgBody,$msgTitle,$msgType,$msgIcon)}
$msgBoxInput =  Invoke-command $msgBox

switch  ($msgBoxInput) {
    'Yes' {
        ## Remove the VIB
        $esxcli.software.vib.remove.Invoke($vib)
    }
    'No' {
        ## error and exit
        throw 'error VIB does not have sha-256'
        exit
    }
}

 

 

or am I missing something here?

I want to connect between them, so it search for all VIB that are for remove, and with the selection 'YES \ NO' 

continue either to removing the VIB or throw error and exit

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I would make a few adjustments.
Something like this

Add-Type -AssemblyName PresentationCore, PresentationFramework

$esxcli = Get-EsxCli -VMHost $hosts -V2
$vib = $esxcli.software.vib.list.Invoke() |
Where-Object { $_.AcceptanceLevel -ne "VMwareCertified" } |
ForEach-Object -Process {
    New-Object -TypeName PSObject -Property ([ordered]@{
        'VIB Name' = $_.Name
        'VIB Version' = $_.Version
        'Acceptance Level' = $_.AcceptanceLevel
    })
}

$msgType = [System.Windows.MessageBoxButton]::YesNo
$msgTitle = 'Remove VIB'
$msgBody = 'Remove VIB(s)' + [System.Environment]::NewLine
$vib | %{
    $msgBody = $msgBody + [System.Environment]::NewLine + "$($_.'VIB Name')"
}
$msgIcon = [System.Windows.MessageBoxImage]::Warning
$msgBox = { [System.Windows.MessageBox]::Show($msgBody, $msgTitle, $msgType, $msgIcon) }
$msgBoxInput = Invoke-Command $msgBox

switch ($msgBoxInput) {
    'Yes' {
        ## Remove the VIB(s)
        $vib | ForEach-Object -Process {
            $esxcli.software.vib.remove.Invoke(@{vibname="$($_.'VIB Name')"})
        }
    }
    'No' {
        ## error and exit
        throw 'error VIB does not have sha-256'
        exit
    }
}


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