Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


October 2003

Remote Command Service

Remotely administer and run command-line programs
RSS
Subscribe to Windows IT Pro | See More Windows NT 4.0 Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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

   Previous  1  [2]  Next  


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 October 02, 2003


this is getting old fast

john971mm January 08, 2008 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Scripting Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Cutting Costs with Client Management

7 Ways To Get More From Your SharePoint Deployment Now

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement