Closed GregLeeUpSearch closed 4 months ago
Hold on any research here. It started working today. Nothing has changed on my end so I'm waiting to hear from the customer to see if anything changed in their environment surrounding the instances that were previously failing. I will report back in at the beginning of next week.
Just make sure the new version of the module (currently v22.2.0) is being picked up by the script.
Hi @GregLeeUpSearch,
Older version (21.x and some early v22) did not have the -TrustServerCertificate
parameter, hence the possible failure observed.
I'll go ahead and close this issue for now. Just open new one if you see something abnormal. Thanks!
Import-module sqlserver -MinimumVersion 22.2.0
$ConfigInfo = Import-CSV 'C:\ConfigStuffToImportOnSQLServer.txt'
Write-SqlTableData -ServerInstance myinstance -DatabaseName 'master' -SchemaName 'dbo' -TableName 'GoodStuff' -Force -ConnectionTimeout 0 -Timeout 0 -InputData $ConfigInfo -TrustServerCertificate
This command mostly works but out of 200 SQL Servers it fails on 10 of them:
Write-SqlTableData : A parameter cannot be found that matches parameter name 'TrustServerCertificate'.
Additionally Invoke-SqlCmd runs fine against the same instances that fail the above command while using TrustServerCertificate.
The Bug (or I think it is one) is with the version 22.2.0 sqlserver module and Write-SqlTableData.
Thanks, Greg