Execute Powershell Scripts on Icinga Linux Server

Hello

I implemented the PowerCli for PowerShell on my Linux Icinga Server.

I wrote a script to make a few checks through PowerCLI. When I execute the script through the linux console it works (with root or icinga user).

But when I create the command in Icinga Director and execute it throug icinga I got an error message.

I have do an output of the Module path in both way. And when I execute the script directly on the linux console I get another Module Path for PS. Even if I remove the Module Path of and replace it with the correct own it still throw me back an error. Do anybody have an idea about this issue?

Module Path PS: /tmp/06132d04-4c0c-47dc-8142-43b9f365da8a/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/6/Modules
Set-PowerCLIConfiguration : The ‘Set-PowerCLIConfiguration’ command was found in the module ‘VMware.VimAutomation.Core’, but the module could not be loaded. For more information, run ‘Import-Module VMware.VimAutomation.Core’.

Best Regards

Hi.

There error message states that you didn’t import the needed powershell module for the commands you are using.
Simply adding the import call to your script should do the trick then.

If this is not the solution please provide more information (script and command definition).