VMware Cloud Community
julianwood
Enthusiast
Enthusiast

Updating Broadcom bnx2x Nic Drivers with PowerCLI

http://www.wooditwork.com/2010/11/15/updating-broadcom-bnx2x-nic-drivers-with-powercli/

I've done a blog post on how to update Nic Drivers with PowerCLI as they are often not available through Update Manager.

There's a lot more info in the post on how to actually get the files you need out of the file you download from VMware. You basically extract the driver file and a metadata.zip file.

Here's the script you would then use to apply the driver update.

$VCServerName = "vCenter.local"
$VC = Connect-VIServer $VCServerName
$ESXHost = Get-VMHost "MYESXHost01.local"
$PatchRoot = "/vmfs/volumes/vmiso/ESXPatches/"
 
# Place host into Maintenance Mode
If ($ESXHost.State -notmatch "Maintenance") {$ESXHost | Set-VMHost -State Maintenance}
 
# Installing Patch
Write-Host $ESXHost.Name ": Installing Patch: vmware-esx-drivers-net-bnx2x-400.1.60.50.v41.2-1vmw.0.0.00000.x86_64"
Install-VMHostPatch -VMHost $ESXHost -HostPath $PatchRoot/BCM-bnx2x-1.60.50.v41.2-offline_bundle-320302/metadata.zip
 
#Restart Host
$ESXHost | Restart-VMHost -Confirm:$false

You could run this on a group of hosts at a time. For the sake of this example I’m going to assume that a whole cluster can be patched at once and it doesn’t have VMs running on it otherwise you would need to do a staged approach by doing a few hosts at a time so you had enough capacity in the cluster to keep VMs up and running.

$VCServerName = "vCenter.local"
$VC = Connect-VIServer $VCServerName
$PatchRoot = "/vmfs/volumes/vmiso/ESXPatches/"
 
Get-Cluster "Cluster01" | Get-VMHost | Sort Name | % {
   # Place host into Maintenance Mode
   If ($_.State -notmatch "Maintenance") {$_ | Set-VMHost -State maintenance}
 
   # Installing Patch
   Write-Host $_.Name ": Installing Patch: vmware-esx-drivers-net-bnx2x-400.1.60.50.v41.2-1vmw.0.0.00000.x86_64"
   Install-VMHostPatch -VMHost $_ -HostPath $PatchRoot/BCM-bnx2x-1.60.50.v41.2-offline_bundle-320302/metadata.zip
 
   #Restart Host
   $_ | Restart-VMHost -Confirm:$false
   }

http://WoodITWork.com
Reply
0 Kudos
9 Replies
manfriday
Enthusiast
Enthusiast

HI!

Thanks for the info. I am trying to do something like this as well.

Have you tried using the -LocalPath switch wirth Install-VMHostPatch?

I am trying to do this from a machine with the patches on local storage. I get a message saying "Invalid Patch archive"

Reply
0 Kudos
DougBaer
Commander
Commander

Did you unzip the outer patch zipfile?

You should have a directory containing the 'metadata.zip' file as well as the vmware-esx-drivers-net-bnx2x-400.1.60.50.v41.2-1vmw.0.0.00000.x86_64.vib file.

Doug Baer, Solution Architect, Advanced Services, Broadcom | VCDX #019, vExpert 2012-23
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast

I did unzip them, and pointed the -LocalPath to the metadata.zip file.

I solved my issue by moving them to a datastore and using the -HostPath switch instead.

Not sure why the -LocalPath didnt work.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

I have the same problem with the Install-VMHostPatch -LocalPath parameter. It looks like a bug to me.

[vSphere PowerCLI] C:\users\robert> Install-VMHostPatch -vmhost $vmhost -localpath c:\users\robert\esxpatches\metadata.zip -hostcred $hc

