使用PowerShell获得反击性能

时间:2014-04-25 11:59:44

标签: powershell performancecounter

我正在尝试获取有关iis请求的信息,但是当我尝试通过此方式获得计数器性能时:

Get-WmiObject Win32_PerfRawData_ASP_ActiveServerPages

我收到以下错误:

Get-WmiObject : Invalid class
At line:1 char:21
+ $totob=Get-WmiObject <<<<  Win32_PerfRawData_ASP_ActiveServerPages
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

2 个答案:

答案 0 :(得分:0)

性能计数器库可能会损坏并且必须重建。

这篇知识库文章介绍了重建计数器库的过程。

http://support.microsoft.com/kb/300956

答案 1 :(得分:0)

首先关于wihch系统你在试验这个问题吗?

你可以尝试:

Get-WMIObject -List| Where{$_.name -match "^Win32_.*_ASP.*"} | Sort Name | Format-Table name

以下是我的W2K8R2服务器上的结果:

Win32_PerfFormattedData_ASP_ActiveServerPages
Win32_PerfFormattedData_ASPNET_ASPNET
Win32_PerfFormattedData_ASPNET_ASPNETApplications
Win32_PerfFormattedData_ASPNET2050727_ASPNETAppsv2050727
Win32_PerfFormattedData_ASPNET2050727_ASPNETv2050727
Win32_PerfFormattedData_ASPNET4030319_ASPNETAppsv4030319
Win32_PerfFormattedData_ASPNET4030319_ASPNETv4030319
Win32_PerfFormattedData_aspnetstate_ASPNETStateService
Win32_PerfRawData_ASP_ActiveServerPages
Win32_PerfRawData_ASPNET_ASPNET
Win32_PerfRawData_ASPNET_ASPNETApplications
Win32_PerfRawData_ASPNET2050727_ASPNETAppsv2050727
Win32_PerfRawData_ASPNET2050727_ASPNETv2050727
Win32_PerfRawData_ASPNET4030319_ASPNETAppsv4030319
Win32_PerfRawData_ASPNET4030319_ASPNETv4030319
Win32_PerfRawData_aspnetstate_ASPNETStateService

以下是我的Window 8

的结果
Win32_PerfFormattedData_ASPNET_ASPNET                                                                                     
Win32_PerfFormattedData_ASPNET_ASPNETApplications                                                                         
Win32_PerfFormattedData_ASPNET4030319_ASPNETAppsv4030319                                                                  
Win32_PerfFormattedData_ASPNET4030319_ASPNETv4030319                                                                      
Win32_PerfFormattedData_aspnetstate_ASPNETStateService                                                                    
Win32_PerfRawData_ASPNET_ASPNET                                                                                           
Win32_PerfRawData_ASPNET_ASPNETApplications                                                                               
Win32_PerfRawData_ASPNET4030319_ASPNETAppsv4030319                                                                        
Win32_PerfRawData_ASPNET4030319_ASPNETv4030319                                                                            
Win32_PerfRawData_aspnetstate_ASPNETStateService   

服务W3SVC未运行的地方。