Invoke-SqlCmd2
Invoke-SqlCmd2 copied to clipboard
Request: a trustServerCertificate option for -Encrypt (code included)
Right now, it requires a trusted authority sign it. I'd like to get an option for it. For what I'm doing it's easy:
if ($Encrypt) {
$CSBuilder["Encrypt"] = $true
**$CSBuilder["trustServerCertificate"] = $true**
}
However, for a real version, you'd need a variable for it, and probably a nested if.
if ($Encrypt) {
$CSBuilder["Encrypt"] = $true
if ($TrustServerCert) {
$CSBuilder["trustServerCertificate"] = $true
}
}