Install-VMHostPatch : 11-2-2011 14:06:50    Install-VMHostPatch        Invalid patch archive: 'c:\users\robert\esxpatches\metadata.zip'.
At line:1 char:20
+ Install-VMHostPatch <<<<  -vmhost $vmhost -localpath c:\users\robert\esxpatches\metadata.zip -hostcred $hc
    + CategoryInfo          : InvalidArgument: (c:\users\robert\esxpatches\metadata.zip:String) [Install-VMHostPatch], VimException
    + FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_TryValidateUpdateLocation40_InvalidArchive,VMware.VimAutomation.ViCore.Cmdlets.Commands.Hos
   t.InstallVMHostPatch


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
iguy
Enthusiast
Enthusiast

What OS are you using for where you run PowerCLI from?

I've seen this on Windows 7 & Windows 2008 R2 when the same script works fine from XP.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Thanks for the suggestion. I run my PowerCLI scripts on a Windows 7 Ultimate 64-bits OS, using 32-bits PowerCLI 4.1U1. Tomorrow I will try it on a Windows XP PC.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
ykalchev
VMware Employee
VMware Employee

Hi Robert,

Can you dump exception and inner exception details of the error:

$error[0].Exception | select *

$error[0].Exception.InnerException | select *

This'll point us to the real source of the error. In order to validate patch file we're trying to unzip content in the window's temp dir, so this could cause error in Win 7 machine.

Thanks,

Yasen Kalchev

PowerCLI Dev team

Yasen Kalchev, vSM Dev Team
Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Hi Yasen,

I tried it on both Windows 7 and Windows XP SP3. It didn't work on either OS, but the error messages where different. On Windows 7 the error message is: "Invalid patch archive". On Windows XP the error message is: "The system cannot find the file specified". I have also tried which error you get if the file really doesn't exist. Then you get: "The specified path does not exist".

I had no problem installing the patch using the VMware vSphere CLI with vihostupdate.pl. I must say that what I like about vihostupdate.pl is that you can give a path to the patch zip file instead of the metadata.zip as in the cmdlet. The advantage of the vihostupdate.pl is that you don't have to unzip the patch file first. But being a PowerCLI lover, I would like to do everything in PowerCLI.

As I don't want to give my admin account to the whole world, I changed the output of the ConnectionId.

I will give you the Windows 7 results first:

[vSphere PowerCLI] C:\users\robert> dir c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594 -recurse


    Directory: Microsoft.PowerShell.Core\FileSystem::C:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594


Mode           LastWriteTime       Length Name
----           -------------       ------ ----
-----     10-1-2011    18:00         4204 metadata.zip
-----     10-1-2011    17:59        82052 vmware-esx-drivers-net-be2net-400.2.102.554.0-1vmw.2.17.249663.x86_64.vib


[vSphere PowerCLI] C:\users\robert> Install-VMHostPatch -vmhost $vmhost -localpath c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594\metadata.zip -hostcred $hc
Install-VMHostPatch : 2-3-2011 9:58:13    Install-VMHostPatch        Invalid patch archive: 'c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-3
47594\metadata.zip'.
At line:1 char:20
+ Install-VMHostPatch <<<<  -vmhost $vmhost -localpath c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594\metadata.zip -hostcred $hc
    + CategoryInfo          : InvalidArgument: (c:\users\robert...94\metadata.zip:String) [Install-VMHostPatch], VimException
    + FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_TryValidateUpdateLocation40_InvalidArchive,VMware.VimAutomation.ViCore.Cmdlets.Commands.Hos
   t.InstallVMHostPatch

[vSphere PowerCLI] C:\users\robert> $error[0].Exception | select *


ErrorId           : Client20_SystemManagementServiceImpl_TryValidateUpdateLocation40_InvalidArchive
ErrorCategory     : InvalidArgument
TargetObject      : c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594\metadata.zip
RecommendedAction :
SessionId         :
ConnectionId      : /VIServer=domain\account@vCenter:443/
Severity          : Error
Message           : 2-3-2011 9:58:13    Install-VMHostPatch        Invalid patch archive: 'c:\users\robert\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347
                    594\metadata.zip'.
