Skip to content
vJAL.nl
  • About me
  • Home
  • Search Icon
Uninstalling a VIB leveraging PowerCLI

Uninstalling a VIB leveraging PowerCLI

13 August 2020 Jesper Alberts Comments 0 Comment

“My problem”

A lot of my customers running VMware Horizon have been using NVIDIA GPU’s in their ESXi hosts leveraging vGPU to accelerate their virtual desktops, especially since they made the move to Windows 10. When using vGPU one of the requirements is the installation of a driver on the ESXi host(s) which has the NVIDIA card installed.

But when you add a component this also means you’ll have to maintain it, meaning from time to time it will require updating. Especially since NVIDIA introduced two separate release branches:

  • Long-Term support branch – which has support for three years after the initial release
  • New-Feature branch –  which has support for one year after the initial release

Seeing as both VMware and Microsoft frequently release new versions of their products it’s import to keep the entire chain in a supported state, which can be a puzzle sometimes.
Luckily VMware has a KB article which describes the process of updating the driver. In short it comes down to:

  • Make sure there are no VM’s running on the host using the graphics card
  • Place the host in maintenance mode
  • Uninstall the VIB
  • Install the new VIB

Especially the part where you uninstall and install the VIB can be time consuming job, as you normally do this through a command prompt on the ESXi host. So when you have to do this on several ESXi hosts you can image the amount of time and effort it takes to complete this task.

“My solution”

To make it less of a hassle I’ve written a PowerCLI script which removes a specified VIB of all ESXi hosts which are in maintenance mode.

In short the script saves all ESXi hosts in maintenance mode in a variable, and loops the removal of the specified VIB (in this case the NVIDIA one). Expect an updated version soon, as I’m working on a version which includes automatically rebooting the ESXi hosts (when required) and installing the new VIB afterwards.

You can download or copy the code in it’s current state below.

Uninstall_VIB_from_multiple_hosts-1Download
 <#
.SYNOPSIS
    Uninstall_VIB_from_multiple_hosts.ps1 - PowerShell Script to remove VIBs from one or more ESXi hosts.
.DESCRIPTION
    This script is used to delete a VIB from one or more ESXi hosts (depending on how you change line 15).
    By default the script will run against all ESXi hosts which are placed in maintenance mode.
    At this moment rebooting a host is a manual action, the requirement of a reboot will be printed to the console
.OUTPUTS
    Results are printed to the console.
.NOTES
    Author        Jesper Alberts, Twitter: @jesperalberts, Blog: www.vjal.nl

    Change Log    V1.00, 22/07/2019 - Initial version
#>

$vCenterServer = Read-Host "Enter the vCenter Server hostname"
$AdminUsername = Read-Host ("Enter the username for the administrative account")
$AdminPassword = Read-Host ("Password for " + $AdminUsername) -AsSecureString:$true
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $AdminUsername, $AdminPassword

Connect-VIServer -Server $vCenterServer -Credential $Credentials

$ESXiHosts = Get-VMHost | Where { $_.ConnectionState -eq "Maintenance" }
$VIBs = @("NVIDIA-VMware_ESXi_6.7_Host_Driver")

Foreach ($ESXiHost in $ESXiHosts) {
    Write-host "Working on $ESXiHost."
    $ESXCLI = get-esxcli -vmhost $ESXiHost
    foreach ($VIB in ($VIBs)) {
        write-host "Searching for VIB $VIB." -ForegroundColor Cyan
        if ($ESXCLI.software.vib.get.invoke() | where { $_.name -eq "$VIB" } -erroraction silentlycontinue ) {
            write-host "Found vib $VIB on $ESXiHost, deleting." -ForegroundColor Green
            $ESXCLI.software.vib.remove.invoke($null, $true, $false, $true, "$VIB")
        }
        else {
            write-host "VIB $VIB not found on $ESXiHost." -ForegroundColor Yellow
        }
    }
}
Please follow and like us:
Tweet

PowerCLI
NVIDIA, PowerCLI, VMware vSphere

Post navigation

PREVIOUS
My VMware VCAP6-DTM Deploy (3V0-653) experience
NEXT
Using the new Elevated Task feature in DEM to manage registry keys in HKLM

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Let’s stay in touch!

Twitter
LinkedIn

Recent Posts

  • Parallel upgrading of Horizon Connection Servers (Horizon 8 2006+)
  • Testing the “True SSO configuration utility” fling
  • September recap
jesperalbertsJesper Alberts@jesperalberts·
22 Jan

Setting up my new MBP with the M1 chip. Compared to my "old" one with 10th Gen i5 this thing is really fast! The Intel MBP lacked the snappiness which the M1 certainly has.

Reply on Twitter 1352687413441814530Retweet on Twitter 1352687413441814530Like on Twitter 135268741344181453010Twitter 1352687413441814530
Retweet on TwitterJesper Alberts Retweeted
graemengordonGordo@graemengordon·
14 Jan

Version b2001 of the #OSOptimizationTool #OSOT went live on @vmwflings bringing more goodness

Added features to auto export and import selections which helps in remembers previous selections and moving between systems

https://flings.vmware.com/vmware-os-optimization-tool#changelog

Reply on Twitter 1349768764896780288Retweet on Twitter 13497687648967802884Like on Twitter 13497687648967802884Twitter 1349768764896780288
Retweet on TwitterJesper Alberts Retweeted
VMwareVMware@VMware·
14 Jan

Tired of upgrading your connection servers one-by-one? 👎

You can now save time and upgrade all Horizon Connection Servers simultaneously.

Learn how it works with @jesperalberts's blog: https://bit.ly/3oNvxoY

Reply on Twitter 1349738818279190528Retweet on Twitter 13497388182791905285Like on Twitter 134973881827919052819Twitter 1349738818279190528
Retweet on TwitterJesper Alberts Retweeted
ITQITQ@ITQ·
13 Jan

We are very proud to be the 1st @VMware partner worldwide who has achieved the Master Services Competency VMware Cloud Foundation and the 1st partner worldwide to complete all 7 MSC’s.

#proud #vmware #msc #masterservicecompetency #cloudfoundation

Reply on Twitter 1349393458625191937Retweet on Twitter 134939345862519193719Like on Twitter 134939345862519193751Twitter 1349393458625191937
jesperalbertsJesper Alberts@jesperalberts·
12 Jan

PSA: Running NSX-T 3.x and planning on upgrading to ESXi 7.0 U1 while using IDS/IPS? Take a look at this KB article before pressing the upgrade button - https://kb.vmware.com/s/article/82043

Reply on Twitter 1348935972097044480Retweet on Twitter 1348935972097044480Like on Twitter 13489359720970444804Twitter 1348935972097044480
Load More...

Archives

  • January 2021
  • October 2020
  • August 2020

Categories

  • Certification
  • Dynamic Environment Manager
  • Horizon
  • Personal
  • PowerCLI
  • Uncategorized

Tags

Certificates Certification DEM Dynamic Environment Manager Horizon Identity Manager Job NVIDIA Personal PowerCLI Troubleshooting True SSO Upgrading VCAP VCIX VMware Tools VMware vSphere Workspace One Access
© 2021   All Rights Reserved.