# Powershell and MS-ACCESS (2013)

**URL:** <https://forums.powershell.org/t/powershell-and-ms-access-2013/10874>\
**Category:** PowerShell Help\
**Created:** [June 25, 2018, 5:14pm UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874 "2018-06-25T17:14:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtan2010](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rtan2010/32/1173_2.png) [@rtan2010](https://forums.powershell.org/u/rtan2010)\
**Post date:** [June 25, 2018, 5:14pm UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874/1 "2018-06-25T17:14:09Z")

</div>

I am trying to convert an old Powershell script:

Set objConnection = CreateObject(“ADODB.Connection”)  
Set objRecordSet = CreateObject(“ADODB.Recordset”)  
objConnection.Open \_  
"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”)  
Wscript.Echo  
objRecordset.MoveNext  
Loop  
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.  
Many thanks.

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [June 25, 2018, 7:38pm UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874/2 "2018-06-25T19:38:50Z")

</div>

That is vbScript. If you just search for Powershell ADODB, there are plenty of examples:

> **[How Can I Use Windows PowerShell to Pull Records From a Microsoft Access...](https://devblogs.microsoft.com/scripting/how-can-i-use-windows-powershell-to-pull-records-from-a-microsoft-access-database/)**
>
> Hey, Scripting Guy! How can I use Windows PowerShell to pull records from a Microsoft Access database?— SB Hey, SB. You know, you’re lucky to get this question answered; after all, this looks as though it’s going to be the very last Hey,

---

<div class="post-metadata">

**Author:** ![rtan2010](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rtan2010/32/1173_2.png) [@rtan2010](https://forums.powershell.org/u/rtan2010)\
**Post date:** [June 25, 2018, 8:19pm UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874/3 "2018-06-25T20:19:00Z")

</div>

Many thanks Rob, much appreciated.

---

<div class="post-metadata">

**Author:** ![rtan2010](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rtan2010/32/1173_2.png) [@rtan2010](https://forums.powershell.org/u/rtan2010)\
**Post date:** [June 26, 2018, 2:40am UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874/4 "2018-06-26T02:40:04Z")

</div>

Hello Rob,  
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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/powershell-and-ms-access-2013/10874/5 "2024-05-16T20:34:53Z")

</div>


