操作流程
1、查看本机系统类型
在cmd或者powershell命令窗口输入msinfo32,按回车。
如下图所示,在弹出的窗口中可以看到系统类型:x64表示64位操作系统,x86表示32位操作系统。
2、 安装和验证VMware-PowerCLI-6.5.0。
VMware-PowerCLI-6.5.0依赖.NET Framework 4.6.2和PowerShell 4.0软件包,因此需要先安装这两个软件包,再安装VMware-PowerCLI-6.5.0。
a. 安装.NET Framework 4.6.2。
i.下载.NET Framework 4.6.2(推荐IE或者谷歌浏览器):
https:/www.microsoft.com/en-us/download/
ii.点击Download下载NDP462-KB3151800-x86-x64-AllOS-ENU.exe。
b. 安装PowerShell 4.0。
i.Powershell 4.0的下载链接如下:
https:/www.microsoft.com/en-us/download/
ii. 双击NDP462-KB3151800-x86-x64-AllOS-ENU.exe,按照默认选项安装.NET Framework 4.6.2。
c. 安装VMware-PowerCLI-6.5.0。
下载VMware-PowerCLI-6.5.0:
https:/my.vmware.com/group/vmware/
d. 验证VMware-PowerCLI-6.5.0安装。
i. 在桌面右键点击VMware PowerCLI选择以管理员身份运行,弹出下图的窗口。
无法启动CLI的解决办法:
执行:get-executionpolicy 命令查看 策略
PS C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-executionpolicy
Restricted
显示为: Restricted 该策略不允许任何脚本运行
执行: set-executionpolicy remotesigned 修改执行策略
PS C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> set-executionpolicy remotesigned
执行策略更改
ii. 按“Enter”后进入VMware PowerCLI命令行,如下图所示,VMware-PowerCLI 6.5.0安装成功。
- 定制VMware ESXi ISO镜像。
定制VMware ESXi ISO镜像需要使用 vSphere ESXi Image Builder CLI,这个工具已经包含在VMware PowerCLI 6.5.0里。关于定制VMware ESXi ISO镜像有如下几个概念:
• Software Depot:软件仓库,它的作用是打包和分发VIB软件包。Software Depot有online和offline两种形式,其中online depot是可通过远程在线访问的,使用的是http/https协议,而offline depot是已经下载到本地的zip包。
• Image Profile:Image Profile是一个包含VMware和第三方VIB驱动的逻辑集合。通过vSphere ESXi Image Builder CLI创建,可以保存为zip压缩包或者ISO镜像文件。
c. 下载Software Depots。
下载VMware Software Depot,这个Depot包含VMware提供的ESXi VIBS。访问如下网址,先选择ESXi版本。
https:/my.vmware.com/en/group/vmware/info?slug=datacenter_cloud_infrastructure/vmware_vsphere/
i. 以ESXi6.5版本为例,如图点击“Go to download”,下载企业版“VMware vSphere Hypervisor”。
i. 以ESXi6.5版本为例,如图点击“Go to download”,下载企业版“VMware vSphere Hypervisor”。
i. 以ESXi6.5版本为例,如图点击“Go to download”,下载企业版“VMware vSphere Hypervisor”。
ii. 如图选择具体的ESXi版本,此处以EXSi6.5U1为例。
iii. 如图选择下载“XX (ESXi) Offline Bundle”。
iv. 从iDriver下载VMware Offline驱动包。
http://support.huawei.com/enterprise/en/server/fusionserver-idriver-pid-21588909/software
说明:
• 通过iDriver Release Notes文档查询iDriver是否兼容服务器,如不兼容,请从产品下软件下载Vmware驱动包。
http://support.huawei.com/enterprise/en/server/fusionserver-idriver-pid-21588909/software
• VMware6.0.x驱动归一,VMware6.5.x驱动归一。
d. 导入Software Depots。
在VMware PowerCLI命令行,使用Add-EsxSoftwareDepot指定文件路径导入Software Depots。例如:Add-EsxSoftwareDepo D:\vmware\depot\update\xxxx.zip
说明:
此处以Intel i40e和Avago驱动为例进行说明,其他驱动方法相同。
e. 创建一个Image Profile。
i. 查看VMware Software Depot里面包含有哪些Image Profile,选择standard版本的Image Profile来创建。
查看命令:
Get-EsxImageProfile | Select Name
ii. 使用New-EsxImageProfile命令创建一个Image Profile,此处是用克隆Image Profile的方式来创建。
iii. PowerCLI C:> New-EsxImageProfile -CloneProfile ESXi-6.5.0-20170702001-stand
-Name HuaweiCustomProfile -Vendor Huawei -AcceptanceLevel PartnerSupported
f. 增加VIB。
可以使用Add-EsxSoftwarePackage从3.c创建的HuaweiCustomProfile增加VIB。
备注(华为服务器一般是导入NIC-X722驱动)
i. 执行如下命令查看VIB。
ii. 通过厂商名字过滤。
例如:过滤 “INT”,“Avago”
iii. PowerCLI C:> Get-EsxSoftwarePackage | where {KaTeX parse error: Expected 'EOF', got '}' at position 19: …endor -eq "INT"}̲
PowerCLI C:\>…_.Vendor -eq “Avago”}
iv. 将其加入到HuaweiCustomProfile,添加多个VIB则以逗号分隔。
PowerCLI C:> Add-EsxSoftwarePackage –ImageProfile HuaweiCustomProfile –SoftwarePackage net-i40e,lsi-mr3
g. 保存Image Profile。
导出Image Profile,导出的格式可以是zip包(作为一个Software Depot)或者ISO文件(可以用于安装)。
此处导出为ISO文件(确保已存在保存文件的路径)。
PowerCLI C:> Export-EsxImageProfile -ImageProfile HuaweiCustomProfile -ExportTo
Iso -FilePath D:\customimage\Esxi_6_5_1CustomImage.iso
在FilePath指定的路径将会看到定制的ISO镜像已经生成,此镜像可用于在主机上安装VMware ESXi系统。完成后查看属性大小是否符合iOS大小。