External Powershell Script SnapIn - Veeam Backup


#1

Hello,

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\check_veeam_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\check_veeam_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:

[/settings/external scripts] allow arguments=true allow nasty characters=true

[/settings/external scripts/scripts] check_veeam_backups = cmd /c echo scripts\custom\check_veeam_backups.ps1; exit($lastexitcode) | powershell.exe -command -


Thanks for your help!

Kind regards


#2

Problem solved!

For everyone who is interested:

The problem was the nsclient++ Version. I used the new 5.0 Version. Tried it with Version 4.4, and voila it works!