PowerShell - convert output to array

One method here: http://blogs.msdn.com/b/powershell/archive/2009/02/27/converting-to-array.aspx

Another method would be to use GetType() on the returned value to see if is a non-array, then convert it to array:
if ($NewRecords.GetType().Name -eq 'DataRow') {
    $mytempvar = $NewRecords
    rv NewRecords
    $NewRecords = @()
    $NewRecords += $mytempvar
    rv mytempvar
}

4. July 2011 12:52 by garth | Comments (0) | Permalink