当前位置:网站首页>Use powercli to create a custom esxi ISO image
Use powercli to create a custom esxi ISO image
2022-07-28 06:59:00 【yqowen】
Before we packaged ESXi ISO Most images use GitHub - VFrontDe/ESXi-Customizer-PS: PowerCLI script that greatly simplifies and automates the process of creating fully patched and customized VMware ESXi installation images Of this project powershell Script , Drive some community versions ( For example, the network card driver ,USB Network card driver, etc ) Encapsulate into ESXi ISO, In this way, the corresponding hardware can be directly identified during installation .
In fact, the above script is based on VMware.PowerCLI To achieve .PowerCLI yes VMware A very powerful Powershell The command library , There are almost 700 cmdlets Can be used to manage and automate VMware A lot of products ( such as vSphere, vCloud Director, vRealize Operations Manager, vSAN, NSX-T, VMware Cloud Services, VMware Cloud on AWS, VMware HCX, VMware Site Recovery Manager, and VMware Horizon environments). and PowerCLI 12.0.0 Version update in , About ISO Mirror image , It is described as follows :
New cmdlets for managing auto-bootstrapping and new-style depots in vSphere 7.0 have been added to theVMware.DeployAutomationandVMware.ImageBuildermodule:
New/Set/Reset-LCMClusterRuleWithTransform
Get-DepotAddons
Get-DepotBaseImages
Get-DepotComponents
Get-DepotInfo
Get-DepotVibs
New-IsoImage
New-PxeImage
We noticed that it mentioned joining New-IsoImage( adopt VMware.ImageBuildermodule).
Query related documents ,New-IsoImage Command | VMware PowerCLI Reference and Create a Custom ESXi ISO Image with PowerCLI Cmdlets (vmware.com) There are very detailed methods of use .
And then we have Windows 11 (Windows 10 Empathy ) Configure the environment under the environment to learn the usage .
1. “ Run as administrator ” Windows Powershell perhaps Windows Terminal.
2. Install-Module -Name VMware.PowerCLI If you are prompted whether to install NuGet And whether to start from "PSGallery" Please select “ yes ”,“ Is full of ”. Depending on the network , This installation process may take several minutes .
3. Set up Execution policy, Windows Execution of such third-party scripts is not allowed by default Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine For specific usage, please refer to Set-ExecutionPolicy (Microsoft.PowerShell.Security) - PowerShell | Microsoft Docs
4. Import-Module VMware.ImageBuilder
5. So let's use VMwre The official online repo To see what Image profile
Get-DepotBaseImages -Depot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
The query takes dozens of seconds :
Version Vendor Release date
------- ------ ------------
7.0.0-1.25.16324942 VMware, Inc. 06/15/2020 23:00:00
7.0.0-1.20.16321839 VMware, Inc. 06/15/2020 23:00:00
7.0.0-1.0.15843807 VMware, Inc. 03/16/2020 08:40:41
7.0.1-0.35.19324898 VMware, Inc. 02/14/2022 23:00:00
7.0.1-0.15.17168206 VMware, Inc. 11/18/2020 23:00:00
7.0.1-0.10.17119627 VMware, Inc. 11/03/2020 23:00:00
7.0.1-0.25.17325551 VMware, Inc. 12/16/2020 23:00:00
7.0.1-0.20.17325020 VMware, Inc. 12/16/2020 23:00:00
7.0.1-0.30.17551050 VMware, Inc. 02/03/2021 23:00:00
7.0.1-0.0.16850804 VMware, Inc. 09/04/2020 16:33:22
7.0.2-0.0.17867351 VMware, Inc. 04/28/2021 23:00:00
7.0.2-0.15.18295176 VMware, Inc. 08/23/2021 23:00:00
7.0.2-0.20.18426014 VMware, Inc. 08/23/2021 23:00:00
7.0.2-0.25.18538813 VMware, Inc. 09/13/2021 23:00:00
7.0.2-0.30.19290878 VMware, Inc. 02/14/2022 23:00:00
7.0.3-0.20.19193900 VMware, Inc. 01/17/2022 23:00:00
7.0.3-0.30.19482531 VMware, Inc. 03/28/2022 23:00:00
7.0.3-0.35.19482537 VMware, Inc. 03/28/2022 23:00:00
Actually -Depot This parameter can also point to a local offline package ( Not ISO), such as :
Get-DepotBaseImages -Depot C:\CustomImage\VMware-ESXi-7.0U3c-19193900-depot.zip
Version Vendor Release date
------- ------ ------------
7.0.3-0.20.19193900 VMware, Inc. 01/17/2022 23:00:00
Similar to that Get-DepotAddons and Get-DepotComponents
For example, you can query the community version network card driver package :
Get-DepotComponents -Depot C:\CustomImage\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip

6. Next, create a custom image Spec (json Format ):
{
"base_image": {
"version": "7.0.3-0.35.19482537"
},
"components": {
"Net-Community-Driver": "1.2.7.0-1vmw.700.1.0.15843807"
}
}
7. Use the offline package found above , Driver files and spec File to create a custom image :
New-IsoImage -Depots "c:\CustomImage\VMware-ESXi-7.0U3c-19193900-depot.zip" , "c:\CustomImage\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip" -SoftwareSpec "c:\CustomImage\spec.json" -Destination "c:\CustomImage\ESXi-70U3c-custom.iso"
PS: This method attempts to encapsulate USB NIC Flings When an error , It is a small driver bug, It is estimated that it will be repaired later .
New-IsoImage : Error retrieving file for VIB 'VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.703.0.15.51233328':
("<zipfile.ZipExtFile name='vib20/vmkusb-nic-fling/VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.703.0.15.51233328.vib'
mode='r' compress_type=deflate>", "Error opening file object for VIB
'VMW_bootbank_vmkusb-nic-fling_1.8-3vmw.703.0.15.51233328': Expected value '[]' for attribute 'swplatforms', but found
value '[<vmware.esximage.Vib.SoftwarePlatform object at 0x0000015A1ECEBB08>]'.").
边栏推荐
猜你喜欢

Custom components -- slots

技术分享 | 接口测试常用代理工具

Cocos2d-x learning notes Tile Map tiledmap

How to calculate the size of structure, segment and Consortium (common body)

修复故障扇区

LNMP搭建过程详解

What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying

FTP服务

Principle and configuration of NAT and pat

1、 PXE overview and installation
随机推荐
---栈&队列---
Difference between process and thread
DHCP原理与配置
What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset
JS four operations are repackaged to solve the problem of precision loss
Ten thousand words summarize and realize the commonly used sorting and performance comparison
VMware Workstation 配置net模式
Technology sharing | interface testing value and system
DHCP principle and configuration
HDU-1159-CommonSubsequence(LCS最长公共子序列)
cocos2d-x 学习笔记——瓦片地图TiledMap
Common models in software development
Iptables firewall
Installation and configuration of unit test framework jest with typescript
Hdu-2036-reform spring breeze blowing all over the ground (polygon area template)
Life cycle (process) of software testing
Lancher deployment practice
Qgraphicsview promoted to qchartview
技术分享 | 使用postman发送请求
How to describe a bug and the definition and life cycle of bug level