Microsoft KB Archive/321202

= BUG: Query Against Win32_Group Returns Duplicate Instances =

Article ID: 321202

Article Last Modified on 3/20/2004

-

APPLIES TO


 * Microsoft Windows Management Instrumentation 1.5

-



This article was previously published under Q321202



SYMPTOMS
When Windows Management Instrumentation (WMI) populates Win32_Group instances on Microsoft Windows NT 4.0, WMI uses the &quot;BUILTIN&quot; string for the domain property. When you are using WMI to enumerate local groups on a Windows NT 4.0-based computer, you may use a WQL query that is similar to the following query: Select * from Win32_Group where Domain=&quot;BUILTIN&quot; However, on Microsoft Windows 2000 and later, WMI uses the machine name to populate the same domain property, so the query may be similar to the following WQL query: Select * from Win32_Group where Domain =&quot;MyMachineName&quot; A problem occurs with WMI when you try to use the following query that ordinarily returns the appropriate result set on any of the previously mentioned operating systems: Select * from Win32_Group where Domain=&quot;BUILTIN&quot; OR Domain =&quot;MyMachineName&quot; Because of a bug in WMI, this query returns duplicates of each instance in the result set.



RESOLUTION
To work around this problem, ignore the second set of instances with the same key or keys.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
When you run the following script, it returns duplicate values: dim WMILocator, WMIServices

Set WMILocator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;) Set WMIServices = WMILocator.ConnectServer(,&quot;root\cimv2&quot;) Set QueryResultSet = WMIServices.ExecQuery(&quot;SELECT * FROM Win32_Group WHERE Domain='BUILTIN' OR Domain='MyMachineName'&quot;)

For Each Result in QueryResultSet Wscript.Echo Result.Name Next Set QueryResultSet = Nothing Set WMIServices = Nothing Set WMILocator = Nothing



MSDN Win32_Group Documentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/r_32os3_7dio.asp

Keywords: kbbug kbdswmanage2003swept KB321202

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.