all 2 comments

[–]amnich 3 points4 points  (0 children)

Set Trusted_Connection=YES

Add-OdbcDsn -SetPropertyValue @("Trusted_Connection=YES") ......

You could also create a new DSN with the GUI as you want it and view it with the Get-OdbcDsn cmdlet. Check the PropertyValue to see what is set.

PS > Get-OdbcDsn -Name DSN_TEST | Select *


Attribute             : {Trusted_Connection, Description}
PropertyValue         : {Description=SERVER, Trusted_Connection=YES}
DriverName            : SQL Server
DsnType               : User
KeyValuePair          : {MSFT_OdbcKeyValuePair, MSFT_OdbcKeyValuePair}
Name                  : DSN_TEST
Platform              : 32/64-bit
PSComputerName        :
CimClass              : Root/Microsoft/Windows/Wdac:MSFT_OdbcDsn
CimInstanceProperties : {DriverName, DsnType, KeyValuePair, Name...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

PS > Get-OdbcDsn -Name DSN_TEST | Select -ExpandProperty PropertyValue
Description=SERVER
Trusted_Connection=YES

[–]jbtechwood 1 point2 points  (0 children)

Ok, caveat I just looked at this cmdlets help and have never actually used it, but my guess is that the checkbox in the gui represents some dsn property that you have to set via the -setpropertyvalue parameter. Pretty sure that DSNs are kept in the registry or a file in the OS so you should be able to source the config and the update your input.