You can now copy the rcmd.exe file to any location and start using it. Open a command prompt, and browse to the directory in which you saved the rcmd.exe file. Enter the Rcmd command. The Help files specify the Rcmd command parameters as

rcmd [server_name [command] ]

Although these parameters aren't difficult to understand, they don't follow the traditional format conventions that Microsoft uses for command strings. Here's a simpler and easier format that you can use:

rcmd \\<servername> <command>

where servername is the name of the server you want to remotely execute a command on and command is the tool or utility you want to run on that server to execute a particular task. This command opens a command-line session with the specified server. Or, you can simply type

rcmd

at the command prompt, in which case you'll be prompted to enter a server name. Exit this mode by typing

exit

or by pressing Ctrl+Break.

You can use the following commands to apply some of the previously mentioned examples. (To execute these commands, user accounts will require some level of administrative privileges.)

Code to enable, disable, or query a server:

rcmd \\bartsvr change logon /disable
rcmd \\bartsvr change logon /enable
rcmd \\bartsvr change logon /query

Code that uses the Net Share command to share and unshare a directory listing:

rcmd \\bartsvr net share sharename=path to share directory
 (e.g., D:\software)
rcmd \\bartsvr net share sharename /delete /y

Code to display a directory listing on the remote server:

rcmd \\bartsvr dir

Code to map a drive to a shared resource on the remote server:

rcmd \\bartsvr net use x: \\homersvr\software
rcmd \\bartsvr net use x: /delete

If you want to uninstall rcmdsvc.exe from the host server, log on to that server with an account that has administrative rights, open a command prompt, and type

rcmdsvc -uninstall

The following script is an example of how to use Rcmd in a script. The script uses rcmd.exe to clear the Print Spooler files and restart the service.

rcmd \\bartsvr net stop "Print Spooler"
rcmd \\bartsvr del  %windir%\system32\spool\printers\*.* /q
rcmd \\bartsvr net start "Print Spooler"

Remote Control Freedom
Now that you know about the Remote Command Service, you no longer have to run Terminal Services sessions to execute certain commands from the command prompt. You can even incorporate the tool into your scripts and schedule them to run automatically, thus eliminating or minimizing user interaction. Tools such as Remote Command Service bring you one step closer to total remote control capability and the freedom to manage and troubleshoot your system from virtually anywhere in the world.

End of Article

Prev. page     1 [2]     next page -->



You must log on before posting a comment.

If you don't have a username & password, please register now.

Reader Comments

More a question than a comment. Is it be possible to install the Remote Service on a Windows 2000 Workstation also? This might be an effective way to run a command on a remote workstation if so.

Thanks,

Jim Kenzig

this is getting old fast

john971mm

Article Rating 3 out of 5

 
 

ADS BY GOOGLE