title: Suppress information of Test-NetConnection
body: <p>How can I supress the detailed information from <code>Test-NetConnection -ComputerName localhost</code> for a PowerShell session?</p>
  
  <p><code>Test-NetConnection</code> writes quite a bit of information to the console which is displayed in the top of the console, overwriting the progress bar.</p>
  
  <p><a href="https://i.stack.imgur.com/2XWaj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2XWaj.png" alt="enter image description here"></a></p>
  
  <p><strike>The output can be suppressed by setting the <code>-InformationLevel</code> to <code>Quiet</code> like so</strike>
  It looked like the output could be supressed like with the <code>-InformationLevel</code> parameter, however it turns out that even with <code>-InformationLevel</code> to <code>Quiet</code> the information in the top of the console is shown.</p>
  
  <pre><code>Test-NetConnection -ComputerName localhost -InformationLevel Quiet
  </code></pre>
  
  <p>I would like to set the <code>InformationLevel</code> just once for the whole script, like you would <a href="https://stackoverflow.com/questions/18770723/hide-progress-of-invoke-webrequest">suppress the progress bar when using <code>Invoke-WebRequest</code></a>.</p>
  
  <pre><code>$progressPreference = 'silentlyContinue'    # Subsequent calls do not display UI.
  Invoke-WebRequest ...
  $progressPreference = 'Continue'            # Subsequent calls do display UI.
  </code></pre>
  
  <p>To my knowledge there is no similar <code>$InformationLevelPreference</code> Test-NetConnection will listen to.</p>