Skip to main content

Add User To Local Administrators Group

Why?#

It's a handy script for adding a user to multiple windows servers at the same time remotely.

$Servers =
"server1",
"server2",
"server3"
$domain = "HO"
$username = "someuser"
foreach($server in $Servers)
{
$Server
$AdminGroup = [ADSI]"WinNT://$Server/Administrators,group"
$User = [ADSI]"WinNT://$domain/$username,user"
$AdminGroup.Add($User.Path)
}
Last updated on