Powershell command -

I added powershell as a check command via director and when I execute the command it returns an error saying it can’t find the file or directory.

execvpe(C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe) failed: No such file or directory

What is wrong?

The error displays the single \ but if I preview the command config itself it displays the escaped \ in the path.

I’m confused as I see other posts here that show what I have configured working.

execvpe is used on Linux, and as such, the service check isn‘t executed on a Windows agent. You can see that by inspecting the check source in Icinga Web’s detail view.

How can I get the command to be executed on the windows host and not Linux? I found your postings showing doing this but I get the error above when I try.

Afaik you just need to set the “Run on Agent” option in the service template to yes. Or just create an extra template like service-check-on-agent that sets this option and then import it to your specific check/apply rule.

2 Likes

Right. The howto Windows PowerShell Checks with Icinga2 uses a command_endpoint attribute which is abstracted by the Director within the agent settings.

1 Like

That was it! I can’t beleive I overlooked that setting haha