使用VMware PowerCLI给ESXi 7.0以上版本官方安装包添加community板载网卡、usb网卡驱动
1. 安装VMware PowerCLI
- 下载VMware PowerCLI离线安装包(已经包含所需依赖)
- 将zip包解压到
C:\Program Files\WindowsPowerShell\Modules
文件夹 - 在
C:\Program Files\WindowsPowerShell\Modules
目录下,shift+右键,打开powershell - 在powershell中执行下面命令,解除文件限制
Get-ChildItem * -Recurse | Unblock-File
- 右键左下角windows微标,以管理员身份运行powershell,在新打开的powershell执行命令
Set-ExecutionPolicy RemoteSigned
- 执行下面命令查看安装是否成功,不报错就是安装成功了
Import-Module VMware.ImageBuilder
ESXi和PowerCLI都经常小版本更新,在制作iso的过程中两者版本必须对应,可以到这里找到最新的PowerCLI离线安装包
2. 下载ESXi和Community驱动
- 首先你需要注册一个VMware账户
- 打开产品下载页面,找到VMware vSphere Hypervisor (ESXi),点击Download Trial
- 在新弹出来的页面,选择VMware vSphere Hypervisor (ESXi) Offline Bundle下载,注意不是下载ISO
- 到这里下载Community Networking Driver for ESXi
- 到这里下载USB Network Native Driver for ESXi
- 将下载好的文件复制到一个文件夹放好
3. 打包ISO文件
3.1 手动生成
- 进入存放下载文件的文件夹,shift+右键打开powershell
- 执行下面命令,注意根据自己下载的压缩包的文件名修改下面
Add-EsxSoftwareDepot
命令后面的文件名
Add-EsxSoftwareDepot .\VMware-ESXi-7.0U3f-20036589-depot.zip
Add-EsxSoftwareDepot .\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip
Add-EsxSoftwareDepot .\nvme-community-driver_1.0.1.0-3vmw.700.1.0.15843807-component-18902434.zip
- 运行下面命令,找到目前版本对应的profile
Get-EsxImageProfile
- 复制包含standard的profile名称,如我这里是
ESXi-7.0U3f-20036589-standard
- 运行命令创建自定义profile,注意
-CloneProfile "ESXi-7.0U3f-20036589-standard"
需要修改成上面复制的名称,-name后面跟的为创建的新profile的名子
New-EsxImageProfile -CloneProfile "ESXi-7.0U3f-20036589-standard" -name "ESXi-7.0U3f-20220809-standard-pkernel" -Vendor "pkernel.com"
- 添加驱动包到上面创建的profile
Add-EsxSoftwarePackage -ImageProfile "ESXi-7.0U3f-20220809-standard-pkernel" -SoftwarePackage "net-community"
Add-EsxSoftwarePackage -ImageProfile "ESXi-7.0U3f-20220809-standard-pkernel" -SoftwarePackage "nvme-community"
- 输出ISO包
Export-ESXImageProfile -ImageProfile "ESXi-7.0U3f-20220809-standard-pkernel" -ExportToISO -filepath ESXi-7.0U3f-20220809-standard-pkernel.iso
如果想删除profile可以用
Remove-EsxImageProfile
命令
如果要删除包可以用Remove-EsxSoftwarePackage
3.2 自动生成ISO
- 解压文件
create_custom_esxi_iso.zip -
修改路径
– ESXIBaseImagePath: 原版的压缩包路径
– ESXIDriverPaths: 需要合并的驱动包路径
– ESXICustomIsoSpec:自动生成的配置文件保存路径
– ESXICustomIsoPath:生成的定制ISO文件路径
- 在powershell内运行
PS E:\test_esxi> .\create_custom_esxi_iso.ps1
Processing ESXi Base Image ...
Processing ESXi Driver E:\test_esxi\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip ...
Processing ESXi Driver E:\test_esxi\nvme-community-driver_1.0.1.0-3vmw.700.1.0.15843807-component-18902434.zip ...
Creating Custom ESXi ISO and saving to "E:\test_esxi\custom.iso" ...