Windows 2003 and WMI question
From: Peter Nguyen (petern_at_adobe.com)
Date: 07/14/04
- Next message: Carl Hilton: "Enumerate Directory listings"
- Previous message: Head Geek : "Script to set Archive location in Outlook 2003"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Windows 2003 and WMI question"
- Reply: Torgeir Bakken \(MVP\): "Re: Windows 2003 and WMI question"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Carl Hilton: "Enumerate Directory listings"
- Previous message: Head Geek : "Script to set Archive location in Outlook 2003"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Windows 2003 and WMI question"
- Reply: Torgeir Bakken \(MVP\): "Re: Windows 2003 and WMI question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|