You can create a custom image by cloning and editing an image profile by using PowerCLI.
Prerequisites
You can create a custom image by cloning and editing an image profile by using
PowerCLI. You can add or remove one or more VIBs in the existing profile. If adding or removing VIBs prevents the image profile from working correctly, an error occurs.
- PowerCLI and prerequisite software is installed. See Configure vSphere ESXi Image Builder.
- You have access to a depot that includes a base image and one or more VIBs. VMware and VMware partners make public depots, accessible by a URL, available. VMware or VMware partners can create a ZIP file that you can download to your local environment and access by using a file path.
Procedure
- In a PowerCLI session, run the Add-EsxSoftwareDepot cmdlet for each depot you want to work with.
Option |
Action |
Remote depot |
Run Add-EsxSoftwareDepot -DepotUrl <depot_url> . |
ZIP file |
- Download the ZIP file to a local file system.
- Run
Add-EsxSoftwareDepot -DepotUrl C:\<file_path>\<offline-bundle>.zip
|
The cmdlet returns one or more
SoftwareDepot objects.
- Use a pipeline to pass the image profile you intend to edit to format-list to see detailed information.
In this example, the image profile created in
Create New Image Profiles Workflow contains only the base image. A newly created image profile is not included in the depot. Instead, you access the image profile by name or by binding it to a variable.
Get-EsxImageProfile "Test #2" | format-list
PowerShell returns the information.
Name : Test #2
Vendor : Vendor42
...
VibList : {esx-base 5.0.0.-...,}
- (Optional) If you are adding a VIB with a lower acceptance level than that of the image profile, change the acceptance level of the image profile.
Set-EsxImageProfile -ImageProfile "Test #2" -AcceptanceLevel VMwareAccepted
PowerShell returns the information about the changed profile in tabular format.
Name Vendor Last Modified Acceptance Level
---- ------ ------------- ----------------
Test #2 Vendor42 9/22/2010 12:05:... VMwareAccepted
- Add a software package (VIB) to the image profile. You can add the package by name.
Add-EsxSoftwarePackage -ImageProfile "Test #2"
-SoftwarePackage NewPack3
PowerShell returns the information about the image profile in tabular format.
Name Vendor Last Modified Acceptance Level
---- ------ ------------- ----------------
Test #2 Vendor42 9/22/2010 12:05:... VMwareAccepted
- View the image profile again.
Get-EsxImageProfile "Test #2" | format-list
The VIB list is updated to include the new software package and the information is displayed.
Name : Test #2
Vendor : Vendor42
...
VibList : {esx-base 5.0.0.-..., NewPack3}
Example: Editing Image Profiles by Using Variables
This cmdlet sequence repeats the steps of the workflow but passes parameters as objects, accessed by position in a variable, instead of passing parameters by name. You can run the following cmdlets in sequence from the PowerCLI prompt.
Add-EsxSoftwareDepot -DepotUrl depot_url
$ip2 = Get-EsxImageProfile -name "Test #2"
$ip2 | format-list
Set-EsxImageProfile -ImageProfile $ip2 -AcceptanceLevel VMwareAccepted
Add-EsxImageSoftwarePackage -ImageProfile $ip2 -SoftwarePackage NewPack3
$ip2 | format-list