question

bububu avatar image
bububu asked

How to get performance counter values for a named instance using PS?

I have two instances on the SQL server - default and named instance "Named1". When I try to get SQL Statistics\Batch Requests/sec values (for default instance) using PowerShell it works. When I try to do the same for named instance it fails. PS line for default instance: Get-Counter -Counter "\SQLServer:SQL Statistics\Batch Requests/sec". PS line for named instance: Get-Counter -Counter "\MSSQL$NAMED1:SQL Statistics\Batch Requests/sec". After executing PS line for the named instance I get this: Get-Counter: Internal performance counter API call failed. Error: c0000bb8. At line:1 char:12 I checked if the counter for named instance is in the PS list (command Get-Counter -ListSet *) and it is listed. And can see it in Performance monitor too. SQL Server 2008, Windows Server 2008 R2 and I am sysadmim on both instaces.
powershellperformance counters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sqlaj 1 avatar image
sqlaj 1 answered
I just tried this on my server and the only difference I see is I used a single quote around the counter name.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bububu avatar image bububu commented ·
Thank you. It worked.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.