G
Guest
I wanted to know why the output is different & also like to know if C# i can
get the user name using DirectoryEntry > find.
C#
String myADSPath = ("WinNT://"+
Environment.MachineName+",computer");
DirectoryEntry m_drentry = new DirectoryEntry(myADSPath);
// "admin" is user name
DirectoryEntry m_secentry = m_drentry.Children.Find("admin");
m_txt1.Text = m_drentry.Name ; // Output is the name of Computer
Managed C++
String *adsPath = String::Format(S"WinNT://{0},computer",
Environment::MachineName);
DirectoryEntry *computerEntry = new DirectoryEntry(adsPath);
DirectoryEntry *userEntry = computerEntry->Children->Find (S"Admin");
m_txText->Text = userEntry->Name; //Output is the User Name
get the user name using DirectoryEntry > find.
C#
String myADSPath = ("WinNT://"+
Environment.MachineName+",computer");
DirectoryEntry m_drentry = new DirectoryEntry(myADSPath);
// "admin" is user name
DirectoryEntry m_secentry = m_drentry.Children.Find("admin");
m_txt1.Text = m_drentry.Name ; // Output is the name of Computer
Managed C++
String *adsPath = String::Format(S"WinNT://{0},computer",
Environment::MachineName);
DirectoryEntry *computerEntry = new DirectoryEntry(adsPath);
DirectoryEntry *userEntry = computerEntry->Children->Find (S"Admin");
m_txText->Text = userEntry->Name; //Output is the User Name