Posted By

pjessey on 02/27/12


Tagged


Versions (?)

add powershell module in csharp


 / Published in: C#
 

  1. InitialSessionState initial = InitialSessionState.CreateDefault();
  2. initialSession.ImportPSModule(new[] { modulePathOrModuleName1, ... });
  3. Runspace runspace = RunspaceFactory.CreateRunspace(initial);
  4. runspace.Open();
  5. RunspaceInvoke invoker = new RunspaceInvoke(runspace);
  6. Collection<PSObject> results = invoker.Invoke("...");

Report this snippet  

You need to login to post a comment.