Re: WMI and 2003 SP1
- From: "Philippe l. Balmanno" <plb2862@xxxxxxx>
- Date: Wed, 13 Apr 2005 04:36:51 -0700
"Tom Ker" <thomasDOTkerA@xxxxxxxxxxxxxxxx> wrote in message
news:O4FLu14PFHA.3880@xxxxxxxxxxxxxxxxxxxxxxx
| This is part of a script I run on multiple versions of Windows....
|
| Set oShell = CreateObject("WScript.Shell")
| sCompName = oShell.ExpandEnvironmentStrings("%ComputerName%")
| Set oWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
| sCompName & "\root\cimv2")
| Set cOperatingSystems = oWMIService.ExecQuery("Select * from
| Win32_OperatingSystem")
| For Each oOperatingSystems in cOperatingSystems
| wscript.echo oOperatingSystems.Caption
| Next
|
| This works on Windows 2000 (all SPs), Windows XP (all SPs), but does
not
| work on Windows 2003 SP1. I get an error 8004101D with no other
explanation
| on the "For Each..." line. Or I get an error 80010108 with "The
object
| invoked has disconnected from its clients." on the same line.
|
| Any thoughts?
|
| Thanks,
|
| Tom
|
I use the Portable Scripts Center version without any problems for a
local computer. There may be more info about applying it for
enterprise search. Usually, I see a query to LDAP for multiple
workstation request.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.Caption & " " & _
objOperatingSystem.Version
Next
--
Philippe L. Balmanno
.
- References:
- WMI and 2003 SP1
- From: Tom Ker
- WMI and 2003 SP1
- Prev by Date: Re: Remote Running process checker
- Next by Date: Re: Remote Running process checker
- Previous by thread: Re: WMI and 2003 SP1
- Next by thread: Re: Comparing to big list - Help...
- Index(es):
Relevant Pages
|