List OLE/ODBC Providers with .NET
Recently I wanted to be able to list the OLE/ODBC Providers installed on a system. Not horribly hard, but also didnt have a ton of luck finding info on how to do this.
For OLE there is a .NET library that allows you to do this fairly easily. I focused in on the wrong method at first but thanks to help from BigTeddy over at the Technet Powershell forums the problem was resolved.
System.Data.OleDBEnumerator class has a GetElements method that will return a list of available providers.
Oddly enough, you would think that the System.Data.ODBC namespace would have something along those lines, but no. If it does, I cant find it. However, you can pull it from the registry fairly easily from the following location.
Get-ItemProperty 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers' #32 bit drivers on a 64 bit system here Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers'