【问题标题】:Err 80041017 when querying WMI on identical computers. (Win32_PerfFormattedData_PerfOS_Memory)在相同计算机上查询 WMI 时出现错误 80041017。 (Win32_PerfFormattedData_PerfOS_Memory)
【发布时间】:2018-01-26 18:00:22
【问题描述】:

为什么会出错:

代码:80041017
来源:(空)

在这一行:

For Each oItem In colItems

在这个 VBScript 中:

strComputer = "."

Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
           & strComputer & "\root\cimv2")
Set cItems = oWMI.ExecQuery("Select * from Win32_PerfFormattedData_PerfOS_Memory")
'wsh.echo cItems.Count

Display "Win32_PerfFormattedData_PerfOS_Memory", FillCol(cItems)

function FillCol(colItems)
  Dim oItem, oProp, s

  For Each oItem In colItems
    For Each oProp In oItem.Properties_
      s =  s & oProp.Name & vbcrlf
      's =  s & oProp.Name & vbtab & oProp.Value & vbcrlf
    Next 'oProp
    Exit For
  Next 'oItem

  FillCol = s
End Function 'FillCol

Sub Display(sTitle, s)
  'Display results in a scrollable window
  height = 600 : width = 800
  Set oIE = CreateObject("InternetExplorer.Application")
  With oIE
    .RegisterAsDropTarget = False
    .Toolbar = False : menubar = False : statusbar = False
    .Width = Width : .Height = Height
    .Navigate "about:blank"
    Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop
    With .Document
      .Open
      .Write  "<xmp>" & s & "</xmp>"
      .Close
      .Title = sTitle
    End With
    .Visible = True
  End With 'oIE
End Sub

直接取自this link,除了我改了:

Win32_PrinterConfiguration

收件人:

Win32_PerfFormattedData_PerfOS_Memory

仅在具有相同操作系统(Windows 7,均具有最新更新)和相同硬件规格的两个 64 位工作站中的一个上。两台电脑几乎一模一样,只有一台会出错。

我已尝试this fix 修复损坏的 WMI 数据库:

但是当我使用时:

Win32_PrinterConfiguration

代替:

Win32_PerfFormattedData_PerfOS_Memory

我没有收到错误消息。

发生了什么事?我需要做什么才能让该脚本在导致错误的工作站上运行?

EDIT1:我很确定错误实际上是由空返回值引起的。如果是这样,为什么 RAM 有一个空值?那应该是。对吧?

EDIT2:请对要尝试或猜测的事情发表评论。

EDIT3:WMI 诊断工具 (https://www.microsoft.com/en-us/download/details.aspx?id=7684) 表示:

28944 14:15:48 (1) !! ERROR: WMI GET operation errors reported: ........................................................................... 118 ERROR(S)! 28945 14:15:48 (0) ** - Root/CIMV2, Win32_PerfFormattedData_Counters_HTTPServiceRequestQueues, 0x0 - . 28946 14:15:48 (0) ** MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)' 28947 14:15:48 (0) ** - Root/CIMV2, Win32_PerfRawData_Counters_HTTPServiceRequestQueues, 0x0 - . 28948 14:15:48 (0) ** MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)' 28949 14:15:48 (0) ** - Root/CIMV2, Win32_PerfFormattedData_Counters_HTTPServiceUrlGroups, 0x0 - . 28950 14:15:48 (0) ** MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)' 28951 14:15:48 (0) ** - Root/CIMV2, Win32_PerfRawData_Counters_HTTPServiceUrlGroups, 0x0 - . 28952 14:15:48 (0) ** MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

...等等...

29069 14:15:48 (0) ** - Root/CIMV2, Win32_PerfFormattedData_PerfOS_Memory, 0x0 - . 29070 14:15:48 (0) ** MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

...等等...

虽然还不确定如何处理这些。

EDIT4:查看此修复:

嗨,

请尝试以下故障排除建议以检查 结果:

Regsvr32 %SystemRoot%\System32\wbem\wmidcprv.dll

cd /d %windir%\system32\wbem

for %i in (*.dll) do RegSvr32 -s %i

对于 (*.exe) 中的 %i 执行 %i /RegServer

可能会出现 Windows Management Instrumentation Tester 窗口,这 是正常的,我们可以继续关闭它。

如果还是不行,我还建议你运行以下命令 修复 WMI 命名空间:

net stop winmgmt

wmic /NAMESPACE:\root path "__namespace.name='wmi'" 删除

mofcomp %windir%\system32\wbem\wmi.mof

net start winmgmt

之后,请重新启动计算机以查看结果。如果 问题依旧,请尝试以下步骤:

  1. 点击开始按钮、所有程序、附件

  2. 右击“命令提示符”,选择“以管理员身份运行”,接受UAC提示。

  3. 在命令提示符下,键入以下命令并按 Enter。请每次输入一个命令。

winmgmt /verifyrepository

winmgmt /salvagerepository

问候,

李亚瑟

来自: https://social.technet.microsoft.com/Forums/windows/en-US/df00b2e4-3bab-4b46-ad5a-95e82617a039/wmi-errors?forum=winserverNIS

【问题讨论】:

  • 欢迎来到 WMI 的不一致世界。
  • 听起来你有这方面的经验。您过去是如何解决的?
  • 老实说,我从来没有找到解决方案,最后不得不重建有问题的电脑,即使那样也不能保证它会工作。如果 WMI 决定它不喜欢硬件方面的某些东西,那么您就无能为力了。

标签: windows vbscript wmi windows-7-x64 wmi-query


【解决方案1】:

重新加载性能计数器:

cd %windir%\system32\
lodctr /R
cd %windir%\sysWOW64\
lodctr /R

在这里找到: https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Performance_counters_are_not_working_or_missing_in_PerfMon

请注意,上面的解决方案是我“解决”问题的最后一件事;但是,我首先从这个链接做了很多事情: https://kb.paessler.com/en/topic/3713-i-have-tried-a-lot-of-things-to-fix-my-wmi-what-else-can-i-try-to-avoid-reinstalling-windows?utm_source=google&utm_medium=cpc&utm_campaign=USA_EN_DSA_KB_Pages&utm_adgroup=USA_EN_DSA_KB&utm_adnum=dsa_en_04&utm_campaignid=657889421&utm_adgroupid=34407076718&utm_targetid=dsa-256625615450&utm_customerid=779-315-3659&utm_location=9028770&gclid=EAIaIQobChMI_8zX88KP2QIVVQOGCh2S-gIMEAAYASAAEgIZtvD_BwE

不确定我所做的事情的组合是否解决了它,或者我作为答案输入的 4 个命令是否解决了它。我只知道它现在正在运行!

【讨论】:

    猜你喜欢
    • 2012-04-14
    • 1970-01-01
    • 1970-01-01
    • 2016-01-23
    • 1970-01-01
    • 2020-12-03
    • 2011-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多