vSphere PowerCLI Reference

Get-CustomAttribute

Synopsis

Retrieves custom attributes.

Syntax

Get-CustomAttribute [-Id <String[]>] [[-Name] <String[]>] [[-TargetType] <CustomAttributeTargetType[]>] [-Global] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
New-CustomAttribute
Remove-CustomAttribute
Set-CustomAttribute
Get-Annotation
Set-Annotation

Detailed Description

Retrieves custom attributes. A custom attribute is a user-defined description field of one or more vSphere objects.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameString[]Specify the names of the custom attributes you want to retrieve.falsefalse
TargetTypeCustomAttributeTargetType[]Specify a target type to filter the custom attributes by the type of objects to which they can be applied. The valid values are VirtualMachine, ResourcePool, Folder, VMHost, Cluster, Datacenter, and $null. If the value is $null the custom attribute is global and applies to all target types.falsefalse
GlobalSwitchParameterIndicates that only global custom attributes are retrieved. A global custom attribute can be applied both to hosts and virtual machines.falsefalse
IdString[]Specify the Ids of the custom attributes you want to retrieve.falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse

Return Type

CustomAttribute[]

Notes

Examples

-------------- Example 1 --------------

Get-CustomAttribute -Global

Retrieves all global custom attributes.

-------------- Example 2 --------------

Get-CustomAttribute -TargetType "VirtualMachine", "VMHost"

Retrieves all custom attributes of type VirtualMachine and VMHost.

-------------- Example 3 --------------

Get-CustomAttribute -Name "Creation*" -Global

Retrieves only global custom attributes that match the specified name pattern.


Copyright © 1998 - 2012 VMware, Inc. All rights reserved.