我在 VBScript 中运行 WQL 查询以从我们的 SCCM 数据库中提取数据。我可以做其他所有的查询都按预期工作。它们通常返回一个对象集合,我可以使用标准方法循环并访问它:
For Each objGroup in colGroups
wscript.echo objgroup.name
Next
当使用该objgroup.GetObjectText_
方法在工作查询中的一个集合对象中显示数据时,我通常会看到如下内容:
instance of SMS_R_UserGroup
{
Name = "whatevername";
UsergroupName = "whatever";
WindowsNTDomain = "whatever";
};
每个对象中本质上都有一个实例(如果我的术语有误,请纠正我)具有我可以轻松访问的属性。
对于有问题的查询,我在每个对象中看到多个实例:
instance of __GENERIC
{
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION =
instance of SMS_G_System_NETWORK_ADAPTER_CONFIGURATION
{
DefaultIPGateway = "xxxx";
DHCPEnabled = 1;
DHCPServer = "xxxx";
DNSDomain = "xxxx";
DNSHostName = "xxxx";
GroupID = 4;
Index = 9;
IPAddress = "xxxxxx";
IPEnabled = 1;
IPSubnet = "xxxx";
MACAddress = "xxxx";
ResourceID = 74762;
RevisionID = 11;
ServiceName = "xxxxxx";
TimeStamp = "xxxxx";
};
SMS_R_System =
instance of SMS_R_System
{
Active = 1;
ADSiteName = "xxxxxx";
AgentName = {"xxxxxx"};
AgentSite = {"xxxxx"};
AgentTime = {"xxxxxx"};
AlwaysInternet = 0;
Client = 1;
ClientType = 1;
ClientVersion = "xxxx";
};
如何访问具有多个实例的对象中的属性?为什么它返回多个实例?
顺便说一句,这是我正在运行的查询:
SELECT *
FROM SMS_R_System
JOIN SMS_G_System_NETWORK_ADAPTER_CONFIGURATION ON
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceID
WHERE SMS_R_System.Name = 'xxxxxx' AND
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress IS NOT NULL