Monitor Operating System Performance

 

Description
Uses cooked performance counters to monitor counters that apply to more than one instance of a component processors on the computer

 

Supported Platforms

Windows Server 2003

Yes

Windows XP

Yes

Windows 2000

No

Windows NT 4.0

No

Windows 98

No

 

Script Code

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set colItems = objRefresher.AddEnum _
    (objWMIService, "Win32_PerfFormattedData_PerfOS_System").objectSet
objRefresher.Refresh

For i = 1 to 5
    For Each objItem in colItems
        Wscript.Echo "Alignment Fixups Per Second: " & _
            objItem.AlignmentFixupsPersec
        Wscript.Echo "Caption: " & objItem.Caption
        Wscript.Echo "Context Switches Per Second: " & _
            objItem.ContextSwitchesPersec
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "Exception Dispatches Per Second: " & _
            objItem.ExceptionDispatchesPersec
        Wscript.Echo "File Control Bytes Per Second: " & _
            objItem.FileControlBytesPersec
        Wscript.Echo "File Control Operations Per Second: " & _
            objItem.FileControlOperationsPersec
        Wscript.Echo "File Data Operations Per Second: " & _
            objItem.FileDataOperationsPersec
        Wscript.Echo "File Read Bytes Per Second: " & _
            objItem.FileReadBytesPersec
        Wscript.Echo "File Read Operations Per Second: " & _
            objItem.FileReadOperationsPersec
        Wscript.Echo "File Write Bytes Per Second: " & _
            objItem.FileWriteBytesPersec
        Wscript.Echo "File Write Operations Per Second: " & _
            objItem.FileWriteOperationsPersec
        Wscript.Echo "Floating Emulations Per Second: " & _
            objItem.FloatingEmulationsPersec
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "Percent Registry Quota In Use: " & _
            objItem.PercentRegistryQuotaInUse
        Wscript.Echo "Processes: " & objItem.Processes
        Wscript.Echo "Processor Queue Length: " & _
            objItem.ProcessorQueueLength
        Wscript.Echo "System Calls Per Second: " & _
            objItem.SystemCallsPersec
        Wscript.Echo "System UpTime: " & objItem.SystemUpTime
        Wscript.Echo "Threads: " & objItem.Threads
        Wscript.Sleep 2000
        objRefresher.Refresh
    Next
Next
	

 

 

For online peer support, join the microsoft.public.windows.server.scripting community on the msnews.microsoft.com news server. To provide feedback or report bugs in sample scripts or the Scripting Guide, please contact Microsoft TechNet.

 

Disclaimer

 

This sample script is not supported under any Microsoft standard support program or service. The sample script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.