Data              : {ParameterValues}
InnerException    :
TargetSite        : Void TryValidateUpdateLocation40(System.String, Boolean)
StackTrace        :    bij VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.TryValidateUpdateLocation40(String location, Boolean isLocal
                    Location)
                       bij VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.<>c__DisplayClass39.<InstallVMHostPatchFromUserSystem40>b__3
                    7(ClientSideTask task, Object taskResult)
HelpLink          :
Source            : VMware.VimAutomation.ViCore.Impl

[vSphere PowerCLI] C:\users\robert> $error[0].Exception.InnerException | select *
[vSphere PowerCLI] C:\users\robert>


On the Windows XP PC the patch file is on a network share instead of a local disk. But I don't think that should make a difference:

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> dir y:\vmware\esxpatches\SVE-be2net-2.102.55
4.0-offline_bundle-347594 -recurse


    Directory: Y:\vmware\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         10-1-2011     18:00       4204 metadata.zip
-a---         10-1-2011     17:59      82052 vmware-esx-drivers-net-be2net-400.2.102.554.0-1vmw.2.17.249663.x86_64.vib


[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> Install-VMHostPatch -vmhost $vmhost -localpath y:\vmware\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-347594\metadata.zip -hostcred $hc
Install-VMHostPatch : 2-3-2011 9:57:46    Install-VMHostPatch        The system cannot find the file specified. (Except
ion from HRESULT: 0x80070002)
At line:1 char:20
+ Install-VMHostPatch <<<<  -vmhost $vmhost -localpath y:\vmware\esxpatches\SVE-be2net-2.102.554.0-offline_bundle-34759
4\metadata.zip -hostcred $hc
    + CategoryInfo          : NotSpecified: (:) [Install-VMHostPatch], ViError
    + FullyQualifiedErrorId : Client20_ClientSideTaskImpl_ThreadProc_UnhandledException,VMware.VimAutomation.ViCore.Cm
   dlets.Commands.Host.InstallVMHostPatch

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> $error[0].Exception | select *


ErrorId           : Client20_ClientSideTaskImpl_ThreadProc_UnhandledException
ErrorCategory     : NotSpecified
TargetObject      :
RecommendedAction :
SessionId         :
ConnectionId      : /VIServer=domain\account@vCenter:443/
Severity          : Error
Message           : 2-3-2011 9:57:46    Install-VMHostPatch        The system cannot find the file specified. (Exceptio
                    n from HRESULT: 0x80070002)
Data              : {ParameterValues}
InnerException    : System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT
                    : 0x80070002)
                       at Shell32.ShellClass.NameSpace(Object vDir)
                       at VMware.VimAutomation.ViCore.Util10.ZipHelper.UnzipAllContentsToFolder(String zipFileFullName,
                     String folderPath)
                       at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.IsValidUpdateArchive4
                    0(String archiveFullName)
                       at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.TryValidateUpdateLoca
                    tion40(String location, Boolean isLocalLocation)
                       at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.<>c__DisplayClass39.<
                    InstallVMHostPatchFromUserSystem40>b__37(ClientSideTask task, Object taskResult)
                       at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)
TargetSite        : Void CheckTaskCompletion(System.Collections.Generic.List`1[VMware.VimAutomation.Sdk.Interop.V1.Task
                    .TaskInterop], System.Collections.Generic.List`1[VMware.VimAutomation.Sdk.Interop.V1.Task.TaskInter
                    op] ByRef, VMware.VimAutomation.Sdk.Interop.V1.Task.ProgressCallback)
