I’m using Invoke-DbaQuery in a dashboard, this works ok. I can get results in the dashboard and via a PowerShell session on the same server.
However, if i add the parameter -As 'psobject' (so like: Invoke-DbaQuery -As 'psobject'...) I don’t get any results in the dashboard - but - if I run the same line in a PowerShell session on the server, I do get results.
The dahsboard log shows [Invoke-DbaQuery] [srv-uatnsmsql01] Failed during execution | Unable to find type [DBNullScrubber].
As soon as I change the -As parameter from the default “DataRow” to anything else (like psobject or dataset etc) it doesn’t seem to work when executed from a dashboard.
Just mentioning here that the same issue came up when using the PSSQLite module and a SQLite instance. Running local PowerShell session tests is fine, returning psobjects is ok - but as soon as I run the same code within a PSU dashboard, I get null results and see the DBNULLSCRUBBER error.
The fix for me was explicitly setting the -As parameter to datarow for the Invoke-SqliteQuery cmdlet to actually return data.
didn’t work within a dashboard:
$Count = Invoke-SqliteQuery -DataSource “X:\Path\test.sqlitedb” -Query "SELECT COUNT() FROM $cache:cfgTableName" -As ‘psobject’ | Select-Object -ExpandProperty 'Count()’
updated to work within a dashboard:
$Count = Invoke-SqliteQuery -DataSource “X:\Path\test.sqlitedb” -Query "SELECT COUNT() FROM $cache:cfgTableName" -As ‘datarow’ | Select-Object -ExpandProperty 'Count()’