powershell - 从 WinRT 应用调用 PowerShell

标签 powershell windows-runtime

我想知道是否有一种方法可以从 WinRT 应用程序执行 PowerShell 脚本。具体来说,我想调用 Hyper-V cmdlet,例如 Get-VM,并在 Metro 新的 Windows UI 中显示结果。

或者还有其他方法可以实现吗?我在 Windows 应用商店上看到过 Hyper-V 管理器应用程序,有没有人碰巧知道这些人是怎么做到的?谢谢。

最佳答案

我很确定在代码中没有直接的方法来执行此操作,即您无法托管 PowerShell 引擎。但是,如果您很勤奋,则可以使用 WinRT 套接字支持来连接到 PowerShell Web 访问端口或 PowerShell 远程端点。尽管后者可能需要一些繁重的工作才能弄清楚 WSMan 协议(protocol)。

关于powershell - 从 WinRT 应用调用 PowerShell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12997685/

相关文章:

c# - 更改 gridView 位置 WinRT Xaml

windows-8 - 将图像调整为字节数组

c# - 应用程序设置绑定(bind)最佳实践

Azure PowerShell - 无法识别资源组

使用参数执行 CMD.exe 的 PowerShell SCript

powershell - 为什么尾随反斜杠会破坏 Powershell 参数解析?

powershell - 通过 PowerShell 以提升的权限调用批处理文件并检索退出代码

powershell - 在PowerShell上的Send-MailMessage不起作用

c# - 序列化包含 BitmapImage : using 2 inherited class? 的类的方法

c++ - 我可以使用 C++/WinRT 编写一个 DLL 以供 Windows 桌面应用程序(不是 UWP)或作为 Unity 插件使用吗?