Kaseya Community

Script to make domain user a local administrator on a computer

This question is answered

Hello,

Can someone help me create a script that will allow me to run this command:

net localgroup administrators mydomain.local\user1 /add

It needs to be run as an administrator.

ideally what im after is that when the "run now" is pressed, i get a form which asks for the domain name and username.

thank you.
Verified Answer
  • Yeah it's because I altered it a little to post it here but didn't change the procedure.  Edit it and change the third line to:

    net localgroup administrators #domain#\#username# /add

    It's set to net localgroup administrators #domain#\#user# /add

    Or you could change the second line so that the variable is just user

All Replies
  • Procedure Add Local Admin.xml

    I have something very similar which should work for you.

  • hi Alistair,

    i've attempted to run the script but i get this error:

    Failed THEN in step 3 (Line 6)

    any ideas?

    thank you.

  • Yeah it's because I altered it a little to post it here but didn't change the procedure.  Edit it and change the third line to:

    net localgroup administrators #domain#\#username# /add

    It's set to net localgroup administrators #domain#\#user# /add

    Or you could change the second line so that the variable is just user

  • Thanks, i got it worked :D

    quite exciting stuff really.. first time i've dipped into using variables and now i've made a load of procedures :P