Add a user to Administrator group remotely

A handy way to add a user as an administrator to a PC/Server remotely using Sysinternal PSExec Tool. You can download the suite of products here:
http://technet.microsoft.com/en-us/sysinternals/bb842062

Once the tools are downloaded, find the psexec executable and run the following:

In this scenario, we are adding user "agorilla" to the local Administrator's Group on a server named svrapp01.

Then, from the cmd prompt, enter the below command and hit enter:
c:\Sysinternals>psexec \\svrapp01 cmd

The return will be something like this:

PsExec v1.97 - Execute processes remotely
Copyright (C) 2001-2009 Mark Russinovich
Sysinternals - www.sysinternals.com

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

This opens a remote cmd shell on that server at "C:\Windows\System32.
Next, enter this:

c:\Windows\system32>net localgroup administrators domain\agorilla /add

The return is:
The command completed successfully

Then close the connection:
c:\Windows\system32>exit

The return is:
cmd exited on svrapp01 with error code 0

No comments:

Post a Comment