Bonjour,
Je cherche à savoir comment je peux modifier des informations dans un annuaire LDAP

J'arrive à récupérer les informations, mais je voudrais pouvoir effectuer des modifications d'attributs. Par exemple le renomage d'un compte (Dupont->Dupond)

Voici le code que j'utilise pour afficher les enregistrements

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$strBase = "<LDAP://localhost:389>"
$strFilter = "(&(objectCategory=user)(name=Dupont))"
$strAttributes = "name,samaccountname"
$strScope = "subtree"
$strQuery = "$strBase;$strFilter;$strAttributes;$strScope"

$objConnection = New-Object -ComObject "ADODB.Connection"
$objCommand = New-Object -ComObject "ADODB.Command"
$objConnection.Open("Provider=ADsDSOObject;")
$objCommand.ActiveConnection = $objConnection
$objCommand.CommandText = $strQuery
$objRecordSet = $objCommand.Execute()

Do
{
    $objRecordSet.Fields.item("name").Value 
	$objRecordSet.Fields.item("samaccountname").Value
    $objRecordSet.MoveNext()
}
Until ($objRecordSet.eof) 

$objConnection.Close()
Merci pour votre aide