Home > Software engineering >  How to add a file path in -SetPropertyValue while adding a DSN through Add-OdbcDsn (Powershell)
How to add a file path in -SetPropertyValue while adding a DSN through Add-OdbcDsn (Powershell)

Time:11-23

I have added DSN for ODBC driver by using below pwoershell script

Add-OdbcDsn -Name "My_Connew" -DriverName "Simba ODBC Driver for Google BigQuery" -DsnType "System" -Platform "64-bit" -SetPropertyValue @("[email protected]", "Key File Path=C:\vocus-sandpit-dfa36ce40776.json") 

Everything wroking well but it can't able to add the file path.

enter image description here

Wondering how i can add file path through -SetPropertyValue ?

CodePudding user response:

The labels used by the UI might not correspond 1-to-1 with the actual key names in the configuration schema - for example, the real key name for Key File Path is just KeyFilePath

To figure out what to use, simply consult the documentation and find the appropriate key name for a given configuration option in the UI, then use those, e.g.:

Set-OdbcDsn -Name "My_Connew" -SetPropertyValue @(
    "[email protected]", 
    "KeyFilePath=C:\vocus-sandpit-dfa36ce40776.json",
    "Catalog=vocus-sandpitvocus-sandpit",
    "DefaultDataset=vocus_rawnew"
)
  • Related