Image Builder cmdlets are implemented as Microsoft PowerShell cmdlets and included in VMware PowerCLI. Users of Image Builder cmdlets can take advantage of all PowerCLI features.

Experienced PowerShell users can use Image Builder cmdlets just like other PowerShell cmdlets. If you are new to PowerShell and PowerCLI, the following tips help you come up to speed.

You can type cmdlets, parameters, and parameter values in the PowerCLI shell.

  • Get help for any cmdlet by running Get-Help cmdlet_name.

  • Remember that PowerShell is not case sensitive.

  • Use tab completion for cmdlet names and parameter names.

  • Format any variable and cmdlet output by using Format-List or Format-Table or their short forms fl or ft. See Get-Help Format-List.

Passing Parameters by Name

You can pass in parameters by name in most cases and surround parameter values that contain spaces or special characters with double quotes.

Add-EsxSoftwarePackage -ImageProfile profile42 -SoftwarePackage "partner package 35"

Passing Parameters as Objects

You can pass parameters as objects if you want to do scripting and automation. You can use the technique with cmdlets that return multiple objects or with cmdlets that return a single object.

  1. Bind the output of a cmdlet that returns multiple objects to a variable.

    $profs = Get-EsxImageProfile

  2. When you run the cmdlet that needs the object as input, access the object by position, with the list starting with 0.

    Add-EsxSoftwarePackage -ImageProfile $profs[4] -SoftwarePackage partner-pkg

The example adds the specified software package to the fifth image profile in the list returned by Get-EsxImageProfile.

Most examples in the documentation pass in parameters by name. Image Builder Workflows includes examples that pass parameters as objects.

Setting Properties to Support Remote Signing

For security reasons, Windows PowerShell supports an execution policy feature. It determines whether scripts are allowed to run and whether they must be digitally signed. By default, the execution policy is set to Restricted, which is the most secure policy. If you want to run scripts or load configuration files, you can change the execution policy by using the Set-ExecutionPolicy cmdlet. To do this, type the following in the vSphere PowerCLI console window.

Set-ExecutionPolicy RemoteSigned

If the command is successful, you can run scripts and load configuration files. For more information about the execution policy and digital signing in Windows PowerShell, use the following cmdlet.

Get-Help About_Signing