Unable to find type [DBNullScrubber].
I am having a handful of Windows 10 1909 machines out of 2,500 that seem to dislike Invoke-SqliteQuery when returning data as a PSObject. I get this error:
Unable to find type [DBNullScrubber]. At C:\Program Files\WindowsPowerShell\Modules\PSSQLite\1.1.0\Invoke-SqliteQuery.ps1:536 char:25
The query itself is quite simple and works on almost all endpoints: SELECT Name FROM sqlite_master WHERE type='table' AND Name LIKE '%5%'; It is done from a computer running PS 7.1, but executing via Invoke-Command on computers running PS 5.1.
Short of rewriting my code to return the data in a different format, is there anything I can do to work around this? It looks like others are having this issue as well, but it seems to be reported on Core versions only. I would be the oddball. :)
Thanks,
Don Wyatt
Try using -As DataRow.
You'll need to take into account the differences between DBNull and $null after that though. See https://stackoverflow.com/questions/22285149/dealing-with-system-dbnull-in-powershell for more info. It will be less PowerShell-y, but in theory, it should work.
Probably worth fixing this in the module so it doesn't hit that bit of code when using non-Windows PS, but that's not something I'll have time to work on unfortunately
Cheers!
Ran into the error Unable to find type [DBNullScrubber] today with PowerShell version 7.4.0. We use simple SQL queries. Will there be a fix in the module?
Sorry, I was posting in the wrong place.
We were using Invoke-SqlCmd2 and got the error Unable to find type [DBNullScrubber]. To solve it we switched to using the native CmdLet Invoke-SqlCmd, which is installed when installing Sql Server Management Studio. We then had to add the switch -TrustServerCertificate.
Hope this helps others.