ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); ManagementObjectCollection queryCollection = searcher.Get();
Above code throws the following exception please Help..i read in some article that this error are thrown due to WMI corruption?Is this the case?do i have to rebuild WMI or is there any alternate?or a better solution
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at System.Management.ManagementScope.InitializeGuts(Object o) at System.Management.ManagementScope.Initialize() at System.Management.ManagementScope.Connect() at WebApplication3.lanusers.Button1_Click1(Object sender, EventArgs e) in C:\Users\user\documents\visual studio 2010\Projects\WebApplication3\WebApplication3\lanusers.aspx.cs:line 120 IpAddress192.168.1.55HostNamenkn-PC
The Error code
0x80070005 is related to the WMI permissions.
0x8007xxx : Errors originating in the core operating system. WMI may return this type of error because of an external failure, for example, DCOM security failure.
In order to fix this error you must set the proper permissions in the client and server machines. Try these links
Also Please allow the app "windows management instrumentation (wmi)" to communicate through windows firewall. Please refer this link for more info. https://social.msdn.microsoft.com/Forums/vstudio/en-US/6229334e-d5ef-4016-9e7e-1c8718be8d43/access-is-denied-exception-from-hresult-0x80070005-eaccessdenied-in-vbnet?forum=netfxbcl
0x80070005 usually relates to permission denied to the cache files, so make sure they've the right permissions.
For example go to
/Users/Public/Application Data/Package Cache folder (or other folder) and make sure that the folders and files there has the right permissions. Otherwise find out which temporary/cache files are causing the issue and remove them.
User contributions licensed under CC BY-SA 3.0