1. Home
  2. Knowledge Base
  3. Getting Started & How to (EN)
  4. How can I Start or Stop a Windows service on demand from Linux (To exec in an alert from Pandora FMS)

How can I Start or Stop a Windows service on demand from Linux (To exec in an alert from Pandora FMS)

You need an updated version of Samba (3.x) and administrative credentials to access remotely (RPC call) to a Windows® server. In this example we will use 192.168.50.121 like target server, “administrator” as user and “mypass” as password.

We want to work with a service called “PandoraFMSAgent” and also see the full list of services:

  • To get a list of process:
net rpc service list -U administrator%mypass -I 192.168.50.121
(You will see full list)
  • To show the status of a process:
 net rpc service status PandoraFMSAgent -U administrator%mypass -I 192.168.50.121
net rpc service status  PandoraFMSAgent -U administrador%pepe -I 192.168.50.121

 PandoraFMSAgent service is running.
 Configuration details:

    Controls Accepted    = 0x5
    Service Type         = 0x10
    Start Type           = 0x2
    Error Control        = 0x1
    Tag ID               = 0x0
    Executable Path      = C:\Archivos de programa\pandora_agent\PandoraAgent.exe
    Load Order Group     =
    Dependencies         = /
    Start Name           = LocalSystem
    Display Name         = Pandora FMS agent
  • To stop a process:
 net rpc service stop PandoraFMSAgent -U administrator%mypass -I 192.168.50.121 .
PandoraFMSAgent service is stopped.
  • To start a process:
 net rpc service start PandoraFMSAgent -U administrator%mypass -I 192.168.50.121
Successfully started service: PandoraFMSAgent

Was this article helpful?

Related Articles