7.7. Viewing the List of Services

Problem

You want to view all the services that are installed on a server.

Solution

Using a graphical user interface

  1. Open the Services snap-in. The right pane contains all the services installed on the server.

  2. Double-click a service to view the description and other service parameters.

Using a command-line interface:

This command lists detailed output for all the running services:

> sc \\<ServerName> query

And this command lists all services:

> psservice \\<ServerName> query

If you want only a list of names of all running services, as opposed to detailed output, use this:

> sc \\<ServerName> query | findstr SERVICE_NAME

Or you can use any of these commands to list the installed services:

> srvinfo -nf \\<ServerName>
> psservice \\<ServerName> query | findstr SERVICE_NAME
> wmic /node:"<ServerName>" service list

Using VBScript

' This code prints the list of services on a machine
' ------ SCRIPT CONFIGURATION ------
strComputer = "<ServerName>" ' e.g., fs-rtp01 (use . for local server) boolShowDetails = TRUE ' set to FALSE to display list w/o details ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set objServices = objWMI.InstancesOf("Win32_Service") for each objService in objServices WScript.Echo objService.Name if boolShowDetails = TRUE then for each objProp in objService.Properties_ ' Print out NULL if the property is blank if IsNull(objProp.Value) then Wscript.Echo " " & objProp.Name & " : NULL" else ' ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.