Guest User

Untitled

a guest
Jul 12th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. DirectoryEntry computers = new DirectoryEntry("WinNT://JBVAS");//The domain
  2. IEnumerator enumerator = computers.Children.GetEnumerator();
  3. while(enumerator.MoveNext())
  4. {
  5. DirectoryEntry entry = enumerator.Current as DirectoryEntry;
  6. Console.WriteLine("Username: {0}{1}Password: {2}",
  7. entry.Username, Environment.NewLine, entry.Password);
  8. }
  9.  
  10. using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
  11. {
  12. // code that executes under the new context
  13. }
Add Comment
Please, Sign In to add comment