![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Powershell WMI Performance counters - refresher object needed? Hi, I am trying to see if using Powershell to access remote performance counters is a good way to go. I use to use Perfmon but the overhead seems to be a lot. As I am testing, I wonder if my results are accurate. I access these perf counters via get-wmiobject and I am only interested in the "_Total" instance. gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername $computername | %{if ($_.Name -eq "_Total"){ $Disk_Perf=$_.PercentDiskTime write-host "Value: $_ $Disk_Perf" } } Someone told me that I needed a "refresher object", add counters to the object, then access values via the object. Does anyone know if this is true? I have a file with hosts in it, then I go through this file with $computername. Thanks in advance, |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> said: > Hi, > > I am trying to see if using Powershell to access remote performance > counters is a good way to go. I use to use Perfmon but the overhead > seems to be a lot. As I am testing, I wonder if my results are > accurate. I access these perf counters via get-wmiobject and I am only > interested in the "_Total" instance. > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername > $computername | %{if ($_.Name -eq "_Total"){ > $Disk_Perf=$_.PercentDiskTime > write-host "Value: $_ $Disk_Perf" > } > } > > Someone told me that I needed a "refresher object", add counters to the > object, then access values via the object. Does anyone know if this is > true? I have a file with hosts in it, then I go through this file with > $computername. > > Thanks in advance, I've used wmi performance counters in VBScript and I did need to use some kind of refresher or offset calculation. the WMI provider in powershell, AFAIK, will act in the same way (I'm sure someone will correct me if I'm wrong). the MSDN documents on this topic are numerous. This one might prove helpful, however: http://msdn2.microsoft.com/en-us/library/aa393026.aspx n |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? If you can get a copy - have a look at PowerGadgets the out-gauge cmdlet would be useful for what you are doing and you can set a refresh interval -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "n3llyb0y" wrote: > On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> said: > > > Hi, > > > > I am trying to see if using Powershell to access remote performance > > counters is a good way to go. I use to use Perfmon but the overhead > > seems to be a lot. As I am testing, I wonder if my results are > > accurate. I access these perf counters via get-wmiobject and I am only > > interested in the "_Total" instance. > > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername > > $computername | %{if ($_.Name -eq "_Total"){ > > $Disk_Perf=$_.PercentDiskTime > > write-host "Value: $_ $Disk_Perf" > > } > > } > > > > Someone told me that I needed a "refresher object", add counters to the > > object, then access values via the object. Does anyone know if this is > > true? I have a file with hosts in it, then I go through this file with > > $computername. > > > > Thanks in advance, > > I've used wmi performance counters in VBScript and I did need to use > some kind of refresher or offset calculation. the WMI provider in > powershell, AFAIK, will act in the same way (I'm sure someone will > correct me if I'm wrong). > > the MSDN documents on this topic are numerous. This one might prove > helpful, however: > http://msdn2.microsoft.com/en-us/library/aa393026.aspx > > n > > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? you might also take a look at using .NET for this, I wrote a blog entry on my old blog with some examples and that compares use WMI and .NET for performance counters : http://mow001.blogspot.com/2005/12/g...info-from.html Greetings /\/\o\/\/ http://thePowerShellGuy.com "RichS" <RichS@discussions.microsoft.com> wrote in message news:AD8EEEAB-2085-4123-AFCE-A5610ED43C2F@microsoft.com... > If you can get a copy - have a look at PowerGadgets the out-gauge cmdlet > would be useful for what you are doing and you can set a refresh interval > -- > Richard Siddaway > Please note that all scripts are supplied "as is" and with no warranty > Blog: http://richardsiddaway.spaces.live.com/ > PowerShell User Group: http://www.get-psuguk.org.uk > > > "n3llyb0y" wrote: > >> On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> >> said: >> >> > Hi, >> > >> > I am trying to see if using Powershell to access remote performance >> > counters is a good way to go. I use to use Perfmon but the overhead >> > seems to be a lot. As I am testing, I wonder if my results are >> > accurate. I access these perf counters via get-wmiobject and I am only >> > interested in the "_Total" instance. >> > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername >> > $computername | %{if ($_.Name -eq "_Total"){ >> > $Disk_Perf=$_.PercentDiskTime >> > write-host "Value: $_ $Disk_Perf" >> > } >> > } >> > >> > Someone told me that I needed a "refresher object", add counters to the >> > object, then access values via the object. Does anyone know if this is >> > true? I have a file with hosts in it, then I go through this file with >> > $computername. >> > >> > Thanks in advance, >> >> I've used wmi performance counters in VBScript and I did need to use >> some kind of refresher or offset calculation. the WMI provider in >> powershell, AFAIK, will act in the same way (I'm sure someone will >> correct me if I'm wrong). >> >> the MSDN documents on this topic are numerous. This one might prove >> helpful, however: >> http://msdn2.microsoft.com/en-us/library/aa393026.aspx >> >> n >> >> |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? If you want to use WMI not .NET, some more examples of using WMI you can find here on my new blog : http://thepowershellguy.com/blogs/po...fic-words.aspx and Hey Scripting guy ! did a column : http://www.microsoft.com/technet/scr...7/hey0326.mspx did you also note the link in the first post for http://www.leeholmes.com/blog/Access...tersInMSH.aspx you can find a cool script Lee made based on the same NG question there Greetings /\/\o\/\/ "/\/\o\/\/ [MVP]" <mow001@hotmail.NoSpam> wrote in message news:738B42F6-292C-4A21-92DC-E5C70E95A2AA@microsoft.com... > you might also take a look at using .NET for this, I wrote a blog entry on > my old blog with some examples and that compares use WMI and .NET for > performance counters : > > http://mow001.blogspot.com/2005/12/g...info-from.html > > Greetings /\/\o\/\/ > http://thePowerShellGuy.com > > > "RichS" <RichS@discussions.microsoft.com> wrote in message > news:AD8EEEAB-2085-4123-AFCE-A5610ED43C2F@microsoft.com... >> If you can get a copy - have a look at PowerGadgets the out-gauge cmdlet >> would be useful for what you are doing and you can set a refresh interval >> -- >> Richard Siddaway >> Please note that all scripts are supplied "as is" and with no warranty >> Blog: http://richardsiddaway.spaces.live.com/ >> PowerShell User Group: http://www.get-psuguk.org.uk >> >> >> "n3llyb0y" wrote: >> >>> On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> >>> said: >>> >>> > Hi, >>> > >>> > I am trying to see if using Powershell to access remote performance >>> > counters is a good way to go. I use to use Perfmon but the overhead >>> > seems to be a lot. As I am testing, I wonder if my results are >>> > accurate. I access these perf counters via get-wmiobject and I am >>> > only >>> > interested in the "_Total" instance. >>> > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername >>> > $computername | %{if ($_.Name -eq "_Total"){ >>> > $Disk_Perf=$_.PercentDiskTime >>> > write-host "Value: $_ $Disk_Perf" >>> > } >>> > } >>> > >>> > Someone told me that I needed a "refresher object", add counters to >>> > the >>> > object, then access values via the object. Does anyone know if this >>> > is >>> > true? I have a file with hosts in it, then I go through this file >>> > with >>> > $computername. >>> > >>> > Thanks in advance, >>> >>> I've used wmi performance counters in VBScript and I did need to use >>> some kind of refresher or offset calculation. the WMI provider in >>> powershell, AFAIK, will act in the same way (I'm sure someone will >>> correct me if I'm wrong). >>> >>> the MSDN documents on this topic are numerous. This one might prove >>> helpful, however: >>> http://msdn2.microsoft.com/en-us/library/aa393026.aspx >>> >>> n >>> >>> > |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? Thanks so much. I got both examples to work, although the .NET way is easier and preferred, I didn't see a way to get counters on remote hosts, so I will do it the "WMI" way. ie. (gwmi Win32_perfformatteddata_perfos_processor -computername testserver -filter "name = '_Total'").PercentprocessorTime Since this is "perfformatteddata", then this should be "cooked" and I don't have to worry about any refresher object, is this true? If so, I can be assured and go on with my project with this method Thanks, Frank "/\\/\\o\\/\\/ [MVP]" wrote: > If you want to use WMI not .NET, some more examples of using WMI you can > find here on my new blog : > > http://thepowershellguy.com/blogs/po...fic-words.aspx > > and Hey Scripting guy ! did a column : > http://www.microsoft.com/technet/scr...7/hey0326.mspx > > did you also note the link in the first post for > http://www.leeholmes.com/blog/Access...tersInMSH.aspx > you can find a cool script Lee made based on the same NG question there > > > > > Greetings /\/\o\/\/ > > "/\/\o\/\/ [MVP]" <mow001@hotmail.NoSpam> wrote in message > news:738B42F6-292C-4A21-92DC-E5C70E95A2AA@microsoft.com... > > you might also take a look at using .NET for this, I wrote a blog entry on > > my old blog with some examples and that compares use WMI and .NET for > > performance counters : > > > > http://mow001.blogspot.com/2005/12/g...info-from.html > > > > Greetings /\/\o\/\/ > > http://thePowerShellGuy.com > > > > > > "RichS" <RichS@discussions.microsoft.com> wrote in message > > news:AD8EEEAB-2085-4123-AFCE-A5610ED43C2F@microsoft.com... > >> If you can get a copy - have a look at PowerGadgets the out-gauge cmdlet > >> would be useful for what you are doing and you can set a refresh interval > >> -- > >> Richard Siddaway > >> Please note that all scripts are supplied "as is" and with no warranty > >> Blog: http://richardsiddaway.spaces.live.com/ > >> PowerShell User Group: http://www.get-psuguk.org.uk > >> > >> > >> "n3llyb0y" wrote: > >> > >>> On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> > >>> said: > >>> > >>> > Hi, > >>> > > >>> > I am trying to see if using Powershell to access remote performance > >>> > counters is a good way to go. I use to use Perfmon but the overhead > >>> > seems to be a lot. As I am testing, I wonder if my results are > >>> > accurate. I access these perf counters via get-wmiobject and I am > >>> > only > >>> > interested in the "_Total" instance. > >>> > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername > >>> > $computername | %{if ($_.Name -eq "_Total"){ > >>> > $Disk_Perf=$_.PercentDiskTime > >>> > write-host "Value: $_ $Disk_Perf" > >>> > } > >>> > } > >>> > > >>> > Someone told me that I needed a "refresher object", add counters to > >>> > the > >>> > object, then access values via the object. Does anyone know if this > >>> > is > >>> > true? I have a file with hosts in it, then I go through this file > >>> > with > >>> > $computername. > >>> > > >>> > Thanks in advance, > >>> > >>> I've used wmi performance counters in VBScript and I did need to use > >>> some kind of refresher or offset calculation. the WMI provider in > >>> powershell, AFAIK, will act in the same way (I'm sure someone will > >>> correct me if I'm wrong). > >>> > >>> the MSDN documents on this topic are numerous. This one might prove > >>> helpful, however: > >>> http://msdn2.microsoft.com/en-us/library/aa393026.aspx > >>> > >>> n > >>> > >>> > > > > |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: Powershell WMI Performance counters - refresher object needed? One last question, although I got these examples to work, the data doesn't seem to coincide with perfmon. I run perfmon collection every 10 min and looked at pages/sec and did the same with wmi, ie: (gwmi Win32_PerfFormattedData_PerfOS_Memory -computername testserver).pagespersec With perfmon, I get "5 pages persec" but with wmi, I always get 0, can you explain that for me? Thanks in advance, Frank "/\\/\\o\\/\\/ [MVP]" wrote: > If you want to use WMI not .NET, some more examples of using WMI you can > find here on my new blog : > > http://thepowershellguy.com/blogs/po...fic-words.aspx > > and Hey Scripting guy ! did a column : > http://www.microsoft.com/technet/scr...7/hey0326.mspx > > did you also note the link in the first post for > http://www.leeholmes.com/blog/Access...tersInMSH.aspx > you can find a cool script Lee made based on the same NG question there > > > > > Greetings /\/\o\/\/ > > "/\/\o\/\/ [MVP]" <mow001@hotmail.NoSpam> wrote in message > news:738B42F6-292C-4A21-92DC-E5C70E95A2AA@microsoft.com... > > you might also take a look at using .NET for this, I wrote a blog entry on > > my old blog with some examples and that compares use WMI and .NET for > > performance counters : > > > > http://mow001.blogspot.com/2005/12/g...info-from.html > > > > Greetings /\/\o\/\/ > > http://thePowerShellGuy.com > > > > > > "RichS" <RichS@discussions.microsoft.com> wrote in message > > news:AD8EEEAB-2085-4123-AFCE-A5610ED43C2F@microsoft.com... > >> If you can get a copy - have a look at PowerGadgets the out-gauge cmdlet > >> would be useful for what you are doing and you can set a refresh interval > >> -- > >> Richard Siddaway > >> Please note that all scripts are supplied "as is" and with no warranty > >> Blog: http://richardsiddaway.spaces.live.com/ > >> PowerShell User Group: http://www.get-psuguk.org.uk > >> > >> > >> "n3llyb0y" wrote: > >> > >>> On 2007-04-02 22:06:03 +0100, Frank <Frank@discussions.microsoft.com> > >>> said: > >>> > >>> > Hi, > >>> > > >>> > I am trying to see if using Powershell to access remote performance > >>> > counters is a good way to go. I use to use Perfmon but the overhead > >>> > seems to be a lot. As I am testing, I wonder if my results are > >>> > accurate. I access these perf counters via get-wmiobject and I am > >>> > only > >>> > interested in the "_Total" instance. > >>> > gwmi Win32_PerfFormattedData_PerfDisk_LogicalDisk -computername > >>> > $computername | %{if ($_.Name -eq "_Total"){ > >>> > $Disk_Perf=$_.PercentDiskTime > >>> > write-host "Value: $_ $Disk_Perf" > >>> > } > >>> > } > >>> > > >>> > Someone told me that I needed a "refresher object", add counters to > >>> > the > >>> > object, then access values via the object. Does anyone know if this > >>> > is > >>> > true? I have a file with hosts in it, then I go through this file > >>> > with > >>> > $computername. > >>> > > >>> > Thanks in advance, > >>> > >>> I've used wmi performance counters in VBScript and I did need to use > >>> some kind of refresher or offset calculation. the WMI provider in > >>> powershell, AFAIK, will act in the same way (I'm sure someone will > >>> correct me if I'm wrong). > >>> > >>> the MSDN documents on this topic are numerous. This one might prove > >>> helpful, however: > >>> http://msdn2.microsoft.com/en-us/library/aa393026.aspx > >>> > >>> n > >>> > >>> > > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Per-AppDomain CPU Performance Counters | stevenmcohn | .NET General | 1 | 08-30-2008 10:18 AM |
| How to read hardware performance counters in Windows Vista | nupurk | Vista hardware & devices | 0 | 07-16-2008 04:32 PM |
| how to use swbemrefresher object to refresh wmi performance data | John den Braber | PowerShell | 6 | 12-15-2007 01:39 PM |
| Performance monitor not able to add any counters | mvelhal@gmail.com | Vista performance & maintenance | 0 | 04-09-2007 04:15 AM |
| How do I remotely capture performance counters? | =?Utf-8?B?R2lsIE5vdmFr?= | PowerShell | 1 | 09-08-2006 09:58 AM |