C#程序如何在远程计算机上执行脚本文件?

时间:2013-11-28 08:37:54

标签: c# powershell powershell-remoting

我正在通过C#在远程计算机上执行powershell脚本。 我通过以下方式通过C#程序传递它:

String file = "C:\\scriptfile.ps1";
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(file);
Collection<PSObject> results = pipeline.Invoke();

如何远程执行脚本。是否将脚本文件复制到远程计算机。或者是脚本文件中的命令是否逐行传递和执行?

0 个答案:

没有答案