INF: Starting SQL Server Remotely from the NT Command Prompt

ID: Q125627


The information in this article applies to:


SUMMARY

The SQL Service Manager provides a way to remotely start and stop SQL Server. However, the SQL Service Manager can not be used to start and stop SQL Server from a batch file or Windows NT Command Prompt. The AT scheduler from Windows NT and the Remote Command Server from the Windows NT version 3.5 Resource Kit both allow the ability to start and stop services from the NT Command Prompt, provided that you have privileges to start and stop services on the remote machine.


MORE INFORMATION

To use the Remote Command Server service

After installing the Windows NT 3.5 Resource Kit on the SQL Server machine, use the following steps to install the Remote Command Service:
  1. Copy RCMD.EXE and RCMDSVC.EXE to the WINNT\SYSTEM32 directory.


  2. Rename the OEMNSRVC.INF file to OEMSETUP.INF in the Resource Kit Directory.


  3. From the Control Panel, choose Network. Select the Add Software... button.


  4. Choose <Other> Requires disk from manufacturer.


  5. Type in the Resource Kit directory for the Insert Disk dialog.


  6. Choose Remote Command Server for Network Software.


  7. After installation has completed, from the Control Panel, choose Services and start the Remote Command Server service.


To run commands remotely on the SQL Server machine copy the RCMD.EXE file to the machine from which you want to control SQL Server and run it as follows:
RCMD \\<Remote Machine> <Command>

For example, if you want to be able to stop SQL Server remotely on a machine named 'NT35Server'. Install the Resource Kit and Remote Command Service on 'NT35Server'. Then run RCMD on the machine that you want to control the machine 'NT35Server' with as follows:
RCMD \\NT35Server NET STOP SQLSERVER

To use the AT scheduler

NOTE: This method will not work in a batch file, because you need to know the current time of the remote machine.
  1. Start the Schedule service on the remote machine.


  2. Run the following NET TIME command to check the current time on the remote machine.
    NET TIME \\<Remote Machine>


  3. Run the following AT command to schedule the desired program to run on the remote system about 1-2 min. in the future:
    AT \\<Remote Machine> <Time> <Command>


For example, if you want to be able to stop SQL Server remotely on a machine named NT35Server. Start the Schedule service on NT35Server. Check the time of NT35Server. For this example, let's say it was 12:00pm. Then run AT on the machine that you want to control the machine NT35Server with as follows:
AT \\NT35Server 12:02:00pm NET STOP SQLSERVER

Additional query words: remote cmd Windows NT


Keywords          : kbtool SSrvWinNT 
Version           : 4.21a
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 16, 1999