Jun 3, 2010 at 6:28 PM
Edited Jun 3, 2010 at 6:42 PM
I specifically spent time learning Invoke-AdoCommand to easily pipe rows of data to later filter or output steps (easier to get data into a simple text file than SQL Management Studio). But it looks like 'Invoke-AdoCommand -AsPSObject' doesn't work.
I can't get it to work and I can't find a working example on the web.
I would consider working on a patch to make this work if I know how -AsPSObject is supposed to work. Is it supposed to create an PS object with note properties for each column from the IDataReader? If you point me to a similar mapping from a
custom collection to generate PSObject in the PSCX sources I'm sure I could do the same for Invoke-AdoCommand from IDataReader.
Update: 6/3/2010 Adding Code Sample:
This uses SQL 2008 sample DB, AdventureWorks R4
$defaultConn = 'Data Source=.;Initial Catalog=AdventureWorksLT2008;Persist Security Info=True;Integrated Security=True'
$defaultSQL = 'SELECT TOP 1000 [ProductModelID], [Name], [CatalogDescription], [ModifiedDate]
where ProductModelID < 10';
Invoke-AdoCommand -AsPSObject:$true -ProviderName Sql -ConnectionString $defaultConn -CommandText $defaultSQL