错误:0x80041001 运行 VBScript 枚举软件时 [英] Error: 0x80041001 when running VBScript to enumerate software
问题描述
当我在 windows8.1 机器上运行 VBScript 时,出现以下错误.相同的代码在其他机器上成功运行.
When I ran a VBScript on a windows8.1 machine, I got the following error. Same code ran successfully on other machines.
Error: 0x80041001
Code: 80041001
Source: (null)
The error line is 'For each ...'
代码:
'obtain collection of Windows Installer packages
Set MSIapps = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2").ExecQuery("select * from Win32_Product where Name like 'Cisco%'")
'enumerate the names of the packages in the collection
For each App in MSIapps
version = App.Version
installDIR = App.InstallLocation
Next
推荐答案
理论上,由 启动和停止 WMI 服务:
WMI 作为显示名称为Windows Management"的服务运行Instrumentation"和服务名称winmgmt".WMI 运行在本地系统帐户下的系统启动时自动.如果 WMI未运行,第一次管理时自动启动应用程序或脚本请求连接到 WMI 命名空间.
WMI runs as a service with the display name "Windows Management Instrumentation" and the service name "winmgmt". WMI runs automatically at system startup under the LocalSystem account. If WMI is not running, it automatically starts when the first management application or script requests connection to a WMI namespace.
您的 winmgmt
服务似乎因某种原因停止工作.在命令提示符下(以管理员身份运行),输入 net start winmgmt
并观察输出消息.
Looks like your winmgmt
service has stopped working for some reason. At a command prompt (run as administrator), enter net start winmgmt
and watch output message.
使用 services.msc
将服务配置为自动运行或遵循例如常寅对WMI 损坏 - 如何重新安装/修复?.
Configure the service to run automatically with services.msc
or follow e.g. Chang Yin's answer to WMI corrupt - how to reinstall/repair?.
这篇关于错误:0x80041001 运行 VBScript 枚举软件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!