WindowsServer

Powershell – Add local Administrator

If you want to add Active Directory user or group to the local administrator group on a computer, you can use Powershell.

User and Group

To add user or group, we can use the cmdlet Invoke-Command associated with net localgroup.

Invoke-Command -ScriptBlock {net Localgroup administrators /add $args[0] } -ArgumentList("LAB\alexandre")

Computer

It is also possible to add a computer account into local Administrator group, you can use the command above but don’t forget to add the $ at the end of computer name.

Invoke-Command -ScriptBlock {net Localgroup administrators /add $args[0] } -ArgumentList("LAB\SRVSCCM$")

More

You can get more informations about net localgroup here.

Share