Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 查询“Win32_产品”WMI类时出错-COMException(0x800706BE)_C#_Events_Powershell_Wmi_Windows Server 2008 - Fatal编程技术网

C# 查询“Win32_产品”WMI类时出错-COMException(0x800706BE)

C# 查询“Win32_产品”WMI类时出错-COMException(0x800706BE),c#,events,powershell,wmi,windows-server-2008,C#,Events,Powershell,Wmi,Windows Server 2008,我试图在本地收集每个服务器上安装的所有软件,并且为此使用Win32_产品WMI类,但是在一些使用Win server 2003或2008 R2的服务器上,我无法查询此类 以下是PowerShell的输出: C:\Users\e****l> Get-WmiObject -Query "SELECT * FROM Win32_Product" Get-WmiObject : At line:1 char:14 + Get-WmiObject <<<< -Query "

我试图在本地收集每个服务器上安装的所有软件,并且为此使用Win32_产品WMI类,但是在一些使用Win server 2003或2008 R2的服务器上,我无法查询此类

以下是PowerShell的输出:

C:\Users\e****l> Get-WmiObject -Query "SELECT * FROM Win32_Product"
Get-WmiObject :
At line:1 char:14
+ Get-WmiObject <<<<  -Query "SELECT * FROM Win32_Product"
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
这是这个的输出:

Unhandled Exception: System.Runtime.InteropServices.COMException (0x800706BE)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
   at WMISample.MyWMIQuery.Main()
Windows日志显示此事件

我会感谢你的帮助,
谢谢

您的WMI存储库是否已损坏?您可以在这些系统上查询WMI中的任何内容吗?例如,我可以毫无问题地查询Win32_OperatingSystem类。值得一提的是,WMI存储库损坏可能会按类发生。因此,存储库中可能存在损坏,但仍然能够查询某些类,这是一个坏主意。微软建议不要这样做。只是谷歌win32产品是最邪恶的,大多数人会看卸载注册表项。有很多PowerShell脚本可以做到这一点。
Unhandled Exception: System.Runtime.InteropServices.COMException (0x800706BE)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
   at WMISample.MyWMIQuery.Main()