我正在尝试找到一个工作脚本来获取vsphere 6.7上的活动快照。我找到了这个链接到PAessler脚本门户的脚本:
该脚本在探头内部的Powershell上运行,但如果我尝试在自定义EXE/脚本传感器中使用它,则会收到以下错误:
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)谢谢你的帮助!
发布于 2020-06-12 05:01:49
运行你的PRTG探测的用户似乎没有加载VMware.PowerCLI。在运行脚本之前尝试导入PowerShell模块-有关详细信息https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/import-module?view=powershell-7,请参阅文档
Import-Module -Name VMware.PowerCLI如果没有安装此模块,您可以在运行脚本之前安装它-只需将其添加到该脚本的第一行-有关详细信息https://thesysadminchannel.com/install-vmware-powercli-module-powershell/,请参阅此链接
简而言之,您需要将此行添加到脚本的第一行并执行传感器。
Install-Module -Name VMware.PowerCLI -Scope CurrentUser安装模块后,删除此行
发布于 2020-07-22 20:10:28
我已经解决了删除模块并再次导入的问题!
最后,我现在使用在git hub上找到的这个脚本:https://github.com/saxos1983/prtg/blob/master/CheckForVMwareSnapshots.ps1
https://stackoverflow.com/questions/62326275
复制相似问题