You have a domain joined computer, and you want to add a domain user or domain group to one of the computer’s local groups. If you have administrative permissions on the domain joined computer, this can be done quickly with the below PowerShell.
If you have a large number of domain joined computers that require the same users or groups added to their local groups, you should use group policy.
Add a Domain Group to the Local Administrators Group
$DomainGroup = "GroupName" $LocalGroup = "Administrators" $Computer = $env:computername $Domain = $env:userdomain ([ADSI]"WinNT://$Computer/$LocalGroup,group").psbase.Invoke("Add",([ADSI]"WinNT://$Domain/$DomainGroup").path)
Add a Domain User to the Local Administrators Group
$DomainUser = "SamAccountName" $LocalGroup = "Administrators" $Computer = $env:computername $Domain = $env:userdomain ([ADSI]"WinNT://$Computer/$LocalGroup,group").psbase.Invoke("Add",([ADSI]"WinNT://$Domain/$DomainUser").path)