首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PRTG Vsphere快照脚本

PRTG Vsphere快照脚本
EN

Stack Overflow用户
提问于 2020-06-11 22:05:46
回答 2查看 243关注 0票数 1

我正在尝试找到一个工作脚本来获取vsphere 6.7上的活动快照。我找到了这个链接到PAessler脚本门户的脚本:

CheckForVMwareSnapshots

该脚本在探头内部的Powershell上运行,但如果我尝试在自定义EXE/脚本传感器中使用它,则会收到以下错误:

代码语言:javascript
复制
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)

谢谢你的帮助!

EN

回答 2

Stack Overflow用户

发布于 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,请参阅文档

代码语言:javascript
复制
Import-Module -Name VMware.PowerCLI

如果没有安装此模块,您可以在运行脚本之前安装它-只需将其添加到该脚本的第一行-有关详细信息https://thesysadminchannel.com/install-vmware-powercli-module-powershell/,请参阅此链接

简而言之,您需要将此行添加到脚本的第一行并执行传感器。

代码语言:javascript
复制
Install-Module -Name VMware.PowerCLI -Scope CurrentUser

安装模块后,删除此行

票数 0
EN

Stack Overflow用户

发布于 2020-07-22 20:10:28

我已经解决了删除模块并再次导入的问题!

最后,我现在使用在git hub上找到的这个脚本:https://github.com/saxos1983/prtg/blob/master/CheckForVMwareSnapshots.ps1

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62326275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档