< Back

Get-CustomAttribute

Sun Jan 19, 2020 6:49 pm

NAME Get-CustomAttribute



SYNOPSIS

This cmdlet retrieves custom attributes.





SYNTAX

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

[-Server <VIServer[]>] [<CommonParameters>]





DESCRIPTION

This cmdlet retrieves custom attributes. A custom attribute is a user-defined description field of one or more

vSphere objects.





PARAMETERS

-Global [<SwitchParameter>]

Indicates that only global custom attributes are retrieved. A global custom attribute can be applied both to

hosts and virtual machines.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Id <String[]>

Specifies the IDs of the custom attributes you want to retrieve.



Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that

matches exactly one of the string values in that list.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Name <String[]>

Specifies the names of the custom attributes you want to retrieve.



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Server <VIServer[]>

Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this

parameter, the command runs on the default servers. For more information about default servers, see the

description of Connect-VIServer.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-TargetType <CustomAttributeTargetType[]>

Specifies 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.



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Zero or more CustomAttribute objects







NOTES









-------------------------- 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.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... ibute.html

New-CustomAttribute

Remove-CustomAttribute

Set-CustomAttribute

Get-Annotation

Set-Annotation