ksublondie has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to find the appropriate module(s) and so far not having any luck.

I need to be able to determine the status of a specific service/process on all our vmware WinX machines/servers in order to generate a report for the bossman. I've been able to quickly come up with a script at the machine level using Win32::ServiceManager, but ideally, I'd like something I can centrally run instead.

So far, I'm not finding anything to determine the services on a remote workstation (not sure if it's even possible for security's sake). There are some VMWare module options, but I'm not seeing anything that would give me the services/process information.

Is this possible?

Replies are listed 'Best First'.
Re: Determine service status
by NetWallah (Canon) on Mar 12, 2020 at 16:06 UTC
    Have you considered using command-line options like:

    * sc-query
    * Powershell :
            Get-Service -ComputerName RemoteComputerName | Where Status -eq "Running"
    * WMI:
            Get-WmiObject -computername $Server win32_service |Select-Object Status, Name, DisplayName, pscomputername, Startname

                    "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss

Re: Determine service status
by dasgar (Priest) on Mar 12, 2020 at 19:59 UTC

    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.