Install-PerformanceCounter

Installs a performance counter.

Syntax

Install-PerformanceCounter [-CategoryName] <String> [-Name] <String> [-Description] <String> [-Type] {NumberOfItemsHEX32 | NumberOfItemsHEX64 | NumberOfItems32 | NumberOfItems64 | CounterDelta32 | CounterDelta64 | SampleCounter | CountPerTimeInterval32 | CountPerTimeInterval64 | RateOfCountsPerSecond32 | RateOfCountsPerSecond64 | RawFraction | CounterTimer | Timer100Ns | SampleFraction | CounterTimerInverse | Timer100NsInverse | CounterMultiTimer | CounterMultiTimer100Ns | CounterMultiTimerInverse | CounterMultiTimer100NsInverse | AverageTimer32 | ElapsedTime | AverageCount64 | SampleBase | AverageBase | RawBase | CounterMultiBase} [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Creates a new performance counter with a specific name, description, and type under a given category. The counter's category is re-created: its current counters are retrieved, the category is removed, a the category is re-created. Unfortunately, we haven't been able to find any .NET APIs that allow us to delete and create an existing counter.

Parameters

Name Type Description Required? Pipeline Input Default Value
CategoryName String The category's name where the counter will be created. true false
Name String The performance counter's name. true false
Description String The performance counter's description (i.e. help message). true false
Type PerformanceCounterType The performance counter's type (from the Diagnostics.PerformanceCounterType enumeration). true false
Force SwitchParameter Re-create the performance counter even if it already exists. false false
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

EXAMPLE 1

Install-PerformanceCounter -CategoryName ToyotaCamry -Name MilesPerGallon -Description 'The miles per gallon fuel efficiency.' -Type NumberOfItems32

Creates a new miles per gallon performance counter for the ToyotaCamry category.