Quantcast
Channel: Remote Desktop Services (Terminal Services) forum
Viewing all articles
Browse latest Browse all 21489

Not able to get the directory entry of a Remote Windows 2008 r2 machine

$
0
0

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

                                                                                                          

Viewing all articles
Browse latest Browse all 21489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>