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.