在同一台计算机上查询 WMI 时出现错误 80041017。 (Win32_PerfFormattedData_PerfOS_Memory)
Err 80041017 when querying WMI on identical computers. (Win32_PerfFormattedData_PerfOS_Memory)
为什么会出现错误:
Code: 80041017
Source: (null)
这一行:
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
仅在具有相同 OS(Windows 7,均具有当前更新)和相同硬件规格的两个 64 位工作站之一上。这些计算机几乎完全相同,只有一个会出错。
我已尝试 this fix 修复损坏的 WMI 数据库:
但是当我使用时:
Win32_PrinterConfiguration
而不是:
Win32_PerfFormattedData_PerfOS_Memory
我没有收到错误。
这是怎么回事?我需要做什么才能使该脚本在导致错误的工作站上运行?
EDIT1:我很确定这个错误实际上是由空 return 值引起的。如果是这样,为什么 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:查看此修复:
Hi,
Please try the following troubleshooting suggestions to check the
result:
Regsvr32 %SystemRoot%\System32\wbem\wmidcprv.dll
cd /d %windir%\system32\wbem
for %i in (*.dll) do RegSvr32 -s %i
for %i in (*.exe) do %i /RegServer
The Windows Management Instrumentation Tester window may appear, this
is normal and we can go ahead to close it.
If it does not work, I also suggest you run the following commands to
repair WMI namespace:
net stop winmgmt
wmic /NAMESPACE:\root path "__namespace.name='wmi'" delete
mofcomp %windir%\system32\wbem\wmi.mof
net start winmgmt
After that, please restart the computer to check the result. If the
issue persists, please also try the following steps:
Click the Start Button, All Programs, Accessories
Right click "Command Prompt" and choose "Run as administrator", accept the UAC prompt.
In the command prompt, type the following command and press Enter. Please type one command each time.
winmgmt /verifyrepository
winmgmt /salvagerepository
Regards,
Arthur Li
重新加载性能计数器:
cd %windir%\system32\
lodctr /R
cd %windir%\sysWOW64\
lodctr /R
请注意,上面的解决方案是我为 "solved" 这个问题所做的最后一件事;然而,我首先从 link 做了很多事情:
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 个命令解决了它。我所知道的是它现在正在运行!
为什么会出现错误:
Code: 80041017
Source: (null)
这一行:
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
仅在具有相同 OS(Windows 7,均具有当前更新)和相同硬件规格的两个 64 位工作站之一上。这些计算机几乎完全相同,只有一个会出错。
我已尝试 this fix 修复损坏的 WMI 数据库:
但是当我使用时:
Win32_PrinterConfiguration
而不是:
Win32_PerfFormattedData_PerfOS_Memory
我没有收到错误。
这是怎么回事?我需要做什么才能使该脚本在导致错误的工作站上运行?
EDIT1:我很确定这个错误实际上是由空 return 值引起的。如果是这样,为什么 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:查看此修复:
Hi,
Please try the following troubleshooting suggestions to check the result:
Regsvr32 %SystemRoot%\System32\wbem\wmidcprv.dll
cd /d %windir%\system32\wbem
for %i in (*.dll) do RegSvr32 -s %i
for %i in (*.exe) do %i /RegServer
The Windows Management Instrumentation Tester window may appear, this is normal and we can go ahead to close it.
If it does not work, I also suggest you run the following commands to repair WMI namespace:
net stop winmgmt
wmic /NAMESPACE:\root path "__namespace.name='wmi'" delete
mofcomp %windir%\system32\wbem\wmi.mof
net start winmgmt
After that, please restart the computer to check the result. If the issue persists, please also try the following steps:
Click the Start Button, All Programs, Accessories
Right click "Command Prompt" and choose "Run as administrator", accept the UAC prompt.
In the command prompt, type the following command and press Enter. Please type one command each time.
winmgmt /verifyrepository
winmgmt /salvagerepository
Regards,
Arthur Li
重新加载性能计数器:
cd %windir%\system32\
lodctr /R
cd %windir%\sysWOW64\
lodctr /R
请注意,上面的解决方案是我为 "solved" 这个问题所做的最后一件事;然而,我首先从 link 做了很多事情: 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 个命令解决了它。我所知道的是它现在正在运行!