none
Install MS Access DAO Primary Interop Assembly for Use with PowerShell Script RRS feed

  • Question

  • [Full disclosure - I first posted this question on Stack Overflow, and I thought that this forum might provide additional insight around what may be different with Office 365. You can find that post at http://stackoverflow.com/questions/41747717/install-ms-access-dao-primary-interop-assembly-for-use-with-powershell-script ]

    I am trying to automate Microsoft Access 2016 with PowerShell, but I appear to be missing an Office Primary Interop Assembly called `Microsoft.Office.Interop.Access.Dao`. I've tried a few approaches in PowerShell, and these are the errors that I get:

        PS > $app.Application.OpenCurrentDatabase()
        The following exception occurred while retrieving member "Application": "Could not load file or assembly 'Microsoft.Office.Interop.Access.Dao, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified."
        At line:1 char:1
        + $app.Application.OpenCurrentDatabase()
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
        + FullyQualifiedErrorId : CatchFromBaseGetMember
    
        PS > Add-Type -Assembly "Microsoft.Office.Interop.Access.Dao"
        Add-Type : Could not load file or assembly 'Microsoft.Office.Interop.Access.Dao, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
        At line:1 char:1
        + Add-Type -Assembly "Microsoft.Office.Interop.Access.Dao"
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Add-Type], FileNotFoundException
        + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.AddTypeCommand

    Please note the difference in version (15.0.0.0 vs 12.0.0.0).

    The only version of Office that I have installed on this machine is Office 2016 via Office 365 download. I have run `gacutil /l` from a Visual Studio Command Prompt, and I see that the other Office PIAs, version 15.0.0.0, are installed.


    According to the NuGet Web site at https://www.nuget.org/packages/Microsoft.Office.Interop.Access.Dao/15.0.4420.1017, I could download the assembly via NuGet Package Manager Console, if I were working on a Visual Studio Solution, but I cannot install the assembly with PowerShell:

        PS > Install-Package Microsoft.Office.Interop.Access.Dao
        Install-Package : No match was found for the specified search criteria and package name 'Microsoft.Office.Interop.Access.Dao'. Try Get-PackageSource to see all available registered package sources.
        At line:1 char:1
        + Install-Package Microsoft.Office.Interop.Access.Dao
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
        + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

    My questions are:

     1. How can I install `Microsoft.Office.Interop.Access.Dao` to the GAC
        so I can reference it in PowerShell scripts?
     2. If nuget.org is listed as a `PackageSource` in PowerShell, why can't I use the `Install-Package` command to install this assembly?
     3. Why did this assembly not get installed with Office 2016/365? Or, is the assembly I need installed under a different name, like `Microsoft Office 15.0 Access Database Engine Object Library` ?



    Thursday, January 19, 2017 8:50 PM

All replies

  • Hi,

    1. I think this is part of the Primary Interop Assemblies. You can download them here: https://www.microsoft.com/en-us/download/details.aspx?id=3508. Try adding it to the GAC manually.

    2. Sorry, I don't know...

    3. This assembly gets automatically installed when you install Visual Studio. For end-users this is not required. That's why it's not a part of the Office installation.


    Regards, Sjoukje

    Please remember to click 'Mark as Answer' on the post that helps you.

    Friday, January 27, 2017 12:59 PM
    Moderator