This topic contains 3 replies, has 2 voices, and was last updated by
June 25, 2018 at 10:44 pm #103268
I am trying to convert an old Powershell script:
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source = 'C:\Scripts\Test.mdb'"
Set objRecordSet = objConnection.OpenSchema(adSchemaTables)
Do Until objRecordset.EOF
Wscript.Echo "Table name: " & objRecordset.Fields.Item("TABLE_NAME")
Wscript.Echo "Table type: " & objRecordset.Fields.Item("TABLE_TYPE")
My dilemma is not so much the syntax of the 'Set', or the 'Do Until ...', or the 'Wscript.Echo' statements. Rather, I am stucked with the object class references: these are references to ADO (ActiveX Data Objects).
Would be grateful for any tips or hints to the right source(s) for updates.
June 26, 2018 at 1:08 am #103276ParticipantTopics: 8Replies: 1190Points: 639Rank: Major Contributor
That is vbScript. If you just search for Powershell ADODB, there are plenty of examples:
June 26, 2018 at 1:49 am #103280
Many thanks Rob, much appreciated.
June 26, 2018 at 8:10 am #103327
Following the website references you provided, I have tested the statements (I am running PS 5.1) —
1 – $objConnection = New-Object -comobject ADODB.Connection
2 – $objRecordset = New-Object -comobject ADODB.Recordset
3 – $objConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\XXC\Documents\MyAccessDB.mdb")
I keep getting the error message: " Provider cannot be found. It may not be properly installed. "
I ran each statement individually and #1 and #2 always run fine.
It is always at #3 that I get the error. I must be missing something behind the scenes?
I have ACCESS 2007 installed and running fine on my Win 7 (64-bit) PC for many years now.
It was installed as part of Office 2007 Pro, which includes Word,Excel,PPoint,Outlook,Access & 1 or 2 other products which I don't use (Publisher). Would be grateful for any advice or suggestions.
The topic ‘Powershell and MS-ACCESS (2013)’ is closed to new replies.