- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have similar question. I would like to get information with specific settings for all VMs and here I am able to do it, but I would like also get information about specific Custom Attribute and here I am failing. Could you please help me?
My current part of the code looks like following:
$VMInfo = "" | Select VMName,NICCount,IPAddress,MacAddress,NICType,NetworkName,GuestRunningOS,PowerState,ToolsVersion,ToolsStatus,ToolsRunningStatus,HWLevel,VMHost,CustomValue
$VMInfo.VMName = $vmview.Name
$VMInfo.NICCount = $vmview.Guest.Net.Count
$VMInfo.IPAddress = [String]$getvm.Guest.IPAddress
$VMInfo.MacAddress = [String]$nicmac
$VMInfo.NICType = [String]$nictype
$VMInfo.NetworkName = [String]$nicname
$VMInfo.GuestRunningOS = $vmview.Guest.GuestFullname
$VMInfo.PowerState = $getvm.PowerState
$VMInfo.ToolsVersion = $vmview.Guest.ToolsVersion
$VMInfo.ToolsStatus = $vmview.Guest.ToolsStatus
$VMInfo.ToolsRunningStatus = $vmview.Guest.ToolsRunningStatus
$VMInfo.HWLevel = $vmview.Config.Version
$VMInfo.VMHost = $getvm.VMHost
$VMInfo.CustomValue = $vmview.CustomValue.Value - > this one is not working
In VM Annotation in vCenter I have CustomAttibute named SLA. And entry this field I want to get for all VMs: Please see output from particular VM:
PowerCLI C:\> $vm.AvailableField.Name
App_Category
Building
Crash
Function
Hardening Settings
Operational_Usage
SEC_Info
SLA
Service Contract
Status
StorMagicVSA
TSM_VE
TSM_VE_Policy
TSM_VE_Scope
Veeam-Status
com.vmware.vdp2.is-protected
com.vmware.vdp2.protected-by
com.vmware.vdr.is-protected
com.vmware.vdr.protected-by
vhw-name
vhw-responsible
PowerCLI C:\> $vm.AvailableField.Key
201
101
1001
202
601
501
401
502
203
503
901
801
802
803
903
904
905
906
907
204
205
PowerCLI C:\> $vm.CustomValue.Value
Web/Application Platform Generic
Application Other
internal
Test
Best Effort (DE)
in operation
PowerCLI C:\> $vm.CustomValue.Key
201
202
401
501
502
503
So interesting part is for me Key 502, but not sure how to correlate CustomValue, Key and AvailableFields to get output from SLA field.
I appreciate your help. Thx.