Tag Archives: Local Administrator

QuickTip: Change the local Administrator password on a remote server

To quickly change a password for any local administrator account, albeit locally or remote the following script can be used:

$account = [ADSI]("WinNT://server01/Administrator,user")
$account.psbase.invoke("setpassword",'Password1')

The WinNT provider allows for access to the SAM database on remote systems, assuming the account that executes this has the appropriate permissions to do so.

Share

New script: Set AD User/Group on as Local Administrator

I was recently asked to add a certain Active Directory group to a few dozen computers. Using Group Policy and Restricted Groups was not an option here, since there were already other users and groups in the Administrators group. That triggered me to write up a script in PowerShell which could do this for me.

The script is available here: Technet Gallery: Set-ADAccountasLocalAdministrator.ps1

To set an AD Group as a Local Administrator the script can be executed as follows:

.\Set-ADAccountasLocalAdministrator.ps1 -Computer 'Server01,Server02' -Trustee HRManagers

It is also possible to run this script with a plain text file containing a list of computer names:

.\Set-ADAccountasLocalAdministrator.ps1 -InputFile C:\ListofComputers.txt -Trustee User01
Share