From c368da1fe8941287070dd45bfaaea15cf1f36667 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20MARECHAL?= <bmarechal@grandlyon.com>
Date: Thu, 10 Nov 2022 15:02:22 +0000
Subject: [PATCH] Update README.md

---
 README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 7318ba0..c396de6 100644
--- a/README.md
+++ b/README.md
@@ -48,16 +48,59 @@ Write-Host ($webcall | Format-Table | Out-String)
 ```
 
 
+<!-- 
+
 ## Client DNS
 
 DNS discovery
 DNS Test : Ip resolution from Host
 
+-->
+
+## Client LDAP
+
+> If you want a GUI LDAP client, get the free LDAP Browser 4.5 (not the paid administrator version). 
+
+```powershell
+$LDAP_PROTOCOL="ldap"              # or ldaps
+$LDAP_HOST=                      # ex: ldap.domain.tld
+$LDAP_PORT="389"                   # default : 389 (LDAP), 636 (LDAPS)
+$LDAP_URL=$LDAP_PROTOCOL://$LDAP_HOST:$LDAP_PORT
+$LDAP_USERS_BASE=
+$LDAP_BIND_FORMAT=
+$LDAP_GROUPE_ATTRIBUT=
+$LDAP_USERS_CONNECTION_STRING=
+$LDAP_USER_CONNECTION_STRING=
+$LDAP_BIND_READONLY_USER_DN=
+$LDAP_USER_DN=
 
+$LDAP_FILTER=
 
-Client LDAP
-LDAP Parameters
-LDAP Test
+$LDAP_ATTR="*"                     # * for "For all attributs", ex: givenName, sn, mail, uid
+```
+
+Check user exist : 
+```powershell
+[adsi]"$LDAP_USER_CONNECTION_STRING"
+```
+
+
+```powershell
+Function Test-ADUserAuthentication {
+    param(
+    [parameter(Mandatory=$true)]
+    [string]$ADUserLogin,
+    [parameter(Mandatory=$true)]
+    [string]$ADUserPassword)
+    ((New-Object DirectoryServices.DirectoryEntry -ArgumentList "",$ADUserLogin,$ADUserPassword).psbase.name) -ne $null
+}
+
+$ADUserLogin = "account"
+$ADUserPassword = "pass"
+
+Test-ADUserAuthentication -ADUserLogin $ADUserLogin -ADUserPassword $ADUserPassword
+
+```
 
 
 
-- 
GitLab