+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, VB Script to add local PC user and make an administraor of local PC in Coding and Web Development; I need a script that will add a user 'Training' with a password of 'Course' and make the user a ...
  1. #1
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

    VB Script to add local PC user and make an administraor of local PC

    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?

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,104
    Thank Post
    891
    Thanked 1,751 Times in 1,510 Posts
    Blog Entries
    12
    Rep Power
    457
    I might have one, i will get back to you tomorrow.

  3. #3
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    40
    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")
    Last edited by jsnetman; 13th June 2008 at 07:30 AM.

  4. 2 Thanks to jsnetman:

    FN-GM (13th June 2008), ICT_GUY (13th June 2008)

  5. #4
    Kyle's Avatar
    Join Date
    Jan 2006
    Posts
    981
    Thank Post
    92
    Thanked 14 Times in 13 Posts
    Rep Power
    21
    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?

  6. #5
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    40
    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

  7. 2 Thanks to jsnetman:

    FN-GM (13th June 2008), tosca925 (14th June 2008)

  8. #6
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22
    Thanks for your time jsnetman,


    @Kyle have you tried jsnetmans new script?

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 7
    Last Post: 26th February 2010, 10:00 AM
  2. Users as local admins for logon script?
    By actech in forum Windows
    Replies: 12
    Last Post: 14th May 2008, 08:04 PM
  3. Replies: 8
    Last Post: 12th November 2006, 02:02 PM
  4. Script to create a local user on a XP box.
    By tosca925 in forum Scripts
    Replies: 3
    Last Post: 12th October 2005, 12:04 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •