I have a normal PS Function uses System.Data.SqlClient.SqlConnection, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataAdapter to query db, then return a System.Data.DataTable object.
It works great so far and now I want to make it remoting because of some purposes.
I found it gets db records successfully when be put in a "Invoke-Command -ComputerName xxx -ScriptBlock {}" block.
But the return value isn't the type of System.Data.DataTable, it has a prefix about deserialized, so I can't get the value of each cell by calling properties/methods like before.
How can I do that?
Convert it to an array/hashtable?
Thank you!