powershellodbcdsn

PowerShell script to enable TCP/IP protocol in ODBC


I am working on a PowerShell script to add User DSN in ODBC. At this stage, I am able to add the Name, Platform, DSN type etc. But, I am stuck at enabling TCP/IP protocol under the Network tab and passing values to it.

My current script is,

Add-OdbcDsn -Name SQL -Platform "32-bit" -DriverName "Microsoft Access Driver (*.mdb)" -DsnType "User" -SetPropertyValue @("Servername=SQLServer", "UserID=SQLUser")

Could someone please guide me?

Thank you.

enter image description here


Solution

  • Solved it by using parameter "CommLinks".

    So, the update script is

    Add-OdbcDsn -Name SQL -Platform "32-bit" -DriverName "Microsoft Access Driver (*.mdb)" -DsnType "User" -SetPropertyValue @("Servername=SQLServer", "UserID=SQLUser", "CommLinks=SharedMemory,TCPIP{dobroadcast=no}")