http://qs321.pair.com?node_id=11114186


in reply to Determine service status

When looking for utilities on Windows, one resource that I will usually check is Sysinternals. In your case, you might be interested in the PsService utility from Sysinternals. This utility "displays the status, configuration, and dependencies of a service, and allows you to start, stop, pause, resume and restart them" on the local system and remote Windows systems as well (assuming that you have login credentials for the remote system). To use it, just download it and use it. There is no install.

To use PsService inside a Perl script, just use something like Capture::Tiny (or whatever your favorite method/module to get output from running external commands). However, I would recommend running PsService once before using in your code. Almost all of the Sysinternal tools will have a EULA pop up to deal with on the first time the tool is run.