Skip to content

Commit 8820096

Browse files
author
William Lam
committed
Script to create custom ESXi ISO w/o vCenter
1 parent 2aba593 commit 8820096

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

powershell/create_custom_esxi_iso.ps1

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Author: William Lam
2+
# Website: www.williamlam.com
3+
4+
# Path to ESXi Base Offline Image
5+
$ESXIBaseImagePath = "C:\Users\william\Desktop\custom-esxi-image\VMware-ESXi-7.0U3c-19193900-depot.zip"
6+
7+
# List of ESXi Offline Bundle Paths
8+
$ESXIDriverPaths = @(
9+
"C:\Users\william\Desktop\custom-esxi-image\Net-Community-Driver_1.2.2.0-1vmw.700.1.0.15843807_18835109.zip",
10+
"C:\Users\william\Desktop\custom-esxi-image\nvme-community-driver_1.0.1.0-3vmw.700.1.0.15843807-component-18902434.zip"
11+
)
12+
13+
$ESXICustomIsoSpec = "C:\Users\william\Desktop\custom-esxi-image\spec.json"
14+
15+
$ESXICustomIsoPath = "C:\Users\william\Desktop\custom-esxi-image\custom.iso"
16+
17+
##### DO NOT EDIT BEYOND HERE #####
18+
19+
if($PSVersionTable.PSEdition -ne "Desktop") {
20+
Write-Error "This script is only supported with PowerShell on Windows`n"
21+
exit
22+
}
23+
24+
Write-Host -Foreground cyan "Processing ESXi Base Image $ESXIDriver ..."
25+
$ESXIBaseImageVersion = (Get-DepotBaseImages -Depot $ESXIBaseImagePath).Version
26+
27+
# Build list of Components from ESXi Drivers
28+
$components = @{}
29+
foreach ($ESXIDriver in $ESXIDriverPaths) {
30+
Write-Host -Foreground cyan "Processing ESXi Driver $ESXIDriver ..."
31+
$component = (Get-DepotComponents -Depot $ESXIDriver) | Select Name, Version
32+
$components.Add(${component}.name,${component}.version)
33+
}
34+
35+
# Create Software Spec
36+
$spec = [ordered] @{
37+
base_image = @{
38+
version = $ESXIBaseImageVersion
39+
}
40+
components = $components
41+
}
42+
$spec | ConvertTo-Json | Set-Content -NoNewline -Path $ESXICustomIsoSpec
43+
44+
# Build Depo List
45+
$ESXIDepots = '"' + $(($ESXIDriverPaths+=$ESXIBaseImagePath) -join '","') + '"'
46+
47+
# Create New Custom ISO
48+
Write-Host -Foreground green "`nCreating Custom ESXi ISO and saving to ${ESXICustomIsoPath} ...`n"
49+
Invoke-Expression "New-IsoImage -Depots $ESXIDepots -SoftwareSpec $ESXICustomIsoSpec -Destination $ESXICustomIsoPath"

0 commit comments

Comments
 (0)