Working with Numbers
Microsoft® Windows® 2000 Scripting Guide
Much of system administration revolves around numbers: How much memory is available on this computer? How many services are paused on that computer? How many failed logons have been recorded in the event log? How much processor time is being used on our domain controllers?
This type of numeric information can easily be returned using scripts; for example, you can use WMI to answer all of the preceding questions. As explained in the first half of this chapter, however, this information does not always come back in a format that is useful for system administrators. Free disk space is reported in bytes; a disk drive with approximately 10 gigabytes of free disk space might show 10,842,824,704 bytes of free disk space. Processor use is reported in 100-nanosecond increments; the maximum length and width of the paper that can be used on a printer is reported in tenths of a millimeter.
Fortunately, VBScript provides a number of functions that allow you to manipulate numbers, including functions for performing mathematical calculations and functions for formatting numeric output.