tosca925 Posted June 12, 2008 Posted June 12, 2008 I need a script that will add a user 'Training' with a password of 'Course' and make the user a local administrator for some training sessions being put n next week. I need to run this script on a OU so that all the machines in one room get this account.. After the course is finished all PCs will be re-imaged and put solely back on the network. Anyone got a script that can do this?
jsnetman Posted June 13, 2008 Posted June 13, 2008 (edited) VB script is probably overkill for such a task. Create a bat file containing the following commands: net user Training Course /add net localgroup administrators Traning /add (this is of the top of my head so you may gave to check the syntax) Add the batch file to the to start up scripts of the machine portion of the group policy. You do not have to rebuild the machines to get rid of the accounts you have created just modify the bat file to: net user Training /delete VB alternative: Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("net user Training Course /add") Set oExec = WshShell.Exec("net localgroup administrators Training /add") Edited June 13, 2008 by jsnetman 2
Kyle Posted June 13, 2008 Posted June 13, 2008 Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("net user Training Course /add") Set oExec = WshShell.Exec("net localgroup administrators Training /add") Sorry to jump on this as well, I have tried this and it works after running twice, is there a way we can put a pause in after adding the training user. I think the script runs too quick to do both at the same time. Also can a passsword be added?
jsnetman Posted June 13, 2008 Posted June 13, 2008 Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("net user Training Course /add") WScript.Sleep(1000) Set oExec = WshShell.Exec("net localgroup administrators Training /add") wiil pause the script for 1 second The password is included "Set oExec = WshShell.Exec("net user Training Course /add")" adds the user Trainer with a password of Course 2
tosca925 Posted June 13, 2008 Author Posted June 13, 2008 Thanks for your time jsnetman, @Kyle have you tried jsnetmans new script?
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