Active Directory Service Interfaces - Communicating to NDS Servers

# Communicating with the Novell NDS Server

Requirements

- Install Novell NDS Server.
- Install "Gateway and Client Services for Netware".
- Install ADSI 2.5 or higher. Note that you must install ADSI after you install the Gateway and Client Service for Netware.

Installing Gateway and Client Services for Netware

For Windows NT® 4.0

- Select Start | Setting | Control Panel

- Choose Network Applet, and double-click it to open up the Network Dialog.

- Select the Service tab.

- Select Gateway (and Client) Services for Netware.

- Install and reboot.

For Windows® 2000

- Select Start | Setting | Network and Dial-up Connection.

- Select Local Network. Local Network will appear.

- Select Client for Microsoft Network.

- Click Install.

- Select Client icon, click Add.

- Select Gateway (and Client) Services for Netware.

- Installation should be in progress.

Connecting to an NDS Server

> Dim dso
> Dim obj
> Dim usrName
> Dim password
> Dim serverName
> serverName = "ntmarst2"
> userName = "supervisor.ntmarst2"
> password = "secretpwd"
> '--- Making the connection
> Set dso = GetObject("NDS:")
> Set cont = dso.OpenDSObject("NDS://" & serverName, userName, password, 0)

> '--- Enumerating objects
> For Each obj In cont
> Debug.Print obj.Name & " (" & obj.Class & ")"
> Next

Attribute Retrieval and Modification

> Path = "O=NTMARST2/CN=benny"
> ADsPath = "NDS://" & serverName & "/" & Path
> Set usr = dso.OpenDSObject(ADsPath, userName, password, 0)
> Debug.Print usr.Get("Surname")
> usr.Put "SurName", "Johnson"
> usr.SetInfo

Object Creation

> Path = "O=NTMARST2"
> ADsPath = "NDS://" & serverName & "/" & Path
> Set cont = dso.OpenDSObject(ADsPath, userName, password, 0)
> Set usr = cont.Create("user", "alicew")
> usr.Put "cn", "Alice"
> usr.Put "Surname", "Wonderland"
> usr.SetInfo

Searching

> ADsPath = "NDS://" & serverName
> Set con = CreateObject("ADODB.Connection")
> con.Provider = "ADsDSOObject"
> con.Properties("User ID") = userName
> con.Properties("Password") = password
> con.Open "ADSI"
> Set com = CreateObject("ADODB.Command")
> Set com.ActiveConnection = con
> com.CommandText = "SELECT ADsPath, 'Object Class' FROM '" & ADsPath & "' WHERE Surname='Wonderland'"
> Set rs = com.Execute
> While Not (rs.EOF)
> Debug.Print rs.Fields("ADsPath")
> rs.MoveNext
> Wend

Source code can be found in \samples\interopt\nds.