JSI Tip 4155. PsService freeware manages local and remote services.

Jerold Schulman

September 26, 2001

3 Min Read
ITPro Today logo in a gray background | ITPro Today


"PsService is a service viewer and controller for Windows NT/2K. Like the SC utility that's included in the Windows NT and Windows 2000 Resource Kits, PsService displays the status, configuration, and dependencies of a service, and allows you to start, stop, pause, resume and restart them. Unlike the SC utility, PsService enables you to logon to a remote system using a different account, for cases when the account from which you run it doesn't have required permissions on the remote system. PsService includes a unique service-search capability, which identifies active instances of a service on your network. You would use the search feature if you wanted to locate systems running DHCP servers, for instance.

Finally, PsService works on both NT 4 and Windows 2000, whereas the Windows 2000 Resource Kit version of SC requires Windows 2000, and PsService doesn't require you to manually enter a "resume index" in order to obtain a complete listing of service information.

Installation

Just copy PsService onto your executable path, and type "psservice".

PsService works on NT 3.51, NT 4.0, and Win2K.

Usage

The default behavior of PsService is to display the configured services (both running and stopped) on the local system. Entering a command on the command-line invokes a particular feature, and some commands accept options. Typing a command followed by "-?" displays information on the syntax for the command.usage: psservice [\computer [-u username] [-p password]]

PsService uses the Service Control Manager APIs that are documented in the Platform SDK."

I have scripted PsSVC.BAT, which makes it easier to use PsService in a batch. The syntax is:

PsSVC \ComputerName

NOTE: The state variable contains an N if you there is an error. The valid values for State are:

1 - Stopped2 - Start Pending3 - Stop Pending4 - Running

NOTE: You could modifiy the batch to include the credentials if needed.

Examples:

PsSVC \JSI007 query spoolerQueries the state of the spooler service on computer JSI007.

if "%state%" EQU "1" PsSVC \JSI007 start spoolerStarts the spooler service on computer JSI007, if it was stopped.

PsSVC.BAT contains:

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like