Windows 2003 and WMI question

From: Peter Nguyen (petern_at_adobe.com)
Date: 07/14/04


Date: Wed, 14 Jul 2004 16:23:50 GMT

Hello All,

I have a script that utilize wmi to get the local Administrators group name
in different OS languages (Administrators group names differently in
different language).
The script works fine with Windows 2000/XP. However, the WMI call failed
without a trace when running on Windows 2003 box (english, german, sweden,
neitherland so far...).

Does Windows 2003 make WMI calls different than 2K/XP? Any help would be
greatly appreciated.

Here is a portion of my script which do the above mentioned.

sComputer = "."

sGroupSID = "S-1-5-32-544" ' Well Known SID of the local Administrators
group

' --- THIS IS WHERE IT FAILED ON WINDOWS 2003 ---
 Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
      If Err.Number <> 0 Then
       msgbox Err.Number
       msgbox Err.Description
      End If
 Set colItems = objWMIService.ExecQuery ("Select * from Win32_Group WHERE
SID = '" & sGroupSID & "'")
      If Err.Number <> 0 Then
       msgbox Err.Number
       msgbox Err.Description
       End If

For Each objItem in colItems
 sAdminGrp = objItem.Name ' Get local Administrators group name
 Wscript.Echo "Name of the local Administrators group: " & sAdminGrp
Next



Relevant Pages

  • Re: AD in Local Groups differente languajes?
    ... > the local Administrators group on every workstation, ... > have different languages on the workstation and the Administrators group ... To run this WMI query against NT4 computers, ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)
  • Re: Windows 2003 and WMI question
    ... > I have a script that utilize wmi to get the local Administrators group name ... > The script works fine with Windows 2000/XP. ... However, the WMI call failed ... ' Well Known SID of the local Administrators group ...
    (microsoft.public.scripting.vbscript)
  • RE: Does WMI have to be installed on Remote Computer?
    ... IMHO this looks like a well constructed and very vell commented script. ... WMI comes as standard on w2k w2k3 and xp, ... does WMI need to be installed on the remote computer in order for a ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Re: Look over this script.....could anything be done better?
    ... will be unable to connect with WMI. ... With this version of the script I have kept that included because the script that enumerates all of the servers has some servers that no longer exist. ... Dim objWMIService, colFixedDrives, objFD ...
    (microsoft.public.scripting.vbscript)
  • Re: Create simple file share on the fly
    ... WMI share routine faithfully works. ... You can place the command line below as the final line in your WMI ... You might experiment with actual workstations to see if the script is ... the shares that I make from the Windows GUI, ...
    (microsoft.public.windowsxp.security_admin)