Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DirectoryEntry computers = new DirectoryEntry("WinNT://JBVAS");//The domain
- IEnumerator enumerator = computers.Children.GetEnumerator();
- while(enumerator.MoveNext())
- {
- DirectoryEntry entry = enumerator.Current as DirectoryEntry;
- Console.WriteLine("Username: {0}{1}Password: {2}",
- entry.Username, Environment.NewLine, entry.Password);
- }
- using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
- {
- // code that executes under the new context
- }
Add Comment
Please, Sign In to add comment