I'm trying to execute an powershell script via the nsclient++.
The Script uses a SnapIn from Veeam "VeeamPSSnapin". If I execute the script via powershell, it works just fine and gives the expected output.
But if I try to execute it via the nsclient++ it gives the error:
D ext-script Command line: cmd /c echo scripts\custom\checkveeam_backups.ps1; exit($lastexitcode) | powershell.exe -command -_
L cli WARNING: Add-PSSnapin : The Windows PowerShell snap-in 'VeeamPSSnapin' is not installed on this computer. ...
At C:\Program Files (x86)\NSClient++\scripts\custom\checkveeam_backups.ps1:8 char:1 ..._
+ Add-PSSnapin VeeamPSSnapin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
_ + CategoryInfo : InvalidArgument: (VeeamPSSnapin:String) [Add-PSSnapin], PSArgumentException ..._
_ + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand ..._
Get-VBRJob : The term 'Get-VBRJob' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
The Problem is that the nsclient can not load the snap in for powershell i guess. Do you have any suggestions how to solve this?
Here is the normal output if I execute it via powershell:
C:\Program Files (x86)\NSClient++>cmd /c echo scripts\custom\check_veeam_backups.ps1; exit($lastexitcode) | powershell.exe -command -
CRITICAL! Errors were encountered during the backup process of the following job: Backup Job Win7-VMs.
CRITICAL! Errors were encountered during the backup process of the following job: Backup Job Win8-81-VMs.
OK! - Tape-Job: Backup to Tape finished.
And here is the .ini part:
allow nasty characters=true
check_veeam_backups = cmd /c echo scripts\custom\check_veeam_backups.ps1; exit($lastexitcode) | powershell.exe -command -
Thanks for your help!