Combreal

simpleLDAPReq01.ps1

Sep 22nd, 2020 (edited)
1,053
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #need empty libne at the end
  2. $cred = Get-Credential  -credential mjolly-adm@ad.inria.fr
  3. $username = $cred.username
  4. $password = $cred.GetNetworkCredential().password
  5.  
  6. $de = New-Object System.DirectoryServices.DirectoryEntry("LDAP://ad.inria.fr", $username, $password)
  7.  
  8. $searcher = New-Object System.DirectoryServices.DirectorySearcher($de,"(&(objectCategory=Computer)(CN=ZEUS))")
  9.  
  10. $searcher.FindOne().GetDirectoryEntry()
  11.  
  12.  
RAW Paste Data