How to make Out-GridView show rows?

亡梦爱人 提交于 2020-01-04 06:36:30

问题


I have a PowerShell table with 55 rows:

> $ds.tables[0].rows.count
55

When I display it in the command line, it displays fine:

> $ds.tables[0]
FIELD1                                    FIELD2
------                                    ------
r1v1                                      r1v2
etc                                       etc

However, when I try pipelining it to Out-GridView (ogv), I get a blank grid, with the two field headers, but absolutley no rows!

How do I display the rows from my table in a PowerShell Out-GridView?

EDIT: As requested, here is the code:

$provider = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
$sql = "SELECT top 100 System.itemname, system.itemurl FROM SYSTEMINDEX WHERE contains('frog')" 
$adapter = New-Object System.Data.OleDb.OleDbDataAdapter -Argument $sql, $provider
$ds = New-Object System.Data.DataSet
$adapter.fill($ds)
$ds.tables[0]
$ds.tables[0] | ogv

UPDATE: As per the comment, I checked, and the machine is running PowerShell v2.0.

来源:https://stackoverflow.com/questions/35085219/how-to-make-out-gridview-show-rows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!