Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. runspace = System.Management.Automation.Runspaces.RunspaceFactory.
  2. CreateRunspace(psConnectionInfo);
  3. runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" });
  4. runspace.Open();
  5.  
  6. Pipeline pipeline = runspace.CreatePipeline();
  7.  
  8. PowerShell powershell = PowerShell.Create();
  9. powershell.Runspace = pipeline.Runspace;
  10.  
  11. powershell.Runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement