c# - Running PowerSchell commands simultaneously on the target machine with WinRM -
i'm trying run multiple powershell commands simultaneously remotely on target machine.
var connectioninfo = new wsmanconnectioninfo(); var runspacepool = runspacefactory.createrunspacepool(1, 10, connectioninfo); runspacepool.open(); var waithandles = new waithandle[10]; (int = 0; < 10; i++) { var powershell = powershell.create(); powershell.runspacepool = runspacepool; powershell.addcommand("some-long-running-command"); var asyncresult = powershell.begininvoke(); waithandles[i] = asyncresult.asyncwaithandle; } waithandle.waitall(waithandles); runspacepool.close();
how many processes , threads created on target machine while executing code? how can create multiple threads on target machine in 1 process/connection?
Comments
Post a Comment