Microsoft KB Archive/271362

= How to Find the Short Names of Services =

Article ID: 271362

Article Last Modified on 3/1/2007

-

APPLIES TO


 * 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 Q271362



IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



SUMMARY
This article describes how to determine the short name of a service, which you can use at a command prompt or in a batch file.



MORE INFORMATION
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

You can locate the short service name by means of the graphical user interface (GUI) in Windows 2000 and through the registry in Windows NT 4.0.

Also, you can use a script in combination with Windows Management Instrumentation (WMI) with both Windows 2000 and Windows NT 4.0 to output all services, including the display name, the short name, and the current state of the service.

WMI is included with Windows 2000, but must be installed in Windows NT 4.0.

You can install WMI for Windows NT 4.0 from the following Microsoft Web site:

http://www.microsoft.com/downloads/release.asp?ReleaseID=18491

Windows 2000 GUI location
Most locations in the Windows 2000 GUI list the display name of a service (for example, Computer Management); however, you can locate the short service name by performing the following steps:
 * 1) Click Start, and then point to Programs.
 * 2) Click Administrative Tools, and then click Services.
 * 3) Right-click on a service in the list in the right pane, and then on the Context menu, click Properties.
 * 4) On the General Tab of the selected service's properties, the short name of the service is given by the entry following Service Name. The following table provides examples of some display names of Windows 2000 services:

Finding the Service Name (the Short Name of a Service) in Windows NT 4.0 (in Windows 2000 This Is Not Necessary)
In Windows NT 4.0, the short service name is not viewable in the GUI; however, you can use the display name to find the short name by searching the registry. To do so, perform the following steps:  Click Start, point to Settings, click Control Panel, double-click Services or at a command prompt, run the net start command. Then locate the display name of the service you want. For example, in Windows NT 4.0 running Routing and Remote Access, the net start command correlates the service with the name &quot;Routing and Remote Access Service&quot;. Start Regedit and select the following registry key:

My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

 Using the Edit/Find feature, search for the &quot;Routing and Remote Access Service&quot; string. Click to select the Data check box and click to select the Match Whole String Only check box in the search options. The DisplayName value is displayed with the &quot;Routing and Remote Access Service&quot; string. The name of the key in which this value is displayed is the short name of the service.

For example, the DisplayName &quot;Routing and Remote Access Service&quot; is located in the &quot;router&quot; key. Therefore, the name of the short service name is &quot;Router&quot;.

The following table provides examples of some display names of Windows NT 4.0 services:

NOTE: The display or the short service name may be different between Windows NT 4.0 and Windows 2000. For example, in Windows 2000, the Routing and Remote Access service's display name is &quot;Routing and Remote Access&quot; with a short name of &quot;Remoteaccess&quot;. In Windows NT 4.0, the display name is &quot;Routing and Remote Access Service&quot; with a short name of &quot;Router&quot;.

At a command prompt, you can start and stop the Microsoft DNS Server service (NT 4.0) or DNS Server service (Windows 2000) by using the net stop dns&net start dns command.

Using a Visual Basic Script in Combination with WMI on Windows 2000 or Windows NT 4.0
You can run the following script with the cscript services.vbs command from a command prompt in Windows 2000 and Windows NT 4.0 (after WMI is installed):

NOTE: This is an example of a script using WMI and the script should only be used at the command prompt. Copy this sample information into Microsoft Windows Notepad and name the file &quot;Services.vbs&quot;: '******************************************************************** '* File:       services.vbs '* Purpose:    display service information on a computer using WMI '* Requires:   WMI to be installed on server specified '* Revisions:  Initial development - 01/08/01, tonymu '* Disclaimer: This code is to be used for sample purposes only '*             Microsoft does not guarantee its functionality '******************************************************************** 'Known Issues: '  The following error will be returned if WMI is not installed '       \services.vbs(23, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'GetObject'

Dim oArgs, strServerName, oServiceSet, oWshNetwork

Set oArgs = WScript.Arguments If oArgs.Count > 0 Then strServerName = trim(oArgs(0)) Else strServerName = &quot;LocalHost&quot; End If Set oServiceSet = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!//&quot; & strServerName & &quot;/root/cimv2&quot;).InstancesOf(&quot;Win32_Service&quot;) If strServerName = &quot;LocalHost&quot; Then Set oWshNetwork = WScript.CreateObject(&quot;WScript.Network&quot;) WScript.Echo &quot;Service Information retrieved from &quot; & oWshNetwork.ComputerName Set oWshNetwork = Nothing Else WScript.Echo &quot;Service Information retrieved from &quot; & strServerName End If WScript.Echo String(75, &quot;_&quot;) For each Service in oServiceSet WScript.Echo WScript.Echo &quot;  &quot; & Service.Description WScript.Echo &quot;     Short Name:    &quot; & Service.Name WScript.Echo &quot;     Current State: &quot; & Service.State Next WScript.Echo String(75, &quot;_&quot;) Set oServiceSet = Nothing

Keywords: kbenv kbhowto KB271362

-

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

© Microsoft Corporation. All rights reserved.