{"version":"1.0","provider_name":"Ana Borrego Toledo","provider_url":"https:\/\/aborrego.inscastellbisbal.net\/en","author_name":"aborrego","author_url":"https:\/\/aborrego.inscastellbisbal.net\/en\/author\/aborrego\/","title":"Connexi\u00f3 client Windows - Ana Borrego Toledo","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"tR3jiRmjC4\"><a href=\"https:\/\/aborrego.inscastellbisbal.net\/en\/2026\/04\/09\/connexio-client-windows-2\/\">Connexi\u00f3 client Windows<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/aborrego.inscastellbisbal.net\/en\/2026\/04\/09\/connexio-client-windows-2\/embed\/#?secret=tR3jiRmjC4\" width=\"600\" height=\"338\" title=\"&#8220;Connexi\u00f3 client Windows&#8221; &#8212; Ana Borrego Toledo\" data-secret=\"tR3jiRmjC4\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script>\n\/*! This file is auto-generated *\/\n!function(d,l){\"use strict\";l.querySelector&&d.addEventListener&&\"undefined\"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!\/[^a-zA-Z0-9]\/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret=\"'+t.secret+'\"]'),o=l.querySelectorAll('blockquote[data-secret=\"'+t.secret+'\"]'),c=new RegExp(\"^https?:$\",\"i\"),i=0;i<o.length;i++)o[i].style.display=\"none\";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute(\"style\"),\"height\"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):\"link\"===t.message&&(r=new URL(s.getAttribute(\"src\")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener(\"message\",d.wp.receiveEmbedMessage,!1),l.addEventListener(\"DOMContentLoaded\",function(){for(var e,t,s=l.querySelectorAll(\"iframe.wp-embedded-content\"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute(\"data-secret\"))||(t=Math.random().toString(36).substring(2,12),e.src+=\"#?secret=\"+t,e.setAttribute(\"data-secret\",t)),e.contentWindow.postMessage({message:\"ready\",secret:t},\"*\")},!1)))}(window,document);\n\/\/# sourceURL=https:\/\/aborrego.inscastellbisbal.net\/wp-includes\/js\/wp-embed.min.js\n<\/script>","description":"connexi\u00f3 client windows Tornar al repte 2.3 1. Que es la connexio d&#8217;un client al LDAP? Connectar un client Windows al servidor LDAP permet que la maquina client pugui consultar el directoricorporatiu per obtenir informacio d&#8217;usuaris i grups. Aixo es fa instal\u00b7lant eines com ldap-utils quepermeten fer consultes directes al servidor LDAP amb el comando ldapsearch.Amb la connexio establerta, el client pot verificar que els usuaris del directori LDAP existeixen i obtenir lesseves dades (nom, UID, grup, directori home, etc.). Pas 1 \u2014 Configuraci\u00f3 de xarxa i visibilitat S&#8217;ha comprovat que el client Windows t\u00e9 la IP 192.168.0.5 i el servidor Debian la 192.168.0.156. S&#8217;ha verificat la connectivitat b\u00e0sica mitjan\u00e7ant un ping. Pas 2 \u2014 Resoluci\u00f3 de noms local Per evitar errors de connexi\u00f3, s&#8217;ha editat el fitxer de hosts de Windows (C:WindowsSystem32driversetchosts) afegint la l\u00ednia: 192.168.0.156 equipo2.es Pas 3 \u2014 Prova de connexi\u00f3 al port LDAP S&#8217;ha utilitzat PowerShell per confirmar que el port 389 del servidor est\u00e0 obert: Test-NetConnection -ComputerName 192.168.0.156 -Port 389 Resultat: TcpTestSucceeded : True. Test-NetConnection -ComputerName 192.168.0.156 -Port 389 Pas 3 \u2014 Execuci\u00f3 de la prova de connexi\u00f3 S&#8217;ha programat un script en PowerShell utilitzant la classe System.DirectoryServices.Protocols.LdapConnection. S&#8217;utilitza PowerShell per carregar les llibreries de protocols de directori de .NET.\u00a0 Credencials: cn=admin,dc=equipo2,dc=es \/ Admin123. # 1. Configuraci&oacute; de dades $LdapServer = &quot;192.168.0.156&quot; $UserDN = &quot;cn=admin,dc=equipo2,dc=es&quot; $Password = &quot;Admin123&quot; # 2. Carregar llibreria .NET Add-Type -AssemblyName System.DirectoryServices.Protocols try { # 3. Establir connexi&oacute; $conn = New-Object System.DirectoryServices.Protocols.LdapConnection &quot;${LdapServer}:389&quot; $conn.SessionOptions.ProtocolVersion = 3 $conn.AuthType = [System.DirectoryServices.Protocols.AuthType]::Basic # 4. Bind (Autenticaci&oacute;) $credential = New-Object System.Net.NetworkCredential($UserDN, $Password) $conn.Bind($credential) Write-Host &quot;`n\u2705 CONNEXI&Oacute; EXITOSA!&quot; -ForegroundColor Green Write-Host &quot;S&#039;ha establert el lligam (bind) amb el servidor Debian.`n&quot; -ForegroundColor Gray # 5. Prova de lectura: Llistar el contingut de l&#039;arrel Write-Host &quot;Cercant objectes a dc=equipo2,dc=es...&quot; $request = New-Object System.DirectoryServices.Protocols.SearchRequest(&quot;dc=equipo2,dc=es&quot;, &quot;(objectClass=*)&quot;, &quot;Subtree&quot;) $response = $conn.SendRequest($request) Write-Host &quot;S&#039;han trobat $($response.Entries.Count) objectes a la base de dades.&quot; -ForegroundColor Cyan foreach ($entry in $response.Entries) { Write-Host &quot; -&gt; DN: $($entry.DistinguishedName)&quot; } } catch { Write-Host &quot;`n\u274c ERROR: $($_.Exception.Message)&quot; -ForegroundColor Red } finally { if ($conn) { $conn.Dispose() } } Conclusi\u00f3 La connexi\u00f3 s&#8217;ha realitzat correctament. Tot i que Windows 10 no s&#8217;ha unit a un &#8220;Domini&#8221; d&#8217;Active Directory en el sentit cl\u00e0ssic (per limitacions de l&#8217;entorn), s&#8217;ha demostrat la interoperabilitat total entre el sistema operatiu de Microsoft i el servei de directori OpenLDAP de Linux mitjan\u00e7ant protocols est\u00e0ndard. S&#8217;ha programat un script en PowerShell utilitzant la classe System.DirectoryServices.Protocols.LdapConnection. Credencials: cn=admin,dc=equipo2,dc=es \/ Admin123.","thumbnail_url":"https:\/\/aborrego.inscastellbisbal.net\/wp-content\/uploads\/2026\/04\/Selection_114.png","thumbnail_width":662,"thumbnail_height":128}