Write-SqlTableData : A parameter cannot be found that matches parameter name 'TrustServerCertificate'.

Greg Lee 0 Reputation points
2024-03-05T16:39:18.87+00:00

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'.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,689 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,465 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 44,311 Reputation points
    2024-03-05T18:56:59.5033333+00:00

    out of 200 SQL Servers it fails on 10 of them:

    Have all 200 SQL Server the same version or do the 10 have a different one?

    Sorry, you provided so less informations, it's difficult to guess.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.