的性能我有来自设备的寄存器集的信息的命令行:Powershell的枚举属性
PS C:\ Windows \ System32下> GET-PSDevice serverA的
主机名:服务器A
OOB:
重要性:普通
IsVirtual:真
等
其中的一些具有 '子属性' 内部的阵列,例如:
集群:@ {URL = https://ps-apps.com/DeviceRegister/api/Clusters/62; VCenterUrl = https://ps-apps.com/DeviceRegister/api/VCenters/2;群ID = 62; VCenterId = 2; Name = Vcenter 1 ABC Prod; DataCenterUrl = https://ps-apps.com/DeviceRegister/api/DataCenters/3;数据中心=; IsValidated = TRUE; IsExceptionCluster = FALSE; SupportsProdWorkloads = FALSE; SupportsNonProdWorkloads = FALSE; SupportsSqlWorkloads = FALSE; ManagedByabc = FALSE}
我能得到我想要使用类似的阿雷内的任何属性:
(Get-PSDevice ServerA).cluster.name
我试图确定的方式使用枚举所有子属性一个foreach类型的语句来填充一个值。
什么是最好的方法来实现这一目标?
只是为了迂腐,'.PSObject'不是属性,而是成员集:'(''| gm -Force PSObject).MemberType'。 – PetSerAl
@PetSerAl fair'nough :) – briantist