【问题标题】:WMI Win32_Directory fail in For-loop with error 800706BE The remote procedure call failedWMI Win32_Directory 在 For 循环中失败,错误 800706BE 远程过程调用失败
【发布时间】:2013-03-24 07:29:44
【问题描述】:

我在询问之前进行了搜索,但没有找到任何适用于我的代码的内容。我尝试过的也在代码中进行了注释。错误 800706BE (远程过程调用失败) 出现在 For..Next 循环中,并且每次都会以不同的随机迭代次数打破循环。 我错过了什么以及如何修复该(简单)代码?

'List All the Folders on a Computer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'With objWMIService.Security_
'    .impersonationlevel = 3
'    For I = 1 To 27
'        .Privileges.Add(I)
'    Next
'End With '--------------------------not help at all!
Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory")
cnt = 0
'Do Until IsObject(colFolders) '-----not help at all!
'    WScript.Sleep 500
'Loop
On Error Resume Next 'enabled to get extra info from SWbemLastError
For Each objFolder In colFolders
    Wscript.Echo objFolder.Name
    cnt = cnt + 1
'    WScript.Sleep 10 '--------------that make it worst!
Next '---------------the error appear always at this line----------
If Err Then
    Wscript.Echo Err.Number, Err.Description, Err.Source
    Set lastErr = CreateObject("WbemScripting.SWbemLastError")
    Wscript.Echo lastErr.Operation
End If
Wscript.Echo "LastIter.: " & cnt
'-2147023170
'ExecQuery
'LastIter.: 2152 or 1592 or 1314 or 959 ... varied random

WBEM 测试:

P.S. 我对System Restore 进行了一些测试,以测试一个假设并恢复到上次 Windows 安全更新前几天,猜猜怎么着?现在我得到不同的错误:80041033“正在关机”。在Undo Last Restore 之后更加困惑,我仍然收到相同的错误(正在关闭)。这没有意义。

【问题讨论】:

  • 事件日志中有什么内容吗?您是否与WBEMtest 和/或WMIDiag 核对过?
  • 感谢回复,我用WBEMTest测试过,会发截图
  • 您是否尝试按照here 的描述修复 WMI?
  • 是的,谢谢,但可能为时已晚,因为我在害怕 WMIDiag 的报告中使用所有建议并炸毁一些丑陋的混乱(损坏的应用程序),现在没有任何帮助了,仍然是相同的存储库文件失踪报告。我可以以某种方式完全重新安装 WMI 吗?
  • 如果修复失败我相信你将不得不硬着头皮重新安装系统。我不知道任何其他方式。

标签: for-loop vbscript wmi wmi-query


【解决方案1】:

你试过 sfc /scannow 了吗? 我没有看到提到这涉及哪个 Windows 平台。 XP、Vista、7、8.x、10 预览版? 32位,64位?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-13
    • 1970-01-01
    • 2017-02-03
    • 2021-12-29
    • 2020-07-30
    相关资源
    最近更新 更多