INF: Starting SQL Server Remotely from the NT Command Prompt

This article was previously published under Q125627
This article has been archived. It is offered "as is" and will no longer be updated.
The SQL Service Manager provides a way to remotely start and stop SQLServer. However, the SQL Service Manager cannot be used to start and stopSQL 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 theNT Command Prompt, provided that you have privileges to start and stopservices on the remote machine.

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:

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 toknow 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 amachine named NT35Server. Start the Schedule service on NT35Server. Checkthe time of NT35Server. For this example, let's say it was 12:00pm. Thenrun AT on the machine that you want to control the machine NT35Server withas follows:
AT \\NT35Server 12:02:00pm NET STOP SQLSERVER

remote cmd Windows NT

Article ID: 125627 - Last Review: 02/28/2014 07:56:06 - Revision: 3.3

Microsoft SQL Server 4.21a Standard Edition, Microsoft SQL Server 6.5 Standard Edition, Microsoft SQL Server 7.0 Standard Edition, Microsoft SQL Server 2000 Standard Edition

  • kbnosurvey kbarchive kbinfo KB125627