VB5, VB6Create an Account
Dim objUser As IADsUser
Dim objGroup As IADsGroup
Dim objContainer As IADsContainer
'obtain a reference to the computer
Set objContainer = GetObject( _
   "WinNT://WORKGROUP/SSOSA")
'create a new user within the computer container
Set objUser = objContainer.Create("User", "Sammy")
'fill in the properties
objUser.Description = "Sammy Sosa user account"
objUser.FullName = "Sammy Sosa"
'call SetInfo to Save
objUser.SetInfo
'Set the password
objUser.SetPassword "66HR"
'obtain a reference to the group to put the account in
Set objGroup = GetObject( _
   "WinNT://WORKGROUP/SSOSA/Administrators")
'call the Add method of the IADsGroup object
objGroup.Add "Sammy"
'call SetInfo to Save
objGroup.SetInfo
Listing 1 Use this code to create a new user account and place the account in a group using the Windows NT provider. You must use the SetInfo method of the IADsUser and IADsGroup object to update the underlying directory.