title: Powershell Test-Connection: different results when run AsJob vs straight-up
body: <p><em><strong>Short version</strong>: Why does <code>Test-Connection</code> provide only <strong>one</strong> result when running <code>-AsJob</code>?</em></p>
  
  <hr>
  
  <p><em><strong>Detailed version:</em></strong></p>
  
  <p>When the <code>Test-Connection</code> (ping!) command is run in Powershell (running as Administrator) it uses the default value of <code>4</code> for the <code>Count</code> parameter. This gives me the expected results (some irrelevant data removed for clarity):</p>
  
  <pre><code>PS C:\Windows\system32&gt; Test-Connection www.stackoverflow.com
  
  Destination     IPV4Address      IPV6Address   Bytes    Time(ms) 
  -----------     -----------      -----------   -----    -------- 
  www.stackove... 64.34.119.12     {}            32       117      
  www.stackove... 64.34.119.12     {}            32       113      
  www.stackove... 64.34.119.12     {}            32       111      
  www.stackove... 64.34.119.12     {}            32       113     
  </code></pre>
  
  <p>However, when I run it with the <code>-AsJob</code> flag, it seems (when running <code>Receive-Job</code>, after waiting a few secs) the <code>Count</code> was only 1, but I expected it to be 4 and get similar results as above. Instead I get this:</p>
  
  <pre><code>PS C:\Windows\system32&gt; Test-Connection www.stackoverflow.com -AsJob
  
  Id         Name            State      HasMoreData     Location     Command        
  --         ----            -----      -----------     --------     -------        
  1          Job1            Running    False           .            Test-Connection
  
  PS C:\Windows\system32&gt; Receive-Job 1
  
  Destination     IPV4Address      IPV6Address   Bytes    Time(ms) 
  -----------     -----------      -----------   -----    -------- 
  www.stackove... 64.34.119.12     {}            32       113  
  </code></pre>
  
  <p>The <code>AsJob</code> variant <strong>always</strong> returns one row, <em>even if you provide a specific value for <code>Count</code></em>.</p>
  
  <p>My Google-fu and <a href="http://technet.microsoft.com/library/dd347597.aspx" rel="nofollow">Get-Help-fu</a> don't seem to be sufficient. Can someone please explain what's going on here, preferably with some pointers how and where to find this info myself (e.g. which help files or sources explain this behavior)?</p>