mssqlserver.com: FAQ: Why can't I use RCMD.EXE via xp_cmdshell from SQL Server?
 


Search
  Home
  Articles
  Backup
  Books
  Certification
  FAQ
  Products
  Replication
  Scripts
  Seminars
  Training
  TSQL

MSDN Fourms
Philippine SSUG

  Resume

MHS Enterprises
FilAm Software
AcrylicAcetate.com
Bargain Humidors
Western Humidor



Why can't I use RCMD.EXE via xp_cmdshell from SQL Server?

For any access to "network resources" you need to run SQL Server under a user account and not the default LocalSystem account. You can check what userid that MSSQLSERVER is running under by looking at control panel/services highlighting MSSQLSERVER and choosing the start-up option. This should be changed as necessary.

Without this change you will get an "error 5 - Access denied".

However, RCMD.EXE doesn't seem to work even with this change. This is due to the way that RCMD in the NT resource kit is coded - it is probably expecting there to be a keyboard/mouse defined in the user context, which there isn't.

So the short answer is that unless you use a version of rcmd.exe without this restriction then it won't work.

Michael R. Hotek

All content on this site, except where noted, represents an original work of Michael R. Hotek and is protected by applicable copyright laws. The SQL Server FAQ is the sole work of Neil Pike. No page, portion of a page, or download may be used for commercial purposes in whole or in part without the express, written permission of the applicable author.