Skip to Content
Microsoft® Windows® Scripting with WMI: Self-Paced Learning Guide
book

Microsoft® Windows® Scripting with WMI: Self-Paced Learning Guide

by Ed Wilson
October 2005
Beginner to intermediate
400 pages
12h 42m
English
Microsoft Press
Content preview from Microsoft® Windows® Scripting with WMI: Self-Paced Learning Guide
Chapter 12: Using the Performance Counter Classes 265
wmiQuery = "Win32_PerfRawData_PerfDisk_LogicalDisk.name='_total'"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
WScript.echo "Disk Utilization"
Fori= 1to8
Set objItem1 = objWMIService.get(wmiQuery)
N1 = objItem1.PercentDiskTime
D1 = objItem1.TimeStamp_Sys100NS
WScript.Sleep
2000
Set objItem2 = objWMIService.get(wmiQuery)
N2 = objItem2.PercentDiskTime
D2
= objItem2.TimeStamp_Sys100NS
PercentUtilization = (1 - ((N2 - N1)/(D2-D1)))*100
WScript.Echo Round(PercentUtilization,2)
Next
Summary
In this chapter, we looked at using the WMI performance counter classes. We examined the
difference between raw and formatted (or cooked) performance counters and discussed when ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Windows® Scripting Self-Paced Learning Guide

Microsoft® Windows® Scripting Self-Paced Learning Guide

Ed Wilson

Publisher Resources

ISBN: 0735622310Catalog PageErrata