<?xml version="1.0"?>
<oembed><version>1.0</version><provider_name>Ana Borrego Toledo</provider_name><provider_url>https://aborrego.inscastellbisbal.net/en</provider_url><author_name>aborrego</author_name><author_url>https://aborrego.inscastellbisbal.net/en/author/aborrego/</author_url><title>Connexi&#xF3; client Windows - Ana Borrego Toledo</title><type>rich</type><width>600</width><height>338</height><html>&lt;blockquote class="wp-embedded-content" data-secret="gl1qXbCVlG"&gt;&lt;a href="https://aborrego.inscastellbisbal.net/en/2026/04/09/connexio-client-windows-2/"&gt;Connexi&#xF3; client Windows&lt;/a&gt;&lt;/blockquote&gt;&lt;iframe sandbox="allow-scripts" security="restricted" src="https://aborrego.inscastellbisbal.net/en/2026/04/09/connexio-client-windows-2/embed/#?secret=gl1qXbCVlG" width="600" height="338" title="&#x201C;Connexi&#xF3; client Windows&#x201D; &#x2014; Ana Borrego Toledo" data-secret="gl1qXbCVlG" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"&gt;&lt;/iframe&gt;&lt;script&gt;
/*! This file is auto-generated */
!function(d,l){"use strict";l.querySelector&amp;&amp;d.addEventListener&amp;&amp;"undefined"!=typeof URL&amp;&amp;(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&amp;&amp;!/[^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&lt;o.length;i++)o[i].style.display="none";for(i=0;i&lt;a.length;i++)s=a[i],e.source===s.contentWindow&amp;&amp;(s.removeAttribute("style"),"height"===t.message?(1e3&lt;(r=parseInt(t.value,10))?r=1e3:~~r&lt;200&amp;&amp;(r=200),s.height=r):"link"===t.message&amp;&amp;(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&amp;&amp;n.host===r.host&amp;&amp;l.activeElement===s&amp;&amp;(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&lt;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);
//# sourceURL=https://aborrego.inscastellbisbal.net/wp-includes/js/wp-embed.min.js
&lt;/script&gt;</html><description>connexi&#xF3; client windows Tornar al repte 2.3 1. Que es la connexio d&#x2019;un client al LDAP? Connectar un client Windows al servidor LDAP permet que la maquina client pugui consultar el directoricorporatiu per obtenir informacio d&#x2019;usuaris i grups. Aixo es fa instal&#xB7;lant 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 &#x2014; Configuraci&#xF3; de xarxa i visibilitat S&#x2019;ha comprovat que el client Windows t&#xE9; la IP 192.168.0.5 i el servidor Debian la 192.168.0.156. S&#x2019;ha verificat la connectivitat b&#xE0;sica mitjan&#xE7;ant un ping. Pas 2 &#x2014; Resoluci&#xF3; de noms local Per evitar errors de connexi&#xF3;, s&#x2019;ha editat el fitxer de hosts de Windows (C:WindowsSystem32driversetchosts) afegint la l&#xED;nia: 192.168.0.156 equipo2.es Pas 3 &#x2014; Prova de connexi&#xF3; al port LDAP S&#x2019;ha utilitzat PowerShell per confirmar que el port 389 del servidor est&#xE0; obert: Test-NetConnection -ComputerName 192.168.0.156 -Port 389 Resultat: TcpTestSucceeded : True. Test-NetConnection -ComputerName 192.168.0.156 -Port 389 Pas 3 &#x2014; Execuci&#xF3; de la prova de connexi&#xF3; S&#x2019;ha programat un script en PowerShell utilitzant la classe System.DirectoryServices.Protocols.LdapConnection. S&#x2019;utilitza PowerShell per carregar les llibreries de protocols de directori de .NET.&#xA0; Credencials: cn=admin,dc=equipo2,dc=es / Admin123. # 1. Configuraci&oacute; de dades $LdapServer = "192.168.0.156" $UserDN = "cn=admin,dc=equipo2,dc=es" $Password = "Admin123" # 2. Carregar llibreria .NET Add-Type -AssemblyName System.DirectoryServices.Protocols try { # 3. Establir connexi&oacute; $conn = New-Object System.DirectoryServices.Protocols.LdapConnection "${LdapServer}:389" $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 "`n&#x2705; CONNEXI&Oacute; EXITOSA!" -ForegroundColor Green Write-Host "S'ha establert el lligam (bind) amb el servidor Debian.`n" -ForegroundColor Gray # 5. Prova de lectura: Llistar el contingut de l'arrel Write-Host "Cercant objectes a dc=equipo2,dc=es..." $request = New-Object System.DirectoryServices.Protocols.SearchRequest("dc=equipo2,dc=es", "(objectClass=*)", "Subtree") $response = $conn.SendRequest($request) Write-Host "S'han trobat $($response.Entries.Count) objectes a la base de dades." -ForegroundColor Cyan foreach ($entry in $response.Entries) { Write-Host " -&gt; DN: $($entry.DistinguishedName)" } } catch { Write-Host "`n&#x274C; ERROR: $($_.Exception.Message)" -ForegroundColor Red } finally { if ($conn) { $conn.Dispose() } } Conclusi&#xF3; La connexi&#xF3; s&#x2019;ha realitzat correctament. Tot i que Windows 10 no s&#x2019;ha unit a un &#x201C;Domini&#x201D; d&#x2019;Active Directory en el sentit cl&#xE0;ssic (per limitacions de l&#x2019;entorn), s&#x2019;ha demostrat la interoperabilitat total entre el sistema operatiu de Microsoft i el servei de directori OpenLDAP de Linux mitjan&#xE7;ant protocols est&#xE0;ndard. S&#x2019;ha programat un script en PowerShell utilitzant la classe System.DirectoryServices.Protocols.LdapConnection. Credencials: cn=admin,dc=equipo2,dc=es / Admin123.</description><thumbnail_url>https://aborrego.inscastellbisbal.net/wp-content/uploads/2026/04/Selection_114.png</thumbnail_url><thumbnail_width>662</thumbnail_width><thumbnail_height>128</thumbnail_height></oembed>
