Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Management.Automation;
- using System.Management.Automation.Runspaces;
- Runspace runspace = RunspaceFactory.CreateRunspace();
- runspace.Open();
- Pipeline pipeline = runspace.CreatePipeline();
- pipeline.Commands.AddScript("powershell.exe -ExecutionPolicy Unrestricted -file D:\Files\Scripts\Script20180817.ps1 -FilePath " + file);
- pipeline.Invoke();
- runspace.Close();
Add Comment
Please, Sign In to add comment