SQLServerPSModule
SQLServerPSModule copied to clipboard
Write-SqlTableData gets TypeInitializationException with 22.1.1
I upgraded from 21.1.18256 to 22.1.1, and now Write-SqlTableData gets an error.
Write-SqlTableData : The type initializer for 'Microsoft.Data.SqlClient.InOutOfProcHelper' threw an exception.
At line:1 char:1
+ Write-SqlTableData @SQLServerArguments -TableName 'OperatorLogins' -I ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-SqlTableData], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.SqlServer.Management.PowerShell.WriteSqlTableData
I also added -TrustServerCertificate to the command, but it fails the same way with or without that.
PowerShell version is 5.1.14393.5582. Running on Windows Server 2016 Standard. SQL Server is 2012, 11.0.7507 (SP4).
Hi @KenRokos - could you provide full(er) repro? What you have above is not enought to even guess.
Maybe when you run into this, capture $Error[0].Exception.ToString() and see if there's anything useful?
Closing due to lack of activity. Make sure you have .Net4.7.2+ on Windows Server 2016, in case you see this error: it may help for sure...