why doesn't the statement if (thres_PrivateBytes > cur_PrivateBytes) work properly? it was working when I had the WMI data type as Real32 and now it's UINT32 because I didn't have a conversion from scientific notation to decimal. Anyway, do I need to declare the vars as integers? my theory is that either one of the vars is seen by VB as a integer and the other as a string? I didn't see different operators for string vs. integers ( gt vs. > - like there is in Perl). Any help will be greatly appreciated.
Process_Name = oArgs(0)
Process_Name2 = oArgs(1)
thres_PrivateBytes = oArgs(2)
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM TMW_Process", "WQL" , _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
if (objitem.Process = Process_Name) then
cur_PrivateBytes = objItem.PrivateBytes
if (thres_PrivateBytes > cur_PrivateBytes) then
if (Logging = 1) then
WriteLog ("Private Bytes Threshold was exceeded " & thres_PrivateBytes & " > " & "current PrivateBytes: " & cur_PrivateBytes & " Process_Name " & Process_Name)
End if
End if
End if
C:TEMP>cscript memory_leak_2-process.vbs csrss mailman 1500000 1
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
==========================================
Computer: localhost
Script in debug mode - see c:tempmemory_leak.log
Process: mailman
[8/11/2008 3:37:09 PM] HandleCount: 87
[8/11/2008 3:37:09 PM] ID: 5304
[8/11/2008 3:37:09 PM] PageFaultsSec: 0
[8/11/2008 3:37:09 PM] PageFileBytes: 1343488
[8/11/2008 3:37:09 PM] PercentPrivilegedTime: 0
[8/11/2008 3:37:09 PM] PercentProcessorTime: 0
[8/11/2008 3:37:09 PM] PercentUserTime: 0
[8/11/2008 3:37:09 PM] PoolNonPagedBytes: 3256
[8/11/2008 3:37:09 PM] PoolPagedBytes: 27604
[8/11/2008 3:37:09 PM] PriorityBase: 8
[8/11/2008 3:37:09 PM] PrivateBytes: 1343488
[8/11/2008 3:37:09 PM] VirtualBytes: 2.779546E+07
[8/11/2008 3:37:09 PM] WorkingSet: 3915776
[8/11/2008 3:37:09 PM] ------ End of Process Metrics ------
[8/11/2008 3:37:09 PM] Private Bytes Threshold was exceeded 1500000 > current PrivateBytes: 1343488 Process_Name mailman
8/11/2008 3:37:08 PM] Process: csrss
[8/11/2008 3:37:08 PM] HandleCount: 784
[8/11/2008 3:37:08 PM] ID: 340
[8/11/2008 3:37:08 PM] PageFaultsSec: 0
[8/11/2008 3:37:08 PM] PageFileBytes: 2293760
[8/11/2008 3:37:08 PM] PercentPrivilegedTime: 0
[8/11/2008 3:37:08 PM] PercentProcessorTime: 0
[8/11/2008 3:37:08 PM] PercentUserTime: 0
[8/11/2008 3:37:08 PM] PoolNonPagedBytes: 7840
[8/11/2008 3:37:08 PM] PoolPagedBytes: 109460
[8/11/2008 3:37:08 PM] PriorityBase: 13
[8/11/2008 3:37:08 PM] PrivateBytes: 2293760
[8/11/2008 3:37:08 PM] VirtualBytes: 7.770112E+07
[8/11/2008 3:37:08 PM] WorkingSet: 1806336
[8/11/2008 3:37:08 PM] ------ End of Process Metrics ------
[8/11/2008 3:37:08 PM] Private Bytes Threshold was exceeded 1500000 > current PrivateBytes: 2293760 Process_Name csrss
Software/Hardware used:
ASKED:
August 11, 2008 9:34 PM
UPDATED:
August 12, 2008 2:28 PM
Minnow, you may be interested in one of our community blogs written by a fellow ITKE member Jerry Lees. It’s called The VBScript Network and Systems Administrator’s Cafe. Jerry covers all types of VBScript information.
Description: Be lazy! Stop beating yourself to death doing redundant tasks. Script it instead! I’ll discuss VBScript, products and technologies that will make your life easier as a Microsoft Windows administrator. This blog covers a variety of topics such as IIS, Exchange, ISA, and other standard Microsoft services.