Microsoft KB Archive/125627

= INF: Starting SQL Server Remotely from the NT Command Prompt =

Article ID: 125627

Article Last Modified on 2/14/2005

-

APPLIES TO


 * 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

-



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.



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.

 Start the Schedule service on the remote machine. Run the following NET TIME command to check the current time on the remote machine.

NET TIME \\

 Run the following AT command to schedule the desired program to run on the remote system about 1-2 min. in the future:

AT \\  



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: kbinfo KB125627

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.