Access Denied for Remote Host
-
I am using WMI in VC++. But there is to be a problem when i try to connect to a Remote Host . The machine I am trying to connect has Windows 2000 on it and I have Windows XP installed on my machine. Here is the code - // Initialize Security hrRetVal = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0); // CreateInstance hrRetVal = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IWbemLocator, (void **) &pWbemLocator); BSTR bsNameSpace = SysAllocString(L"//impartials/root/cimv2"); BSTR bsUserName = SysAllocString(L"dchauhan"); BSTR bsPassword = SysAllocString(L"rajvada"); // Connect to the Server hrRetVal = pWbemLocator->ConnectServer(bsNameSpace, bsUserName, bsPassword, 0, NULL, NULL, 0, &pWbemServices); // Query the Proxy Blanket for Authorization Level hrRetVal = CoQueryProxyBlanket(pWbemServices, NULL, NULL, NULL, &dwAuthLevel, NULL, NULL, NULL); // Set the Proxy Blanket to the Authorization Level hrRetVal = CoSetProxyBlanket(pWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NAME, NULL, dwAuthLevel, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); // Execute Query hrRetVal = pWbemServices->ExecQuery(L"WQL", L"Select * from Win32_Service", WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumObject); Over here, i receive an Access Denied error. I am not getting what is the problem. Any help would be appreciated. TobeyMag