I have a problem getting an IADsContainer object from ADsOpenObject() by using the WinNT provider from a service on a remote machine.
I've been able to get the code working in the following scenarios except number 4
- My application is deployed on the same machine to which it connects(localhost).
- My application is deployed as a Local Service on the same machine to which it connects(localhost).
- My application is deployed on a remote machine and it connects by providing an IP.
- My application is deployed on a remote machine as a Local Service and it connects by providing an IP.
#include <iostream>
#include <Adshlp.h>
#include <comdef.h>
IADsContainer* container = nullptr;
HRESULT hres = ADsOpenObject( L"WinNT://192.168.1.30", L"Administrator", L"someAdminPass", ADS_SECURE_AUTHENTICATION | ADS_READONLY_SERVER, IID_IADsContainer, (void**)&container );
if( SUCCEEDED(hres) )
{
// do stuff with the container object
}
else
{
_com_error err( hres );
LPCTSTR errMsg = err.ErrorMessage();
std::wcout << errMsg;
}
I expect hres to be S_OK and valid 'container' pointer but I only get E_FAIL with error string "Unspecified error"