Remotely add Local administrator rights to a Workstation

We’ve just had some new Bespoke Software integrated into our System, and unfortunately it requires “local administrator rights” to run the program.

A few of my colleagues were RDP’ing onto the machines, and adding the rights, then having to reboot the machine for the changes to take affect.

I created a simple Powershell Script to add these rights remotely, with no need for a reboot

 $domain = "yourdomain"
$strComputer = "PCNAME"
$username = "USERNAME"

$computer = [ADSI]("WinNT://" + $strComputer + ",computer")

$Group = $computer.psbase.children.find("administrators")

function ListAdministrators

{$members= $Group.psbase.invoke("Members") | %{$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}

$Group.Add("WinNT://" + $domain + "/" + $username)


So there you have it, local admin rights, given remotely, for no need of a reboot


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s