How to get single object with
From: Tomasz Onyszko [MVP] (T.Onyszko_nospam__at_w2k.pl)
Date: 02/18/05
- Next message: Brandon McCombs: "ExecQuery hangs whole script but GetObject is fine"
- Previous message: Ryan Ackerman: "Re: finding the running instance of a program in a network"
- Next in thread: Peter Falz: "Re: How to get single object with"
- Reply: Peter Falz: "Re: How to get single object with"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Feb 2005 02:11:37 +0100
OK, I'm trying to get single instance of object
Win32_PerfFormattedData_PerfOS_Processor.Name fot _total instance, and
put it into SwbemRefresher. But whe I do Refresh operation all
properties of this object except Name are set to Null - so I can't read
for example Percent processor time.
Here is a fragment of my script:
=============================
strComputer = "."
Set ObjWMISvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set objRefresher = CreateObject("WbemScripting.SwbemRefresher")
Set objProcessor =
objRefresher.Add(ObjWMISvc,"Win32_PerfFormattedData_PerfOS_Processor.Name='_Total'").Object
objRefresher.Refresh
ppt = objProcessor.PercentProcessorTime
==============================
what am I doing wrong ?
-- Tomasz Onyszko [MVP] T.Onyszko@w2k.pl http://www.w2k.pl
- Next message: Brandon McCombs: "ExecQuery hangs whole script but GetObject is fine"
- Previous message: Ryan Ackerman: "Re: finding the running instance of a program in a network"
- Next in thread: Peter Falz: "Re: How to get single object with"
- Reply: Peter Falz: "Re: How to get single object with"
- Messages sorted by: [ date ] [ thread ]