Re: How to show PF usage using VBscript?

From: MikeVa [MSFT] (mikeva_at_online.microsoft.com)
Date: 11/17/04

  • Next message: Bill Hand: "Share a folder"
    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 
    

  • Next message: Bill Hand: "Share a folder"

    Relevant Pages

    • Exchange Performance
      ... to do improve performance on my exchange server. ... through 'Troubleshooting Microsoft Exchange 2000 Server ... Performance' and started monitoring the counters. ... Memory Counters ...
      (microsoft.public.exchange2000.admin)
    • Re: Menmorymanagement
      ... Sure, I did, but IMO I didn't say the taskmanager's counters were wrong, I ... correct) process memory counters, ... Also note that taskman is an end user tool, ... I for one wished taskman had an expert mode or did not show these counters ...
      (microsoft.public.dotnet.general)
    • [-mm PATCH] Memory controller improve user interface (v3)
      ... Changelog for version 3 ... Remove "Bytes" from the output of the limit and usage counters ... to the resource counters infrastructure to format the data as desired. ... pos, buf, s - buf); ...
      (Linux-Kernel)
    • Re: Strange issue with NDISPROT xmit and the network performance counter
      ... It seems that the packet counters in the NIC are different from the counters ... from the Task Manager counts only IP packets and completely ignores my ... custom Ethernet frames. ...
      (microsoft.public.development.device.drivers)
    • Re: [RFC PATCH] perf_counter: Add support for pinned and exclusive counter groups
      ... counters when software counters were added. ... Side question - were you intending to make the various software counters ... and allow system sampling via sw counter overflows. ... So my approach was always to have a good guess about what the best usage ...
      (Linux-Kernel)