Re: How to show PF usage using VBscript?
From: MikeVa [MSFT] (mikeva_at_online.microsoft.com)
Date: 11/17/04
- Previous message: Type mismatch: "Re: Take screenshots with script"
- In reply to: Serge: "How to show PF usage using VBscript?"
- Next in thread: Serge: "Re: How to show PF usage using VBscript?"
- Reply: Serge: "Re: How to show PF usage using VBscript?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 17 Nov 2004 13:07:49 -0800
Use the WMI Performance Counter Classes:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/performance_counter_classes.asp?frame=true
Specifically for Memory Counters:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfformatteddata_perfos_memory.asp?frame=true
You can find samples here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__performance_monitoring.asp?frame=true
http://www.microsoft.com/technet/scriptcenter/default.mspx
The following example would output the 'CommitedBytes' and 'PagePerSec'
counters every 5 seconds.
'---BEGIN EXAMPLE---
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
set objRefresher = CreateObject _
("WbemScripting.SWbemRefresher")
Set colItems = objRefresher.AddEnum _
(objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet
objRefresher.Refresh
While(true)
For Each objItem in colItems
Wscript.Echo "Committed Bytes: " & _
objItem.CommittedBytes
Wscript.Echo "Pages per Second: " & _
objItem.PagesPerSec
Wscript.Echo "------------------------------"
Wscript.Sleep 5000
objRefresher.Refresh
Next
Wend
'---END EXAMPLE---
-- MikeVa [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights. Use of any included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm -- Please do not send e-mail directly to this alias. This alias is for newsgroup purposes only. -- "Serge" <serge639@hotmail.com> wrote in message news:B3530E07-4AEA-4570-B858-2275873C7191@microsoft.com... >I have to report the memory in use on a server. Normally I go to the >Windows > task manager and look at the PF Usage. > I rather use a VBscript to show it. > > Can anyone tell me what script shows me the PF usage shown in the Windows > task manager? > > Serge van Lith
- Previous message: Type mismatch: "Re: Take screenshots with script"
- In reply to: Serge: "How to show PF usage using VBscript?"
- Next in thread: Serge: "Re: How to show PF usage using VBscript?"
- Reply: Serge: "Re: How to show PF usage using VBscript?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|