Showing results for 
Show  only  | Search instead for 
Did you mean: 
Champion Sweeper
This uses Powershell. Save script in your \\server\share directory and name it addadmin.ps1.

This adds the user name to the computer then checks the computer to make sure the user name showed up.

Action is:
powershell.exe -noexit \\server\share\addadmin.ps1 {computer}

On line 3, change "YourDomain" to what your domain is.

# Add a domain user to the local Administrators group on the local or a remote computer  

$domainname = "YourDomain"
$erroractionpreference = "SilentlyContinue"

if ($args.count -ge "1") {$computername = $args}
else {$computerName = Read-Host 'Enter computer name or press <Enter> for localhost'}
$userName = Read-Host 'Enter user name'

if ($computerName -eq "") {$computerName = "$env:computername"}

$computer = [ADSI]("WinNT://" + $computername + ",computer")
$Group = $computer.psbase.children.find("Administrators")
$members= $Group.psbase.invoke("Members") | %{$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}

ForEach($user in $members)

if ($user -eq $userName) {$found = $true}

if ($found -eq $true) {Write-Host "User $domainName\$userName is now local administrator on $computerName."}
else {Write-Host "User not found"}