Microsoft KB Archive/252340

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:51, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


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

Article ID: 252340

Article Last Modified on 2/27/2007



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



This article was previously published under Q252340

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.

Keywords: kbinfo KB252340