Script or Batch file to load Administrators in XP

Discussion in 'Windows Desktop Systems' started by T. Eynon, May 19, 2006.

  1. T. Eynon

    T. Eynon OSNN One Post Wonder

    Messages:
    3
    Does anyone know how to create a batch or script file for loading users into the Local Groups Adminstrator folder of an XP PC. We have about 150 users that we would like to make administrators on for several test PCs and would like to do this with a batch or script file. If anyone knows how to do this please reply back with the syntax to place in the batch or script file.

    Thanks
     
  2. fitz

    fitz Just Floating Along Staff Member Political User Folding Team

    Messages:
    4,076
    Location:
    Chicagoland
    You could use a GPO and setup "restricted groups" specifically if you are running active directory.

    If you really need a script, i could probably whip something up fairly quickly.
     
  3. T. Eynon

    T. Eynon OSNN One Post Wonder

    Messages:
    3
    Thanks Fitz for the advice on the GP0. I was hoping not to have to involve my networking team.

    I did find something with the following syntax but was not able to get it to work. It was for Windows 2000.

    I really don't need to load users into a specific group like the last line shows all I really want to do is load them as an administrator in the administrators group file.

    I was hoping to have a user be able to loads these admins by running a .bat file.

    Thanks. Tim

    Code found:

    Net Localgroup Administrators

    "Domain_Name\Developer1" /Add

    Net Localgroup Administrators

    "Domain_Name\Developer2" /Add

    Net Localgroup Administrators

    "Domain_Name\Developer3" /Add

    Net Localgroup Administrators

    "Domain_Name\Developer4" /Add

    Net Localgroup Administrators

    "Domain_Name\Developer5" /Add

    And use

    Net Localgroup Administrators

    "Domain_Name\Developers_Group"

    /Add
     
  4. fitz

    fitz Just Floating Along Staff Member Political User Folding Team

    Messages:
    4,076
    Location:
    Chicagoland
    that code should work on XP also.. but it looks like you have the synax a little mixed up..

    The commands should also be on the same line:

    Code:
    net localgroup administrators /add %domain%\%user%
    
    Understand, in order to add to the administrator group, the batch file needs to be run as an administrator.
     
    T. Eynon likes this.
  5. T. Eynon

    T. Eynon OSNN One Post Wonder

    Messages:
    3
    Fitz,

    Thanks. This works great!!!
     
  6. fitz

    fitz Just Floating Along Staff Member Political User Folding Team

    Messages:
    4,076
    Location:
    Chicagoland
    glad you got it working :)