add AD user to local admins group on multiple servers

Home Forums Scripting General Scripting add AD user to local admins group on multiple servers

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    mla
    Member
    #161055

    Hi,
    I need to add AD user to local admins group on multiple servers.

    I found this:

    ” Needed to add a user to the local administrators on 16 citrix servers, below is the code if you need it.
    psexec @servers.txt cmd /c “net localgroup Administrators /add domainusername”
    this doesnt work with multiple usernames at one time.
    get psexec here: http://www.sysinternals.com
    servers.txt is a text file containing a list of servers, i.e:
    server1
    server2
    etc “

    But when run it, I get the error (see below).
    When run only “net localgroup Administrators /add domainehpsim” on the same pc, the command executed successfully. Why it complains about “net” command?

    I guess no need to translate the error message from French :)

    C:addadmin>psexec @servers.txt cmd /c “net localgroup Administrators /add domainehpsim”
    PsExec v1.98 – Execute processes remotely
    Copyright (C) 2001-2010 Mark Russinovich
    Sysinternals – http://www.sysinternals.com
    [URL=”file://xxx00s22666/”]\xxx00s22666[/URL]:
    ‘”net’ n’est pas reconnu en tant que commande interne
    ou externe, un programme exécutable ou un fichier de commandes.
    cmd exited on csssjr00s22666 with error code 1.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.