StackExchange / wmi

WMI for Go
http://godoc.org/github.com/StackExchange/wmi
MIT License
433 stars 173 forks source link

Invilad class of Win32_PerfRawData_HvStats_HyperVHypervisor #32

Closed kelein closed 5 years ago

kelein commented 7 years ago

I have found some property about HyperV in Win32_PerfRawData, such as Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor, Win32_PerfRawData_HvStats_HyperVHypervisor, etc.

But when I use the WMI interface to query those property it occurs error. I use it this way:

    var dst []Win32_PerfRawData_HvStats_HyperVHypervisor
    q := wmi.CreateQuery(&dst, "")
    if err := wmi.Query(q, &dst); err != nil {
        return nil, err

It return this: nil 发生意外。 (无效类 ).

The WQL I printed is:

SELECT LogicalProcessors, MonitoredNotifications, Partitions, TotalPages, VirtualProcessors FROM Win32_PerfRawData_HvStats_HyperVHypervisor

So I query it in windows power shell with the command winrm just like this: winrm enum wmi\root\cimv2\* -filter:"select * from Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor where name='LogicalProcessor'";

PS C:\Users\kallen> winrm enum wmi\root\cimv2\* -filter:"select * from Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor where name='LogicalProcessor'";
WSManFault
    Message = WS-Management 服务无法处理该请求。在 WS-Management 编录中找不到资源 URI (wmi\root\cimv2\*)。 该编录包含描述资源或逻辑终结点的元数据。

错误编号: -2144108485 0x8033803B
WS-Management 服务无法处理该请求。缺少资源 URI 或其格式不正确。 请检查文档或使用以下命令以获取有关如何创建资源 URI 的信息: "winrm help uris"。
PS C:\Users\kallen> winrm enum wmi/root/cimv2/* -filter:"select * from Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor where name='LogicalProcessor'";
Fault
    Code
        Value = s:Sender
        Subcode
            Value = n:CannotProcessFilter
    Reason
        Text = 数据源无法处理筛选器。该筛选器可能丢失或无效。 更改筛选器,然后重试请求。
    Detail
        MSFT_WmiError
            CIMStatusCode = 5
            CIMStatusCodeDescription = null
            ErrorSource = null
            ErrorSourceFormat = 0
            ErrorType = 0
            Message = 给定命名空间中没有指定类。
            MessageID = HRESULT 0x8033801a
            OtherErrorSourceFormat = null
            OtherErrorType = null
            OwningEntity = null
            PerceivedSeverity = 0
            ProbableCause = 0
            ProbableCauseDescription = null
            error_Category = 5
            error_Code = 2150858778
            error_Type = HRESULT
            error_WindowsErrorMessage = 给定命名空间中没有指定类。

错误编号: -2144108518 0x8033801A
数据源无法处理筛选器。该筛选器可能丢失或无效。 更改筛选器,然后重试请求。
PS C:\Users\kallen>

I have start the service of HyperV on Windows 10 yet.