»

Aug 29

Print this Post

System Administration Commands

Commands to run on Local Machine

How to find all local administrators?

Command: Net localgroup administrators

How to add a user to local administrators group?

Command: Net localgroup administrators Mydomain\username /add

How to delete a user from local administrators group?

Command: Net localgroup administrators mydomain\username /delete

 

Command to run for Remote Machines:

How to find all local administrators from remote machine.

Command: psexec \\servername Net Localgroup administrators

How to add a user to remote server  local administrators group?

Command: psexec \\servername Net localgroup administrators  mydomain\username /add

How to delete a user under local administrators group from remote machine ?

Command: psexec \\servername Net localgroup administrators mydomain\username /delete

 

Command to execute above commands for a list of servers.

How to find all local administrators for a list of remote machines.

Command: for /f %i in (D:\MachineList.txt) do psexec \\%i Net Localgroup administrators

How to add a user on list of  remote server under  local administrators group?

Command: for /f %i in (D:\MachineList.txt) do psexec \\%i Net Localgroup administrators  mydomain\username /add

How to delete a user on list of  remote server under local administrators group ?

Command: for /f %i in (D:\MachineList.txt) do psexec \\%i Net Localgroup administrators mydomain\username /delete

Permanent link to this article: http://www.techxpress.in/admincommands/

Bookmark this page