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")
$computer.name

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

function ListAdministrators

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

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

ListAdministrators 

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

Advertisements