How to Create and Start a Service on a Remote Computer By Using the Command-Line or a Script

Article translations Article translations
Article ID: 252340 - View products that this article applies to.
This article was previously published under Q252340
Expand all | Collapse all

SUMMARY

This article describes how to create and start a service remotely on a Windows NT-based or Windows 2000-based computer from the command line.

In this scenario, the program file resides on all the remote computers; you want to write a script to create and start the service automatically.

MORE INFORMATION

The Netsvc.exe and Instsrv.exe tools from the Resource Kit do not create a service on a remote computer. The Srvinstw.exe tool from the Resource Kit is a program that you use to create remote services, but it is not a command-line tool that you can use in a script.

To create a script to create and start a service on a remote computer, use the Sc.exe tool from the Resource Kit. The syntax for this utility is:
sc \\computername create notepad binpath= c:\winnt\system32\notepad.exe type= own start= auto depend= "+TDI Netbios"
This particular command instructs the remote computer to create the "Notepad" service, then tells the computer where it can find the program file for this service.

The start=auto option instructs the computer to start the new Notepad service automatically when the computer is booted. The depend="+TDI Netbios" option tells the computer that it is dependent on the TDI group and on the NetBIOS service. Note that you must add quotation marks around the list of space-separated dependencies.

For more detailed information about the Sc.exe tool, please see the Sc-dev.txt file located in the Resource Kit.

Properties

Article ID: 252340 - Last Review: February 27, 2007 - Revision: 2.2
APPLIES TO
  • Microsoft Windows NT Server 4.0, Terminal Server Edition Service Pack 4
  • Microsoft Windows NT Server 4.0, Terminal Server Edition Service Pack 5
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows NT Server 4.0 Standard Edition
Keywords: 
kbinfo KB252340

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com