Invoke-Async - Allows you to run any cmdlet/function/scriptblock asynchronously

***NOTE Rev 4 10/21/2011***Added a progress bar***NOTE Rev 3 11/30/2012***added write-error to show errors with cmdlet callsadded Measure param to give timing infoadded ability to use alias***NOTE Rev2*** Script has been updated to handle a single item and also closes out the run

Invoke-Async.ps1
 
 
 
 
 
4.2 Star
(16)
10,899 times
Add to favorites
10/21/2013
E-mail Twitter del.icio.us Digg Facebook
  • Sorting output
    4 Posts | Last post June 11, 2012
    • $rtn= invoke-async -cmdlet test-connection -set $servers -setparam computername -Verbose -params @{count=1}
      
      Trying to sort on names or other attributes without success. I also tried $rtn.GetEnumerator() just in case, but same result
    • $rtn | ft -a
      returns
      Source        Destination     IPV4Address      IPV6Address                              Bytes    Time(ms)
      
      $rtn | sort IPV4Address -> works
      $rtn | sort Destination -> does NOT work
      $rtn | sort Address -> works and sort Destination
      
    • I wasnt able to reproduce this.
      
      I checked the returned collection
      
      gm -i $rtn
      
      and it shows a collection of objects ( object[] )
      which is correct, and I inspect the objects
      $rtn | gm
      
      and find it to be a collection of wmi Pingstatus, which is as expected.
      
      I'm able to sort on ipv4address or destination just fine in V3.
      
      If you look at the object returned you'll notice there is no "destination" property but the "address" property is in effect the displayed "destination"
      
      http://msdn.microsoft.com/en-us/library/windows/desktop/aa394350(v=vs.85).aspx
      
      So I think this is more a case of how win32_pingstatus is shown. Oddly enough though if you look in types.ps1xml you'll notice that Destination is not defined there.
      
      All i can say is, its not my script :)
    • I take it back, its DotNetTypes.format.ps1xml
      
      destination is defined as address in there. So, blame the PS team for giving a display label that doesnt reflect the property name :)
11 - 11 of 11 Items