kabeldag has asked for the wisdom of the Perl Monks concerning the following question:
<job id="add_user"> <script language=vbscript> ' Script name : addusers.wsf ' Description : A lame example of user creation using Wscript msgbox("This script will create the username under the windows domain +'"&domain&"' with the information you specify. " _ & VbCrLf & "Please wait while I build a list of user objects on th +e domain/computer ...") domain = "some_windows_domain" Set domainObj = GetObject("WinNT://"&domain) add_users = 1 Do While add_users = 1 Dim domain Dim user_exists_check Dim user_id Dim user_fullname Dim user_location Dim user_password Dim add_users user_id=inputbox("Username:","Enter the userid/username") user_fullname=inputbox("Full Name of user:","Enter the user's full + name") user_location=inputbox("User's location:","Branch/Location of user +") user_password=inputbox("Password:","Enter user's password") If user_id = "" or user_fullname = "" or user_location = "" or use +r_password = "" Then msgbox("NULL user paramater specified. Please make sure you en +ter a value for each paramater!") Else ListUsers If user_exists_check = "EXISTS" Then msgbox("User '"&user_id&"' already exists ... USER NOT ADD +ED") user_exists_check = "" Else Add_user End If End If keep_adding=msgbox("Add another user ?",VbOkCancel) If keep_adding <> 1 Then add_users = 0 End If Loop Sub ListUsers domainObj.Filter = Array( "User" ) For Each objUser In domainObj existingUser=objUser.Name If existingUser = user_id Then user_exists_check="EXISTS" Exit Sub End If Next End Sub Sub Add_user Set oUser = domainObj.Create ("user", user_id) oUser.SetInfo oUser.Fullname = user_fullname oUser.SetPassword user_password oUser.Description = user_location & " blah blah user" oUser.AccountDisabled = False oUser.IsAccountLocked = False oUser.SetInfo ListUsers If user_exists_check = "EXISTS" Then msgbox("Added user '"&user_id&"' ...OK") Else msgbox("User not added!") End If End Sub </script> </job>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Perl to create Windows NT/2000 user accounts
by jdtoronto (Prior) on Jul 05, 2006 at 14:34 UTC | |
by Herkum (Parson) on Jul 05, 2006 at 16:38 UTC | |
|
Re: Using Perl to create Windows NT/2000 user accounts
by kabeldag (Hermit) on Jul 06, 2006 at 06:11 UTC | |
|
Re: Using Perl to create Windows NT/2000 user accounts
by bsdz (Friar) on Jul 11, 2006 at 16:33 UTC |