OSCustomization Category | Vmware PowerCLI Reference

OS Customization Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations

Step 1: Retrieve a object by running a Get command

You can READ objects by using Get-OSCustomizationNicMapping cmdlet. See example below:

# Retrieves the NIC mappings of the "test" and "test_old" OS customization specifications.

$spec1 = Get-OSCustomizationSpec "test" $spec2 = Get-OSCustomizationSpec "test_old" Get-OSCustomizationNicMapping -OSCustomizationSpec $spec1,$spec2

Step 2 : Run commands from the CRUD group

You can CREATE objects by using New-OSCustomizationNicMapping cmdlet. See example below:

# Creates a new NIC mapping for the OS customization spec stored in $spec.

New-OSCustomizationNicMapping -OSCustomizationSpec $spec -IpMode UseStaticIP -IPAddress 10.0.0.1 -SubnetMask 255.255.255.0 -DefaultGateway 10.0.0.253 -DnsServer 10.0.0.253
You can UPDATE objects by using Set-OSCustomizationNicMapping cmdlet. See example below:

# Modifies the IP address of the specified NIC mapping that uses static IP mode.

Get-OSCustomizationSpec Spec | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpAddress 10.0.0.2
You can REMOVE objects by using Remove-OSCustomizationNicMapping cmdlet. See example below:

# Removes the NIC mappings of the specified OS customization spec without asking for confirmation.

$nicMapping = Get-OSCustomization MyCustomizationSpec | Get-OSCustomizationNicMapping Remove-OSCustomizationNicMapping $nicMapping -Confirm:$false

Step 3: Explore More Related Commands:


Get-OSCustomizationSpec This cmdlet retrieves the OS customization specifications available on a vCenter Server system.
New-OSCustomizationSpec This cmdlet creates a new OS customization specification.
Remove-OSCustomizationSpec This cmdlet removes the specified OS customization specifications.
Set-OSCustomizationSpec This cmdlet modifies the specified OS customization specification.