StackTrace        :    at VMware.VimAutomation.Sdk.Impl.V1.Task.ClientSideTaskCoreServiceProvider.CheckTaskCompletion(L
                    ist`1 remainingTaskList, List`1& completedTaskList, ProgressCallback progressCallback)
                       at VMware.VimAutomation.Sdk.Impl.V1.Task.CoreTaskServiceImpl.WaitForTask(IEnumerable`1 taskList,
                     ProgressCallback progressCallback)
HelpLink          :

Source            : VMware.VimAutomation.Sdk.Impl

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> $error[0].Exception.InnerException | select *


Message        : The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
FileName       :
FusionLog      :
Data           : {}
InnerException :
TargetSite     : Shell32.Folder NameSpace(System.Object)
StackTrace     :    at Shell32.ShellClass.NameSpace(Object vDir)
                    at VMware.VimAutomation.ViCore.Util10.ZipHelper.UnzipAllContentsToFolder(String zipFileFullName, St
                 ring folderPath)
                    at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.IsValidUpdateArchive40(S
                 tring archiveFullName)
                    at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.TryValidateUpdateLocatio
                 n40(String location, Boolean isLocalLocation)
                    at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.<>c__DisplayClass39.<Ins
                 tallVMHostPatchFromUserSystem40>b__37(ClientSideTask task, Object taskResult)
                    at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)
HelpLink       :
Source         : Interop.Shell32

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI>


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
iguy
Enthusiast
Enthusiast

PS > Install-VMHostPatch -VMHost "vmvspf0034" -HostUserName root -HostPassword $rootpw -LocalPath $patch
Install-VMHostPatch : 3/10/2011 1:53:18 PM    Install-VMHostPatch        Invalid patch archive: '[VERY LONG REMOVED]\Drivers for vSphere4\VersionSets\DL585G7-1.0\extracted\qlg-qlcnic-4.0.719-164009-offline_bundle-335251
\metadata.zip'.   
At line:1 char:20
+ Install-VMHostPatch <<<<  -VMHost "vmvspf0034" -HostUserName root -HostPassword $rootpw -LocalPath $patc
h
    + CategoryInfo          : InvalidArgument: ([VERY LONG REMOVED]...51\metadata.zip:String) [Install-VMHostPatch], VimEx
   ception
    + FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_TryValidateUpdateLocation40_InvalidArchive,VMware.V
   imAutomation.ViCore.Cmdlets.Commands.Host.InstallVMHostPatch

PS > $error[0].Exception | select *


ErrorId           : Client20_SystemManagementServiceImpl_TryValidateUpdateLocation40_InvalidArchive
ErrorCategory     : InvalidArgument
TargetObject      :[VERY LONG REMOVED]\Drivers for vSphere4\VersionSets\DL585G7-1.0\extracted\qlg-q
                    lcnic-4.0.719-164009-offline_bundle-335251\metadata.zip
RecommendedAction :
SessionId         :
ConnectionId      : /VIServer=iguy@vcenter:443/
Severity          : Error
Message           : 3/10/2011 1:53:18 PM    Install-VMHostPatch        Invalid patch archive: '[VERY LONG REMOVED]\Drivers for vSphere4\VersionSets\DL585G7-1.0\extracted\qlg-qlcnic-4.0.719-164009-off
                    line_bundle-335251\metadata.zip'.   
Data              : {ParameterValues}
InnerException    :
TargetSite        : Void TryValidateUpdateLocation40(System.String, Boolean)
StackTrace        :    at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.TryValidateUpdateLoca
                    tion40(String location, Boolean isLocalLocation)
                       at VMware.VimAutomation.ViCore.Impl.V1.Service.SystemManagementServiceImpl.<>c__DisplayClass39.<
                    InstallVMHostPatchFromUserSystem40>b__37(ClientSideTask task, Object taskResult)
HelpLink          :
Source            : VMware.VimAutomation.ViCore.Impl

PS > $error[0].Exception.InnerException | select *


Data cleaned for security (if need it let me know.. total length of path is 141+ characters if it matters)

Reply
0 Kudos