2014-12-18 74 views
0

我正在VBScript中運行WQL查詢以從我們的SCCM數據庫中提取數據。我可以做其他所有按預期工作的查詢。他們通常會返回一個對象的集合,我可以通過循環和訪問使用標準方法:WQL查詢返回集合中的多個實例

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 

回答

0

你JOIN'ing SMS_R_SYSTEM和SMS_G_System_NETWORK_ADAPTER_CONFIGURATION。這將爲每個NIC配置產生一個記錄。如果設備有多個NIC(包括虛擬IP地址)和非空IP地址(可能包含專用網絡),則每個NIC都會有一個JOIN'ed記錄。您應該能夠看到每個「重複」記錄的NIC數據差異。