Hi

I have the following script, which works fine for getting
some of the data requested but not all. I realise the
reason this occurs is thatin the line: "Select * from
Win32_ComputerSystem",,48)

it just specifies win32_computersystem. Is there a way to
specify multiple WMI objects in the same script?

-----------------
On Error Resume Next
strComputer = InputBox ("Enter Remote Computer Name or
Press Enter for local machine","Enter Remote Computer
Name",".")
Set objWMIService = GetObject("winmgmts:\\" & strComputer
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery(
For Each objItem in colItems
Wscript.Echo "Wallpaper: " & objItem.Wallpaper
Wscript.Echo "Domain: " & objItem.Domain
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Model: " & objItem.Model
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "NumberOfProcessors: " &
objItem.NumberOfProcessors
Wscript.Echo "PrimaryOwnerName: " &
objItem.PrimaryOwnerName
Wscript.Echo "SystemType: " & objItem.SystemType
Wscript.Echo "TotalPhysicalMemory: " &
objItem.TotalPhysicalMemory
Wscript.Echo "UserName: " & objItem.UserName
Wscript.Echo "Computer name: " &
objComputer.MachineName
Wscript.Echo "Start Time: " & objItem.StartTime
Next

Re: VB Script newbie question by Michael

Michael
Mon Jan 03 19:29:20 CST 2005

Dave wrote:
> Hi
>
> I have the following script, which works fine for getting
> some of the data requested but not all. I realise the
> reason this occurs is thatin the line: "Select * from
> Win32_ComputerSystem",,48)
>
> it just specifies win32_computersystem. Is there a way to
> specify multiple WMI objects in the same script?


With one ExecQuery call, no...

In the same script, just do separate ExecQuery calls for each WMI object.


>
> -----------------
> On Error Resume Next
> strComputer = InputBox ("Enter Remote Computer Name or
> Press Enter for local machine","Enter Remote Computer
> Name",".")
> Set objWMIService = GetObject("winmgmts:\\" & strComputer
> & "\root\cimv2")
> Set colItems = objWMIService.ExecQuery(
> For Each objItem in colItems
> Wscript.Echo "Wallpaper: " & objItem.Wallpaper
> Wscript.Echo "Domain: " & objItem.Domain
> Wscript.Echo "Manufacturer: " & objItem.Manufacturer
> Wscript.Echo "Model: " & objItem.Model
> Wscript.Echo "Name: " & objItem.Name
> Wscript.Echo "NumberOfProcessors: " &
> objItem.NumberOfProcessors
> Wscript.Echo "PrimaryOwnerName: " &
> objItem.PrimaryOwnerName
> Wscript.Echo "SystemType: " & objItem.SystemType
> Wscript.Echo "TotalPhysicalMemory: " &
> objItem.TotalPhysicalMemory
> Wscript.Echo "UserName: " & objItem.UserName
> Wscript.Echo "Computer name: " &
> objComputer.MachineName
> Wscript.Echo "Start Time: " & objItem.StartTime
> Next

--
Michael Harris
Microsoft MVP Scripting