Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi I have a requirement that I am trying to retrieve operating system information using IP address(system's are connected through LAN)of a remote computer system.I am able to extract the information but, only from windows 7 operating system when I am trying for XP it is giving me an exception that ,
"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
I am unable to find why it is..... please advice me,how would i rectify the problem.

Regards
Prafulla
Posted
Updated 28-May-12 22:56pm
v2

1 solution

Hi,

please check first if EnablePriviliges Property in is set to true and ImpersonationLevel is set to Impersonate.

Like this:
C#
ManagementScope scope = new ManagementScope("\\\\192.168.178.55\\root\\cimv2", options);
scope.Options.EnablePriviliges = true;
scope.Options.Impersonation = System.Management.ImpersonationLevel.Impersonate;


If you still get the exception we hat do do more research because of right privileges, try this:

General Information about your exception (copied from MS Technet):
This error occurs when the connected user is not recognized or is restricted in some fashion by the remote server (for example, the user might be locked out). This happens most often when accounts are in different domains. Recent changes to WMI security can also cause this error to occur:

Blank passwords, formerly permitted, are not allowed in Windows XP and Windows Server 2003.

WMI does not allow asynchronous callbacks to a Windows 98 client. A call like SWbemServices.ExecNotificationQueryAsync from a Windows 98 computer to a Windows XP computer will result in an Access Denied error returned to the Windows 98 machine.

The DCOM configuration access setting might have been changed.

If the target computer is running Windows XP, the Forceguest value under the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa might be set to force the Guest account off (value is zero).


Solutions:
http://msdn.microsoft.com/en-us/library/aa393266%28v=vs.85%29.aspx[^]

http://www.computerperformance.co.uk/Logon/code/code_80070005.htm[^]

Should work.
Regards
 
Share this answer
 
Comments
VJ Reddy 31-May-12 20:07pm    
Good answer. 5!
El_Codero 1-Jun-12 18:06pm    
Thank you. To OP: If solution fits to your pruposes, please accept answer, a sign for other users that it works. Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900