Platform SDK: Active Directory, ADSI, and Directory Services |
ADSI for Windows 2000 and DS Client ships with a read-only OLE DB provider. This means that you cannot issue the UPDATE statement in the SQL dialect at present. In the future, ADSI will support a readable and writeable OLE DB provider.
To modify an object returned from an ADO query
The following code example illustrates how to modify an ADSI object after performing the steps outlined in the preceding example.
'Replacing department for all users in OU=sales. Set con = Server.CreateObject("ADODB.Connection") con.Provider = "ADsDSOObject" Set command = CreateObject("ADODB.Command") Set command.ActiveConnection = con command.CommandText = "SELECT AdsPath, cn, FROM 'LDAP://OU=Sales,DC=Microsoft,DC=com' WHERE objectClass = 'user'" Com.Properties("searchscope") = ADS_SCOPE_ONELEVEL Set rs = Com.Execute While Not rs.EOF Set usr = GetObject(rs.Fields('AdsPath').Value) usr.Put "department", "1001" usr.SetInfo rs.MoveNext Wend