916
Part VII: Monitoring and Auditing
After you have your list of counters, you can start grabbing them using
Get-Counter -Counter $CountersList
When that is accomplished, you suddenly have become the dog that fi nally caught the bus.
The counters come back in a format that is not readable by the average person. The coun-
ters look nothing like you would expect. That’s because they need to be transformed into a
DataTable to format properly on the screen or to save off to a fi le. Until you do, Figure 37-3
shows what those results look like by default:
FIGURE 37-3
Unformatted Performance Counter Output.
With this bit of code, you can at least make the results (see Figure 37-4) display more
presentably:
$CounterResults.CounterSamples | Format-Table –Auto
FIGURE 37-4
Formatted performance counter results.
c37.indd 916c37.indd 916 7/31/2012 10:03:54 AM7/31/2012 10:03:54 AM
http://www.it-ebooks.info