I wanted to use the SqlConnectionStringBuilder object in the SqlClient area but was having issues accessing the properties. The Object itself is just a collection with a key value structure.

To access the keys use the following PowerShell code:

$builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder
$builder.Keys

To set a property just use the key as a reference. For example:

$builder["Data Source"] = $server
$builder["Initial Catalog"] = $database
$builder["Encrypt"] = $true
$builder["TrustServerCertificate"] = $false
$builder["User ID"] = $login
$builder["Password"] = $password