Guest User

Untitled

a guest
Aug 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using System.Management.Automation;
  2. using System.Management.Automation.Runspaces;
  3.  
  4. Runspace runspace = RunspaceFactory.CreateRunspace();
  5. runspace.Open();
  6. Pipeline pipeline = runspace.CreatePipeline();
  7. pipeline.Commands.AddScript("powershell.exe -ExecutionPolicy Unrestricted -file D:\Files\Scripts\Script20180817.ps1 -FilePath " + file);
  8. pipeline.Invoke();
  9. runspace.Close();
Add Comment
Please, Sign In to add comment