2009-11-28

○ Executing commands remotely

RDP - Remote Desktop Protocol is a great resource to remotely administer a computer, TightVNC or UltraVNC also are great resources, that have their advantages in comparison with RDP, but sometimes we just want a remote command-line solution so that there is no interferance with what users using that remote machine are doing.

There are two solutions for this, the first one is to use the wmic command with the help of the Win32_Process class:

wmic /USER:Domain\user /PASSWORD:pass /NODE:"computer" process call create cmd.exe


If you get "Invalid global switch" error check to see if your computer name is within quotes and USER, PASSWORD and NODE are UPPERCASE letters otherwise it won't work ( it didn't when i tried )


The other solution is to use sysinternals pstools, namely, psexec. This tool is a must for any network administrator, usage would be something like:

c:\> psexec \\machine -u domain\user -p pass command

where machine is the machine name, use quotes if it's something like "Desk-NR-1"
where pass is the password for the domain\user
where command is the command line you would write if you where on the other computer, for total command line freedom use "cmd" as the command to have the remote command line on your computer.


Thank you for reading

No comments:

Post a Comment