add powershell module in csharp


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.