CLI to add Domain Admins to Administrator Group RRS feed

  • Question

  • Hi.

    I want to add Domain Admins via CLI.

    However, when i try to add it via CLI, i get the following error as Domain and Admins space delimited.

    C:\>net localgroup Administrators domain\domain admins /add
    There is no such global user or group: domain\domain.

    There is no such global user or group: admins.

    More help is available by typing NET HELPMSG 3783.

    is there a way to add it via CLI? or a unique name used for domain admins?

    i wish to add it to a logon script and if a user removes it, it will be added automatically at next logon.

    Kind Regards


    Tuesday, April 8, 2014 12:47 PM

All replies

  • Hi Skhayallee,

    Frist, use the following command to view the current Local Admin users (users that are members of Local Administrators groups) :

    => Net localgroup administrators

    Check if the users or groups you want to add to local adm group are not already present, if this not the case, use the following command to add domains admins to local admin group :

    Net localgroup Administrators /add "DOMAIN\Domain Admins" | e.i : net localgoup Administrators /add "Microsoft\Domain Admins"

    You command is wrong because between domain and admins there is an space so you have to add the symbol " "

    in addition, you have to specify the group or user after /add not before :).

    Let me know if its ok for you.



    Hicham KADIRI | IT Consultant /Director. MCP - MCSA - MCTS - MCSE - MCITP - MCT

    Tuesday, April 8, 2014 3:31 PM