I'm trying to find a working script to get active snapshots on vsphere 6.7. I've found this script linked to PAessler script portal:
The script is working running on Powershell inside the probe, but if I try to using it in Custom EXE/Script Sensor, I receive this error:
Response not well-formed: "(-1:Error occurred while checking for snapshots: System.Management.Automation.CommandNotFoundException The term 'Connect-VIServer' 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 path is correct and try again. . at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) )" (code: PE132)
thanks for the help!
It seems that user which is running your PRTG Probe doesn't have VMware.PowerCLI loaded. Try to import PowerShell module before you run the script - see documentation for details https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/import-module?view=powershell-7
In case that this module is not installed you can install it before you run the script - just add it to the first line of that script - see this link for details https://thesysadminchannel.com/install-vmware-powercli-module-powershell/
In short - you need to add this line on the first line of the script and execute the sensor.
Remove this line once module is installed