Hello again,
What you are trying to do is entirely machine dependent, because the Wazuh manager is able to handle the Wazuh agent when online. What you are trying to achieve is more about server management, which a third-party tool like PDQ should help resolve. If your systems are joined to the domain, services like SCCM, or even GPO via PowerShell, will deploy.
PowerShell remoting leverages the Windows Remote Management (WinRM) service, a contemporary, adaptable, and secure method for command execution. This means you need to enable WinRM and configure a listener on the remote computer.
Then you can execute the command below on another computer.
Invoke-Command -ComputerName "ComputerA_Hostname_or_IP" -ScriptBlock {
# Check if the service is running, then restart it
if ((Get-Service -Name wazuh).Status -ne 'Running') {
Start-Service -Name wazuh
}
}
For the service control utility, almost the same approach requires several RPC/SMB ports to be open, making it less secure and harder to configure than WinRM (Ports 139/445, plus various high-range ports).
# Check service status
sc \\ComputerA_Hostname_or_IP query wazuh
# Start the service
sc \\ComputerA_Hostname_or_IP start wazuh
You can learn more about this in the documentation below: