PowerCLI导出ESXi镜像配置文件为ISO报错及解决咨询
问题分析
你遇到的错误核心是VIB文件VMW_bootbank_shim-vmklinux-9-2-3-0_6.5.0-0.0.4564106.vib无法以流模式打开,报错'_SharedFile' object has no attribute 'writing',这大概率是PowerCLI版本与ESXi 6.5的Image Builder组件不兼容,或是VIB引用/读取时的异常导致的。
解决步骤
- 匹配PowerCLI与ESXi版本:ESXi 6.5不要用过高版本的PowerCLI(比如10.x及以上),建议用6.5.x或6.7.x版本。执行以下命令重装对应版本:
# 卸载现有PowerCLI模块 Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force # 安装ESXi 6.5兼容的PowerCLI版本(以6.5.4为例) Install-Module VMware.PowerCLI -RequiredVersion 6.5.4.7155375 -Force - 重建镜像配置并验证VIB:
- 先删除现有出问题的镜像配置:
Remove-EsxImageProfile -ImageProfile Community -Force - 重新添加官方depot、克隆基础镜像、添加VIB,最后验证VIB状态:
# 添加官方ESXi depot Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml # 克隆官方基础镜像 New-EsxImageProfile -CloneProfile "ESXi-6.5.0-20170104001-standard" -Name "Community" # 添加shim-vmklinux组件 Add-EsxSoftwarePackage -ImageProfile Community -SoftwarePackage shim-vmklinux # 验证VIB是否正常加载 Get-EsxImageProfile -Name Community | Select-Object -ExpandProperty VibList | Where-Object {$_.Name -eq "shim-vmklinux"}
- 先删除现有出问题的镜像配置:
- 改用本地绝对路径导出:避免使用相对路径或带特殊字符的路径,换成本地磁盘的绝对路径,比如:
Export-EsxImageProfile -ImageProfile Community -ExportToIso -FilePath "C:\Temp\ESXi-6.5-Custom_r8168_al.iso" -NoSignatureCheck -Force - 手动添加本地VIB文件:如果上述步骤仍报错,直接下载对应版本的shim-vmklinux VIB到本地,添加为本地depot后再尝试:
# 添加本地VIB文件作为depot Add-EsxSoftwareDepot "C:\Downloads\shim-vmklinux-9-2-3-0_6.5.0-0.0.4564106.vib" # 再次添加到镜像配置 Add-EsxSoftwarePackage -ImageProfile Community -SoftwarePackage shim-vmklinux
内容的提问来源于stack exchange,提问作者bartekjan
相关产品推荐
相关产品推荐

