Jason Boyd
Jason Boyd

Reputation: 7029

Create performance counters on remote server with PowerShell

Question says it all. Can I use PowerShell to create a performance counter category and performance counters on a remote Windows server. The server in question happens to be 2008 R2.

Upvotes: 0

Views: 1009

Answers (2)

Mike Zboray
Mike Zboray

Reputation: 40838

There aren't any built-in cmdlets to do that. However, since you have the entire .NET Framework at your disposal, you can use PerformanceCounterCategory.Create to create counter categories. To create them on a remote machine, you would have to enable powershell remoting. An example, which creates a single instance category of type NumberOfItems32:

Invoke-Command -ComputerName remotemachine -ScriptBlock { [System.Diagnostics.PerformanceCounterCategory]::Create("category name", "category help", "SingleInstance", "counter name", "counter help") }

There are other overloads that take additional data (such as the counter type) and let you create multiple counters in the category.

Upvotes: 1

idarryl
idarryl

Reputation: 769

yes, use the Get-Counter command:

http://technet.microsoft.com/en-us/library/hh849685.aspx

Upvotes: 0

Related Questions