【发布时间】:2022-01-07 11:08:30
【问题描述】:
我正在使用 System.Management.Automation 和 System.Management.Automation.Runspaces 包尝试远程重新启动计算机,然后等待该计算机再次可用。但是,无论我做什么都会导致运行空间处于损坏状态。是否有关于如何使用最新版本的 System.Management.Automation 包在 C# 中执行此操作的任何指导?
抱歉,如果这太神秘/含糊不清,我对用 C#/.net 编写任何东西都很陌生,非常感谢任何帮助。
【问题讨论】:
-
您要向您的 powershell 实例发送什么 cmdlet?通常,在 PS 上,您只需为此执行
Restart-Computer host01 -Wait。 -
“无论我做什么都会导致运行空间处于损坏状态。” - 你能给我们展示一个让运行空间处于损坏状态的“随便什么”的例子吗?
标签: powershell .net-core powershell-remoting