< Back

Set-VsphereCustomAttribute

Sat Jan 18, 2020 9:38 am

NAME Set-VsphereCustomAttribute



SYNOPSIS

Sets a custom attribute from a VM or host.





SYNTAX

Set-VsphereCustomAttribute -VsphereObjectId <String[]> -AttributeType {Global | Host | VM} -Name <String> -Value

<String> [-DontCreate <SwitchParameter>] -Connection <Hashtable> [<CommonParameters>]



Set-VsphereCustomAttribute -InputObject <PSObject[]> -AttributeType {Global | Host | VM} -Name <String> -Value

<String> [-DontCreate <SwitchParameter>] -Connection <Hashtable> [<CommonParameters>]





DESCRIPTION

Sets a custom attribute from a VM or host.





PARAMETERS

-VsphereObjectId <String[]>

ID (managed object reference) of the VM or host for which custom attribute is to be set.



Required? true

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-AttributeType <String>

Specifies the custom attribute type. Accepted values are:

Global - can be set for any object type.

Host - can be set for hosts.

VM - can be set for VMs.



Required? true

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the name for the custom attribute that is to be set. If an attribute with the specified name does

not exist, by default the attribute is created.



Required? true

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Value <String>

Specifies the value of the custom attribute.



Required? true

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-DontCreate [<SwitchParameter>]

Specifies that the attribute should not be created if it doesn????????t exist. In this case, the command will fail.

By default, if an attribute does not exist, it will be created.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Connection <Hashtable>

Specifies connection information to the vCenter server. For example:

@{ServerUrl='<vCenter Server URL>';User='<user>';Password='<password>';LicenseKey=<license

key>;SkipCertificateValidation=$false}



Required? true

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <PSObject[]>

Object representing the VM or host for which custom attribute is to be set. Use Get-VsphereObject to retrieve

input object.



Required? true

Position? named

Default value

Accept pipeline input? True (ByValue)

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

System.Management.Automation.PSObject[]







OUTPUTS

System.Int32

Attribute key for the custom attribute that was set.







RELATED LINKS