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
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:
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:
- Click Start, and then point to Programs.
- Click Administrative Tools, and then click Services.
- Right-click on a service in the list in the right pane, and then on the Context menu, click Properties.
- 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:
|
Routing and Remote Access | Remoteaccess |
DNS Server | Dns |
DNS Client | Dnscache |
Windows Management Instrumentation Driver Extensions | Wmi |
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 "Routing and Remote Access Service".
- Start Regedit and select the following registry key:
My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
- Using the Edit/Find feature, search for the "Routing and Remote Access Service" 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 "Routing and Remote Access Service" string. The name of the key in which this value is displayed is the short name of the service.
For example, the DisplayName "Routing and Remote Access Service" is located in the "router" key. Therefore, the name of the short service name is "Router".
The following table provides examples of some display names of Windows NT 4.0 services:
|
Routing and Remote Access Service | Router |
Microsoft DNS Server | Dns |
TCP/IP NetBIOS Helper | Lmhosts |
Windows Internet Naming Service | Wins |
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 "Routing and Remote Access" with a short name of "Remoteaccess". In Windows NT 4.0, the display name is "Routing and Remote Access Service" with a short name of "Router".
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 "Services.vbs":
'********************************************************************
'* 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
' <path-to>\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 = "LocalHost"
End If
Set oServiceSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strServerName & "/root/cimv2").InstancesOf("Win32_Service")
If strServerName = "LocalHost" Then
Set oWshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "Service Information retrieved from " & oWshNetwork.ComputerName
Set oWshNetwork = Nothing
Else
WScript.Echo "Service Information retrieved from " & strServerName
End If
WScript.Echo String(75, "_")
For each Service in oServiceSet
WScript.Echo
WScript.Echo " " & Service.Description
WScript.Echo " Short Name: " & Service.Name
WScript.Echo " Current State: " & Service.State
Next
WScript.Echo String(75, "_")
Set oServiceSet = Nothing