INF: Starting SQL Server Remotely from the NT Command Prompt (125627)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q125627

SUMMARY

The SQL Service Manager provides a way to remotely start and stop SQL Server. However, the SQL Service Manager cannot be used to start and stop SQL Server from a batch file or Windows NT Command Prompt. The AT scheduler from Windows NT, the Remote Command Server, NETSVC service from the Windows NT version 4.0 Resource Kit, and Terminal Server service in Microsoft Windows 2000 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 NETSVC

To stop SQL Server running on a server named 'MYSQLServer', install the Resource Kit onto the remote computer, and then run NETSVC on the remote computer that is used to control the SQLserver 'MYSQLServer' using the following command:

NETSVC "mssqlserver" \\MYSQLServer /stop

For additional help, type the following:

NETSVC /?

To Use Terminal Server

If SQL Server is running on a Windows 2000 computer, install Terminal Server service on the Windows 2000 computer and then install the Terminal Server client on the remote computer. The remote computer can be running either Windows NT 4.0 or Windows 2000.

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



Modification Type:MinorLast Reviewed:2/14/2005
Keywords:kbinfo KB125627