![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | PerfMon PowerShell Query Below code checks the perfmon counter and gives me the value of a instance =============================== Function PerfMon($Server) { $Ojbect = "LogicalDisk" $Counter = "% Free Space" $Instence = "C:" $perf = New-Object System.Diagnostics.PerformanceCounter($Ojbect, $Counter, $Instence, $Server) $p = $perf.RawValue $p } $Computer = "ww" PerfMon $computer =============================== Is there any way to do a query for all instance of a counter and object and give a value of those? Eg. Script does a query for all available instances (_total, c:, d:, e: etc..) itself instead of defining a value like $instence = “c:” and gives the value of all. Any help greatly appreciated. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: PerfMon PowerShell Query Quote: > Is there any way to do a query for all instance of a counter and > object and give a value of those? > > Eg. Script does a query for all available instances (_total, c:, d:, > e: etc..) itself instead of defining a value like $instence = “c:” and > gives the value of all. > > Any help greatly appreciated. $perfc = New-Object System.Diagnostics.PerformanceCounterCategory $perfc.categoryname="LogicalDisk" $perfc.GetInstanceNames() Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: PerfMon PowerShell Query Perfectly what I want. Thanks a lot... On May 15, 10:44*am, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote: Quote: Quote: > > Is there any way to do a query for all instance of a counter and > > object and give a value of those? Quote: > > Eg. Script does a query for all available instances (_total, c:, d:, > > e: etc..) itself instead of defining a value like $instence = “c:”and > > gives the value of all. Quote: > > Any help greatly appreciated. > Try this out: > $perfc = New-Object System.Diagnostics.PerformanceCounterCategory > $perfc.categoryname="LogicalDisk" > $perfc.GetInstanceNames() > > Marco > > -- > Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp > > PowerGadgets MVPhttp://www.powergadgets.com/mvp > > Blog:http://marcoshaw.blogspot.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Is there a way to query DNS from powershell? | PowerShell | |||
| LDS query via powershell | PowerShell | |||
| Running WMI Query in without Powershell or VBS | PowerShell | |||
| Query NT4 Domain from Powershell | PowerShell | |||
| Query for ms-ds-creatorsid from Powershell | PowerShell | |||