Hi,
I was trying to run some commands(Ex: get-odbcdsn) in powershell version 2.0 and it throws an error:
The term ‘get-odbcdsn’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:12
get-odcdsn was added with Windows 8 and Server 2012 which come with Powershell 3.0 by default. Systems running powershell 2.0 will not have the command.
I’m not sure if there was any convenient scripting or command line tool for automating that prior to WS2012; a quick web search certainly didn’t turn up anything along those lines. However, that search did at least give the registry location where the ODBC DSNs are stored: HKLM:\Software\ODBC\ODBC.INI\ (or HKCU:\ , for user DSNs instead of System).
Under the “ODBC Data Sources” subkey, you’ll have something like “DSNName” = “SQL Server”, and there will be a corresponding “DSNName” subkey under the ODBC.INI key. Under that subkey, it looks like you should have a “Database” value that you can modify.