' Listing 1. Code to Create a User Object in NT's SAM On Error Resume Next Dim User, Container, TargetContainer, ObjectName, InitialPassword ' BEGIN CALLOUT A TargetContainer = "Target_Container_Name" ObjectName = "Name_For_New_Object" InitialPassword = "New_Password" ' END CALLOUT A Set Container = GetObject("WinNT://" & TargetContainer) Set User = Container.Create("user", ObjectName) ' Place optional properties here (e.g., FullName, Description). User.SetInfo ' BEGIN CALLOUT B ' You can use the RandomPwd function to assign a random password to ' the User object. If you decide on this route, you need to uncomment the ' following line, delete the last line in callout A, and add the RandomPwd ' function to the end of this script. You can find the RandomPwd function ' in the Code Library on the Windows Scripting Solutions Web site. ' InitialPassword = RandomPwd(8, true) ' END CALLOUT B If Err.Number = 0 Then User.SetPassword InitialPassword Else Wscript.Echo "Error creating user object: Error " & Err.Number _ & vbCrLf & Err.Description End If