No to worry I managed to sort it out with the below
' Get raw and cooked data performance counter instances for the
'wscript process running this script
on error resume next
dim strComputer, objWMIService, RawProc, processname, threshold
processname = "'xxx'"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set RawProc = GetObject("winmgmts:" _
& "Win32_PerfRawdata_Perfproc_process." _
& "name='xxx'")
Wscript.Echo "opcwbemi process raw PageFaultsPerSec = " _
& RawProc.PrivateBytes
threshold = RawProc.PrivateBytes
if RawProc.PrivateBytes > "50000000" then
wscript.echo "threshold breached"
end if
set objWMIService = nothing
set RawProc = nothing
--
Dee
"Pegasus [MVP]" wrote:
>
> "Dee" <> wrote in message
> news:9DD68F99-6776-402A-A80E-...
> > Hi
> >
> > I want to monitor a particular process for private bytes which I can see
> > is
> > the amount of memory it is using, however I cannot find the object to use.
> >
> > I have the below, but it does not give the object i want
> >
> > any ideas?, thanks
> >
> > strComputer = "."
> > Set objWMIService = GetObject("winmgmts:" _
> > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> >
> > Set colProcessList = objWMIService.ExecQuery("Select * from
> > Win32_Process")
> >
> > For Each objProcess in colProcessList
> > Wscript.Echo "Process: " & objProcess.Name
> > Wscript.Echo "Process ID: " & objProcess.ProcessID
> > Wscript.Echo "Thread Count: " & objProcess.ThreadCount
> > Wscript.Echo "Page File Size: " & objProcess.PageFileUsage
> > Wscript.Echo "Page Faults: " & objProcess.PageFaults
> > Wscript.Echo "Working Set Size: " & objProcess.WorkingSetSize
> > Next
> > --
> > Dee
>
> Hard to say unless you tell us in what way your code fails to deliver.
>
>
>
|