Get-Counter path is not correct

I'm to get this to run but keep getting this error: Get-Counter : The specified counter path could not be interpreted.

Any insight into this issue would be appreciated.

param($destserver, $destDB)
$destserver = "CCIIT23"
$destDB = "SSIMS_Prod"

$Servers = Get-SqlData $destserver $destDb "Select ServerName From ServerNames"
write-output $Servers


$CounterList = Get-SqlData $destserver $destDb "Select Counter From MemoryCounterList"
write-output $CounterList

$Servers | Foreach-Object {
    $Serv = $_; $CounterList | Foreach-Object {
        Get-Counter -Computer $Serv -Counter $_ -SampleInterval 1
        }
    }

January 8th, 2014 7:02pm

Hi ClayRP,

I'm not sure about the function Get-SqlData, However, Please make sure you have the right input format of the parameter -Counter in the cmdlet Get-Counter with "[\\<ComputerName>]\<CounterSet>(<Instance>)\<CounterName>".

To get the right counter example of Memory Counter set, try to run the cmdlet below:

(Get-Counter -ListSet memory).paths

I hope this helps.

Free Windows Admin Tool Kit Click here and download it now
January 9th, 2014 5:40am

Hi ClayRP,

I'm not sure about the function Get-SqlData, However, Please make sure you have the right input format of the parameter -Counter in the cmdlet Get-Counter with "[\\<ComputerName>]\<CounterSet>(<Instance>)\<CounterName>".

To get the right counter example of Memory Counter set, try to run the cmdlet below:

(Get-Counter -ListSet memory).paths

I hope this helps.

January 9th, 2014 5:40am

Thanks AnnaWY.  I figured out that the misleading error was because I didn't run the ISE as Administrator.  I had admin rights to the OS and to SQL.  Not sure why I had to run as Administrator.  Any ideas why?
Free Windows Admin Tool Kit Click here and download it now
January 18th, 2014 8:14pm

Hello,

I`ve found this in powershell documentation:

"Performance counters are often protected by access control lists (ACLs). To get all available performance count
ers, open Windows PowerShell with the "Run as administrator" option."


Good luck)
January 19th, 2014 3:28am

Hello,

I`ve found this in powershell documentation:

"Performance counters are often protected by access control lists (ACLs). To get all available performance count
ers, open Windows PowerShell with the "Run as administrator" option."


Good luck)
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2014 3:34am

Thanks AnnaWY.  I figured out that the misleading error was because I didn't run the ISE as Administrator.  I had admin rights to the OS and to SQL.  Not sure why I had to run as Administrator.  Any ideas why?
January 19th, 2014 4:07am

Hello,

I`ve found this in powershell documentation:

"Performance counters are often protected by access control lists (ACLs). To get all available performance count ers, open Windows PowerShell with the "Run as administrator" option."


Good luck)
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2014 11:26am

Hi ClayRP,

Thanks for your sharing.

As Kolomiets Sergei mentioned, this is because this cmdlet need to open Windows PowerShell with the "Run as administrator" option because of ACLs.

You can get this information when you run the cmdlet "get-help Get-Counter -online", which is listed in Notes part.

I hope this helps.

January 19th, 2014 8:20pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics