title: How to add exchange snapin using iron python
body: <p>Below is my Iron Python script it works fine with all the system level commands (get-process etc) but I want to add MS-Exchange  snap-in to invoke exchange command. Can some one help me ?</p>
  
  <p>def RunScript(script):</p>
  
  <pre><code>runspace = RunspaceFactory.CreateRunspace()
  runspace.Open()
  pipeline = runspace.CreatePipeline()
  cache = System.IO.Path.GetTempFileName()
  pipeline.Commands.AddScript(script)
  
  pipeline.Commands.Add("Out-String")
  results = pipeline.Invoke()
  pickled = []
  for thing in results:
      pickled.append(thing.ToString())
  return pickled
  </code></pre>
  
  <p>Thanks
  Susant</p>