I am trying to create the directory entry of a computer using the following statements :
try{
String Path = String.Format("WinNT://{0}", machineName);
DirectoryEntry de = new DirectoryEntry(Path);
de.Username = AdminName;
de.Password = password;
if (de.Guid!= null)
{
Console.Writeline("Exiting the method. Returning the created directory entry for the path = " + de.Path + "and Administrator Account " + de.Username);
}
}
catch (COMException exception)
{
Console.WriteLine("Got the exception"+exception.Message);
throw new Exception(exception.Message);
}
Here I am using a user who is a member of Administrators group to login.Also with the same credentials I am able to remote desktop to the system. I am getting the following error of type UnauthorizedAccessException :
"Access is denied" and error code : -2147024891
↧
Not able to get the directory entry of a Remote Windows 2008 r2 machine
↧