nickyyy Posted April 11, 2014 Posted April 11, 2014 Hi Folks, First post here, tried searching for a solution but couldn't find anything I am trying to make a script which adds a new user to an AD domain, I have 4 input boxes each with their on variable $username = InputBox("Enter the new username", "Enter the username") $firstname = InputBox("Enter the users first name ", "Enter the first name") $lastname = InputBox("Enter the users last name", "Enter the last name") $password = InputBox("Enter the users new password", "Enter the password", "", "*") what I want to do is parse these variables into a script in a command line window by using this Send("{"& $username&"}") and so on Only the first letter of the variable is actually typed out, for example if I specify the username to be Benjamin it will type out a B Anyone any ideas on how to fix this issue? MsgBox(0, "AD add users", "Let us begin by adding the user to the remote domain!") Send("{LWIN} powershell") Send("{ENTER}") Sleep(1000) $username = InputBox("Enter the new username", "Enter the username") $firstname = InputBox("Enter the users first name ", "Enter the first name") $lastname = InputBox("Enter the users last name", "Enter the last name") $password = InputBox("Enter the users new password", "Enter the password", "", "*") Sleep(2000) Send("{"&$username&"} {"&$firstname&"} {"&$lastname&"} {"&$password&"}") Sleep(10000) MsgBox(0,"Success", "Script completed successfully, Running on Local AD Server") Send("{ENTER}") Send ("C:\Users\Nicky\Desktop\create_ad_users.ps1{ENTER}") Sleep(1000) MsgBox(0,"Success", "Script completed successfully, all users have been added")
nickyyy Posted April 11, 2014 Author Posted April 11, 2014 Got it! Panic over For anyone else, I used Send($username) which worked just fine. Cheers
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now