Setting Up the
Microsoft Visual Basic 6.0 Development Environment
Start Visual Basic 6.0.
Select the type of project you would like to create.
Select Project | References and ensure that the
Active DS Type Library is selected, as shown in the figure
below. If you do not require early COM object binding, ignore this
step.
Begin programming with ADSI.
A Sample
Visual Basic 6.0 Application: Modifying FullName and Description
for a User
Before you begin, log on to a Windows 2000
or Windows Server 2003 domain. You must have permission to
modify the Active Directory database. By default, the Administrator
has this privilege.
Follow the previous steps to create a standard executable VB
project.
Double-click the Form. In Form_Load, type the following. You
must replace the "LDAP://CN=jeffsmith,CN=users,DC=fabrikam,DC=com"
string with the ADsPath of an existing user in a container in your
domain. Create a test user account that can be modified for this
purpose.
'------------------------------------------------------------
' This program is used to set the FullName and Description
'------------------------------------------------------------
Dim usr As IADsUser
' Binding to a user object
Set usr = GetObject("LDAP://CN=jeffsmith,CN=users,DC=fabrikam,DC=com")
usr.FullName = "Jeff Smith"
usr.Description = "A user for fabrikam.com"
usr.SetInfo ' Commit the changes to the directory
Press <F5> to run the program.
To verify changes, use the Active Directory Users and Computers
management tool. For more information about using ADSI and Visual
Basic 6.0, see Accessing
Active Directory Using Visual Basic.