Re: WMI and 2003 SP1



"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


.



Relevant Pages

  • Re: One other related Q Re: basic Q: Only one way to make vars live outside of the scope of a functi
    ... >>> directly to the calling script, without having to use global variables ... to get multiple return items from a subprocedure. ... >>> better not to mix scope and use global variables for multiple return ... before terminating the object reference. ...
    (microsoft.public.scripting.vbscript)
  • Re: Can you have a command line arg with a workbook?
    ... "Patrick Molloy" wrote: ... but I guess I would still need the multiple IF statements (or ... Case if that works in VBScript?) ... this script starts a new instance of Excel. ...
    (microsoft.public.excel.programming)
  • Re: Pattern for foo tool <-> API <-> shell|GUI
    ... The user can execute a Python script in the shell, ... There are multiple command ... where the command-line handler might look something like:: ... documentation of generate-- and any other methods that accept handler ...
    (comp.lang.python)
  • Re: shell script
    ... |> i need a shell script that can create multiple users.... ... If you setup 1000 users with this, and I want to steal some accounts, all I need to do is login to my account, cat /etc/passwd then login to some of the other accounts that have yet to be 'activated' and change the passwords myself. ... You could probably write a wrapper script or a script to generate /etc/shadow and /etc/passwd entries and depending on how you wanted your users grouped, /etc/group entries as well and then create thir home directory, chown it to the newly created user and copy the contents of /etc/skel to the new home directory, chowning it in the process. ...
    (RedHat)
  • Re: USB microscopes for very small SMT
    ... multiple copies of all your tools? ... I was somewhere and needed a file, a script actually, and it was on ... Just used the GPRS modem to connect to my home server, ...
    (sci.electronics.design)