Powershell 在新进程和同一运行空间内调用脚本
Powershell invoke script in new process and within the same runspace
我在我的应用程序(进程)中获得了一个已配置的 c# Runspace v3。
我想在同一个运行空间内的新进程中执行我的 PowerShell 脚本。
我怎么能做到这一点?
我想,当我在现有运行空间中启动 PowerShell 时,该运行空间将继承到新的 PowerShell:不幸的是,情况并非如此...
我看到了以下有趣的方法,但没有找到这些方法有何帮助的解决方案:
RunspaceFactory.CreateOutOfProcessRunspace
Invoke-Command
PS:我无法在我的应用程序中更改从 Runspace 到 PowerShellProcessInstance and also I can not use PSRemoting
的访问权限
您所描述的是不可能的 - 单个运行空间不能跨越多个进程。
请允许我用我在 mspaint
:
中制作的最先进的图形来展示相关的层次关系
一个运行空间绑定到单个 .NET AppDomain,一个 AppDomain 不能跨越多个进程。
我在我的应用程序(进程)中获得了一个已配置的 c# Runspace v3。 我想在同一个运行空间内的新进程中执行我的 PowerShell 脚本。 我怎么能做到这一点? 我想,当我在现有运行空间中启动 PowerShell 时,该运行空间将继承到新的 PowerShell:不幸的是,情况并非如此...
我看到了以下有趣的方法,但没有找到这些方法有何帮助的解决方案: RunspaceFactory.CreateOutOfProcessRunspace Invoke-Command
PS:我无法在我的应用程序中更改从 Runspace 到 PowerShellProcessInstance and also I can not use PSRemoting
的访问权限您所描述的是不可能的 - 单个运行空间不能跨越多个进程。
请允许我用我在 mspaint
:
一个运行空间绑定到单个 .NET AppDomain,一个 AppDomain 不能跨越多个进程。