Hi,
when try w3ith this code to access the remote computer
Dim options As ConnectionOptions = New ConnectionOptions
options.Username = "shambhuremote"
options.Password = "tempPassword"
options.Impersonation = ImpersonationLevel.Impersonate
options.Authentication = AuthenticationLevel.Connect
options.EnablePrivileges = True
Dim path As ManagementPath = New ManagementPath("\\remote124\root\cimv2")
Dim scope As ManagementScope = New ManagementScope(path, options)
scope.Options.EnablePrivileges = True
scope.Connect()
Dim query As ObjectQuery
query = New ObjectQuery("SELECT * FROM Win32_OperatingSystem")
Dim searcher As ManagementObjectSearcher
searcher = New ManagementObjectSearcher(scope, query)
Dim queryCollection As ManagementObjectCollection
queryCollection = searcher.Get()
Dim m As ManagementObject
For Each m In queryCollection
' Display the remote computer information
Dim sRes As StringBuilder = New StringBuilder()
sRes.Append("Computer Name : {0}", m("csname"))
sRes.Append("Windows Directory : {0}", m("WindowsDirectory"))
sRes.Append("Operating System: {0}", m("Caption"))
sRes.Append("Version: {0}", m("Version"))
sRes.Append("Manufacturer : {0}", m("Manufacturer"))
Next
it is saying :System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
scope.Connect() at this line i am getting the error.
How to resolve this error.