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
|