title: Calling Get-WMIObject on multiple computers selected via Get-ADComputer
body: <p>I'm trying to call Get-WMIObject (gwmi) on multiple computers selected via Get-ADComputer as a background job.</p>
  
  <p>My first attempt was</p>
  
  <pre><code>$job = Get-ADComputer -filter "name -like '*t90*'" | % { gwmi -computername $_.name -query "select name,username from win32_computersystem" -asjob -throttlelimit 10 }
  </code></pre>
  
  <p>However, since I'm calling gwmi once for each computer object returned, hundreds of background jobs are created, and I don't believe they're collectively heeding the ThrottleLimit. </p>
  
  <p>Am I doing this right?</p>
  
  <p>I know that gwmi can also accept an array for the computername attribute, as so:</p>
  
  <pre><code>$job = gwmi -computername "computer1","computer2","computer3" -query "select * from win32_computersystem" -asjob -throttlelimit 10
  </code></pre>
  
  <p>Doing it this way results in a single job rather than hundreds, since gwmi is only called once. Is that the way I should be doing it? And, if so, <em>how do I feed the output of Get-ADComputer to gwmi as an array?</em></p>
  
  <p>Thanks!</p>