vmware-scripts icon indicating copy to clipboard operation
vmware-scripts copied to clipboard

create_custom_esxi_iso.ps1: Pick the first version available

Open jthat opened this issue 3 years ago • 0 comments

Potential solution for #117.

Test output difference:

 PS C:\users\jason\desktop\custom-esxi-image> .\create_custom_esxi_iso.ps1
 Processing ESXi Base Image C:\Users\jason\Desktop\custom-esxi-image\VMware-ESXi-7.0U3d-19482537-depot.zip ...
 Processing ESXi Driver C:\Users\jason\Desktop\custom-esxi-image\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip ...
 Processing ESXi Driver C:\Users\jason\Desktop\custom-esxi-image\nvme-community-driver_1.0.1.0-3vmw.700.1.0.15843807-component-18902434.zip ...
 
 Creating Custom ESXi ISO and saving to "C:\Users\jason\Desktop\custom-esxi-image\custom.iso" ...
 
-New-IsoImage : The base image with version ['7.0.3-0.35.19482537', '7.0.3-0.30.19482531'] not found
-At line:1 char:1
-+ New-IsoImage -Depots "C:\Users\jason\Desktop\custom-esxi-image\Net-Co ...
-+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    + CategoryInfo          : NotSpecified: (:) [New-IsoImage], SoapException
-    + FullyQualifiedErrorId : System.Web.Services.Protocols.SoapException,VMware.ImageBuilder.Commands.NewIsoImage
- 
 PS C:\users\jason\desktop\custom-esxi-image> ls custom.iso
-ls : Cannot find path 'C:\users\jason\desktop\custom-esxi-image\custom.iso' because it does not exist.
-At line:1 char:1
-+ ls custom.iso
-+ ~~~~~~~~~~~~~
-    + CategoryInfo          : ObjectNotFound: (C:\users\jason\...mage\custom.iso:String) [Get-ChildItem], ItemNotFound
-   Exception
-    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
+
+
+    Directory: C:\users\jason\desktop\custom-esxi-image
+
+
+Mode                 LastWriteTime         Length Name
+----                 -------------         ------ ----
+-a----        24/05/2022   9:48 AM      415051776 custom.iso
 
 PS C:\users\jason\desktop\custom-esxi-image>

I've also tested this continues to work in the case when there is a single version (e.g. 7.0U3c):

PS C:\users\jason\desktop\custom-esxi-image> .\create_custom_esxi_iso.ps1
Processing ESXi Base Image C:\Users\jason\Desktop\custom-esxi-image\VMware-ESXi-7.0U3c-19193900-depot.zip ...
Processing ESXi Driver C:\Users\jason\Desktop\custom-esxi-image\Net-Community-Driver_1.2.7.0-1vmw.700.1.0.15843807_19480755.zip ...
Processing ESXi Driver C:\Users\jason\Desktop\custom-esxi-image\nvme-community-driver_1.0.1.0-3vmw.700.1.0.15843807-component-18902434.zip ...

Creating Custom ESXi ISO and saving to "C:\Users\jason\Desktop\custom-esxi-image\custom.iso" ...

PS C:\users\jason\desktop\custom-esxi-image> ls custom.iso


    Directory: C:\users\jason\desktop\custom-esxi-image


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        24/05/2022   9:39 AM      414857216 custom.iso


PS C:\users\jason\desktop\custom-esxi-image>

jthat avatar May 23 '22 23:05 jthat