Windows Script, Using a variable in a command - TechRepublic
Question
April 26, 2007 at 06:56 AM
limited iq

Windows Script, Using a variable in a command

by limited iq . Updated 19 years, 2 months ago

I am new to scripting, can some let me know how to do this. I have a variable called username, but how do I make the create user line see username as a variable and not plain text

All this script does is create a user called username.

‘Get username
Firstname = InputBox(“Enter Firstname”)
MsgBox (“You entered: ” & Firstname)

LastName = InputBox(“Enter LastName”)
MsgBox (“You entered: ” & LastName)

UserName = FirstName & “.” & LastName
Msgbox (“Username is; ” & UserName)

‘Create user
Set objOU = GetObject(“LDAP://ou=Corporate,dc=domain,dc=com”)
Set objUser = objOU.Create(“User”, “cn=UserName”)
objUser.Put “sAMAccountName”, “UserName”
objUser.SetInfo

This discussion is locked

All Comments