hello,
i want to add custom fields to the Datacenter view , when i do it for hosts and vms it works fine , but to the Datacenter it does not work,
is it event possible to do that ?
thanks in advance
Yes, you can add custom fields to the datacenter view. The only problem is that you will not see them in the vCenter client. This seems a restriction of the vCenter client to me. But you can use them in PowerCLI.
To following PowerCLI script adds a custom field named Location to the datacenter view. It then retrieves the first datacenter. Gives the value Amsterdam to the location field of this datacenter. And finaly retrieves all the custom fields for this datacenter.
New-CustomAttribute -Name Location -TargetType Datacenter $Datacenter = Get-Datacenter | Select-Object -First 1 Set-Annotation -Entity $Datacenter -CustomAttribute Location -Value Amsterdam Get-Annotation -Entity $Datacenter
If you use the New-CustomField cmdlet instead of the New-CustomAttribute cmdlet the syntax is slighty different:
$Datacenter = Get-Datacenter | Select-Object -First 1 New-CustomField -Entity $Datacenter -Name Country -Value "The Netherlands" Get-Annotation -Entity $Datacenter
Regards, Robert
Added the New-CustomField example.
Message was edited by: RvdNieuwendijk
Yes, you can add custom fields to the datacenter view. The only problem is that you will not see them in the vCenter client. This seems a restriction of the vCenter client to me. But you can use them in PowerCLI.
To following PowerCLI script adds a custom field named Location to the datacenter view. It then retrieves the first datacenter. Gives the value Amsterdam to the location field of this datacenter. And finaly retrieves all the custom fields for this datacenter.
New-CustomAttribute -Name Location -TargetType Datacenter $Datacenter = Get-Datacenter | Select-Object -First 1 Set-Annotation -Entity $Datacenter -CustomAttribute Location -Value Amsterdam Get-Annotation -Entity $Datacenter
If you use the New-CustomField cmdlet instead of the New-CustomAttribute cmdlet the syntax is slighty different:
$Datacenter = Get-Datacenter | Select-Object -First 1 New-CustomField -Entity $Datacenter -Name Country -Value "The Netherlands" Get-Annotation -Entity $Datacenter
Regards, Robert
Added the New-CustomField example.
Message was edited by: RvdNieuwendijk
Thank you very much for the help, the Customfield didn't work as i said before but because of you i remebered that there is also set-annotaion
and with that i do see the value in the vClient.
so thanks for the TIP it helped me at the end .