Execute powershell script on a remote computer using C#

前端 未结 1 889
小蘑菇
小蘑菇 2021-01-16 12:12

I have created a Bot Application using Microsoft Bot Framework and want to achieve the following:

  1. To execute a Powershell script on remote computers without an
相关标签:
1条回答
  • 2021-01-16 12:51

    I think that you are missing the bind of your PowerShell instance to the runspace.

    ps.Runspace = runspace;
    

    Take a look to this for more details.

    Alternatively, you can create a Pipeline (as explained here) using the runspace and invoke the commands.

    Pipeline pipeline = runspace.CreatePipeline("<COMMAND TO EXECUTE REMOTELY>");
    
    var results = pipeline.Invoke();
    
    0 讨论(0)
提交回复
热议问题