Add AD User/Group to Local Administrator Group

The script can use either a plain text file containing a list of computername or a computer name as input and will add the trustee (AD user or group) as an administrator to the specified computer(s). The script will report back errors if the account is already a member.

4.2 Star
72,125 times
Add to favorites
E-mail Twitter Digg Facebook
  • Add users of domain to computer
    2 Posts | Last post July 18, 2013
    • I executed the script as:
      .\Set-ADAccountasLocalAdministrator.ps1 -Computer mycomputername -Trustee MYDOMAINCONTROLLER\myuserindomain
      and I am getting this error:
      WARNING: User 'MYDOMAINCONTROLLER\myuserindomain' not found in AD, please input correct SAM Account
      What could be the mistake?
    • The script checks for the samaccountname of the user, so if you use contoso\administrator it will fail. Try changing your command to the following:
      .\Set-ADAccountasLocalAdministrator.ps1 -Computer mycomputername -Trustee myuserindomain
  • How do I make the whole process automatic?
    4 Posts | Last post June 11, 2013
    • Hello
      I was wondering how to use your script to add a global group to local administrator group on the pc and laptops at work when they first boot into windows after imaging them and are joined to domain.
      we have like 17 different teches with their deligated admin right that are all part of an admin group called wksadmin.
      they have to add the wksadmin group to each pc after they have joined it to the domain.
      I'm trying to find a script that will prompt them for their username and password and then simply join the pc to the domain and then adds the wksadmin group to local admin group before they restart the pc.
      I found your script and looks like this is something that should meet the part two of my request, but since I'm not familiar with PS, I don't know how to modiy it to fit into my work.
      could you please help.
    • Saeidans,
      Why not use a restricted groups GPO  to add the wksadmin group to the local admins group?
    • I'm sorry, what is your question Leonardo?
51 - 52 of 52 Items