VBScript to list installed OLEDB Providers

I found that the script I got by googling for that title failed on the line:
CreateObject(“RegEdit.Server”)
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

OutText=""
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
next
Wscript.Echo OutText

'Windows Script Host
'---------------------------
'SQLOLEDB
' Microsoft OLE DB Provider for SQL Server
'
'Microsoft.ACE.OLEDB.12.0
' Microsoft Office 12.0 Access Database Engine OLE DB Provider
'
'Microsoft.ACE.OLEDB.15.0
' Microsoft Office 15.0 Access Database Engine OLE DB Provider
'
'SQLNCLI10
' SQL Server Native Client 10.0
'

Advertisements

About Patrick O'Beirne, spreadsheet auditor

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

2 Responses to VBScript to list installed OLEDB Providers

  1. pedie says:

    thanks Patrick very useful.

  2. Ganesh says:

    Very Useful. Thank you very much

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 )

Google+ photo

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

Connecting to %s