CustomAttribute Category | Vmware PowerCLI Reference

Custom Attribute 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-CustomAttribute cmdlet. See example below:

# Retrieves all global custom attributes.

Get-CustomAttribute -Global

Step 2 : Run commands from the CRUD group

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

# Creates a new custom attribute named CompanyName for the virtual machines and hosts on the server.

New-CustomAttribute -Name "CompanyName" -TargetType VMHost, VirtualMachine
You can UPDATE objects by using Set-CustomAttribute cmdlet. See example below:

# Renames a custom attribute from CreationDate to CreationDetails.

Set-CustomAttribute -Name CreationDetails -CustomAttribute CreationDate
You can REMOVE objects by using Remove-CustomAttribute cmdlet. See example below:

# Removes the CompanyID and Owner custom attributes from the server stored in the $agent007 variable.

Remove-CustomAttribute -CustomAttribute "CompanyID", "Owner" -Server $agent007