VBScript to list installed OLEDB Providers

I found that the script I got by googling for that title failed on the line:
Error: ActiveX component can’t create object: ‘RegEdit.Server’

So here’s my own VBScript :

'List of installed OLEDB providers on local computer
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000

Dim OutText, Key, strComputer, objRegistry, arrKeys
Dim strKeyPath, strValueName, strValue, uValue

strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

objRegistry.enumKey HKEY_CLASSES_ROOT, "CLSID", arrKeys
Wscript.Echo "Number of Keys to be searched: " & 1+ UBound(arrKeys) & vbCrLf & "Click OK and wait a minute" ' 7645

for each key in arrKeys
strKeyPath = "CLSID\" & key
strValueName = "OLEDB_SERVICES"
if objRegistry.GetDWordValue (HKEY_CLASSES_ROOT,strKeyPath,strValueName,uValue)=0 then ' that value name exists
'get the (Default) value which is the name of the provider
objRegistry.GetStringValue HKEY_CLASSES_ROOT,strKeyPath,"",strValue
OutText=OutText & strValue & vbcrlf
' and the expanded description
objRegistry.GetStringValue HKEY_CLASSES_ROOT,strKeyPath & "\OLE DB Provider","",strValue
OutText=OutText & " " & strValue & vbcrlf
end if
Wscript.Echo OutText

'Windows Script Host
' Microsoft OLE DB Provider for SQL Server
' Microsoft Office 12.0 Access Database Engine OLE DB Provider
' Microsoft Office 15.0 Access Database Engine OLE DB Provider
' SQL Server Native Client 10.0


About Patrick O'Beirne, Excel/VBA developer

Patrick provides consultancy and training in spreadsheet automation, data analysis, testing and model review; and the Excel spreadsheet auditing addin XLtest
This entry was posted in Productivity and tagged , , , , , . Bookmark the permalink.

4 Responses to VBScript to list installed OLEDB Providers

  1. pedie says:

    thanks Patrick very useful.

  2. Ganesh says:

    Very Useful. Thank you very much

  3. meddy freeman says:

    A great Script ! Thank You

  4. Pingback: ¿Cómo obtener una lista de proveedores OLE DB instalados? - Codigos en Español

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s