1

I'd like to connect to a Windows (XP & 7) machine remotely (command line or Powershell) & list the ODBC's installed on that machine, ideally I'd be able to list the server name/database setup in each ODBC.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
aphrek
  • 23
  • 1
  • 2
  • 4

2 Answers2

1

Unfortunately, this is a PITA, to put it mildly. (But it's gotten much easier in Windows 8, for whatever that's worth.)

And, here's a PowerShell script created over at SuperUser, based on the first link to the Scripting Guy's blog.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
0

This functionality is now natively implemented in PowerShell 4.0+ which implements the following cmdlets:

  • Add-OdbcDsn
  • Get-OdbcDsn
  • Remove-OdbcDsn
  • Set-OdbcDsn

Among others. You can read the full documentation on these and other data source cmdlets at Microsoft's Documentation website or you can just type help Get-OdbcDsn in PowerShell to get the basics.

These cmdlets do not natively support running against a remote machine (e.g. with a "target" or "computername" parameter). However other standard remote PowerShell options are available, including opening a new-pssession. You won't be able to use these cmdlets on older versions of Windows that don't support WMF 4.0, but if you're still running something that old then you need new IT.

Thomas
  • 890
  • 4
  • 18
  • 37