Skip to content

Instantly share code, notes, and snippets.

@Niktendo
Last active February 11, 2026 14:12
Show Gist options
  • Select an option

  • Save Niktendo/11a478e3cd44c4d48df1b26d7543c84e to your computer and use it in GitHub Desktop.

Select an option

Save Niktendo/11a478e3cd44c4d48df1b26d7543c84e to your computer and use it in GitHub Desktop.
Custom ISO for integrating custom flings into vSphere image
Param(
[string]$ESXIBaseImagePath,
[string[]]$ESXIDriverPaths
)
$CurrentDir = Get-Location
##### DO NOT EDIT BEYOND HERE #####
if((Get-PowerCLIVersion).Major -lt "9") {
Write-Error "This script requires VCF.PowerCLI 9.x or greater`n"
exit
}
Write-Host -Foreground cyan "Processing ESXi Base Image..."
$ESXIBaseImageVersion = (Get-DepotBaseImages -Depot $ESXIBaseImagePath).Version
$ESXICustomIsoSpec = Join-Path -Path $CurrentDir -ChildPath "esx-$ESXIBaseImageVersion-realtek.spec"
$ESXICustomIsoPath = Join-Path -Path $CurrentDir -ChildPath "esx-$ESXIBaseImageVersion-realtek.iso"
$components = [ordered]@{}
foreach ($ESXIDriver in $ESXIDriverPaths) {
Write-Host -Foreground cyan "Processing ESXi Driver $ESXIDriver ..."
$driverComponents = Get-DepotComponents -Depot $ESXIDriver
foreach ($comp in $driverComponents) {
$components[$comp.Name] = $comp.Version
}
}
$spec = [ordered] @{
base_image = @{
version = $ESXIBaseImageVersion
}
components = $components
}
$spec | ConvertTo-Json -Depth 10 | Set-Content -NoNewline -Path $ESXICustomIsoSpec
$AllDepots = $ESXIDriverPaths + $ESXIBaseImagePath
Write-Host -Foreground green "`nCreating Custom ESXi ISO and saving to ${ESXICustomIsoPath} ...`n"
New-IsoImage -Depots $AllDepots -SoftwareSpec $ESXICustomIsoSpec -Destination $ESXICustomIsoPath
@Niktendo
Copy link
Author

Niktendo commented Jan 20, 2026

py install 3.7
python3 -m pip install --upgrade pip
python3 -m pip install six psutil lxml pyopenssl --upgrade
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false
Set-PowerCLIConfiguration -PythonPath C:\Users\NiklasJeske\AppData\Local\Python\bin\python3.7.exe
Add-EsxSoftwareDepot "C:\Users\NiklasJeske\Downloads\VMware-ESXi-9.0.1.0.24957456-depot.zip"
Get-EsxImageProfile
Export-ESXImageProfile -ImageProfile $newProfile -ExportToIso -filepath "VMware-ESXi-9.0.1.0.24957456-depot.iso" -Force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment