在 VBScript 中调用 Powershell Cmdlet
是否可以在 VBScript 中调用 PowerShell Cmdlet?
我知道如何调用整个 Powershell 脚本,但我只想调用一些特定的 Cmdletes。 也可以将 Cmdlet 的结果存储在 VBScript 中的某个对象中。
我对 Powershell 和 VBScript 不太了解。 也许这是一个很值得问的问题。如果您知道我们该如何做到这一点,请告诉我。
Is it possible to give a call to PowerShell Cmdlets in my VBScript?
I know how can I call entire Powershell Script, but instead I want to call some specific Cmdletes only.
Also is it possible to get that result of Cmdlet to be stored in some Object in VBScript.
I don't have much idea about Powershell and VBScript.
May be this is very question. Please let me know if you have idea how can we do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试 Sapien 的 ActiveXPosh(COM 组件)。它是一个特殊的 PowerShell 主机,允许开发人员/脚本编写人员从 VBScript/JScript 代码运行单个 cmdlet 或整个脚本。您可以在“免费组件”下的“下载”部分找到它(需要注册,免费):
http://www.sapien.com/blog/2008/06/25/activexposh-is-now-a-free-download/
You can try ActiveXPosh (COM component) from Sapien. It is a special PowerShell host that allows developers/scripters to run single cmdlets or entire scripts from VBScript/JScript code. You can find it in the Downloads section under Free Components (registration needed, free):
http://www.sapien.com/blog/2008/06/25/activexposh-is-now-a-free-download/
您可以让 PowerShell 将对象序列化为某种通用格式(例如 JSON 或 XML),然后将其导入到 VBscript 中。这可能是 VBscript 和 PowerShell 之间互操作的最佳方式。
You could have PowerShell serialize objects to some sort of common format, like JSON or XML, and then import it in your VBscript. That's probably the best way to interoperate between VBscript and PowerShell.