title: Get Powershell result into C# List
body: <p>I have the following PS Script(built with the PowerShell C# object):</p>
  
  <pre><code>    List&lt;string&gt; powershellResults = new List&lt;string&gt;();
      foreach (string str in PowerShell.Create().AddScript("Get-ADGroupMember \"Domain Users\" -Server \"Server\" | Select-Object -Property \"Name\" | Format-List").AddCommand("Out-String").Invoke&lt;String&gt;())
      {
  
          powershellResults.Add(str);
  
  
      }
  </code></pre>
  
  <p>However, I quickly found that instead of looping through the returned PS list, it just sticks the entire output of the PS List into the C# container(so there is only 1 entry that looks like:</p>
  
  <pre><code>Name : Alf
  Name : Jim
  Name : Carrol
  </code></pre>
  
  <p>How can I get PS to return each result individually? Or will I have to do some string manipulation in C# on the PS output? </p>