title: Display "Test-NetConnection" Powershell command in Winforms TextBox
body: <p>I'm trying to display the results of the Powershell command &quot;Test-NetConnection&quot; in a Winforms textbox.</p>
  <pre><code>        using (PowerShell ps = PowerShell.Create())
          {
              ps.Commands.AddScript(&quot;Test-NetConnection&quot;);
              Collection&lt;PSObject&gt; result = ps.Invoke();
              foreach (var outputObject in result)
              {
                  connectionStatus.Text += outputObject.ToString();
              }
          }
  </code></pre>
  <p>when I run &quot;Test-NetConnection&quot; in Powershell it works and if I switch out ps.Commands.AddScript(&quot;Test-NetConnection&quot;); for ps.Commands.AddScript(&quot;ipconfig /all&quot;); it works but for some reason using the &quot;Test-NetConnection&quot; command displays nothing. What am I doing wrong?</p>