title: Install MS Access DAO Primary Interop Assembly for Use with PowerShell Script
body: <p>I am trying to automate Microsoft Access 2016 with PowerShell, but I appear to be missing an Office Primary Interop Assembly called <code>Microsoft.Office.Interop.Access.Dao</code>. I've tried a few approaches in PowerShell, and these are the errors that I get:</p>
  
  <pre><code>PS &gt; $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 &gt; 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
  </code></pre>
  
  <p>Please note the difference in version (15.0.0.0 vs 12.0.0.0).</p>
  
  <p>The only version of Office that I have installed on this machine is Office 2016 via Office 365 download. I have run <code>gacutil /l</code> from a Visual Studio Command Prompt, and I see that the other Office PIAs, version 15.0.0.0, are installed.</p>
  
  <p><a href="https://www.nuget.org/packages/Microsoft.Office.Interop.Access.Dao/15.0.4420.1017" rel="nofollow noreferrer">According to the NuGet Web site</a>, 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:</p>
  
  <pre><code>PS &gt; 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
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>How can I install <code>Microsoft.Office.Interop.Access.Dao</code> to the GAC
  so I can reference it in PowerShell scripts?</li>
  <li>If nuget.org is listed as a <code>PackageSource</code> in PowerShell, why can't I use the <code>Install-Package</code> command to install this assembly?</li>
  <li>Why did this assembly not get installed with Office 2016/365?</li>
  </ol>
  
  <p>The accepted answer will provide at least a solution to my first question - How can I install <code>Microsoft.Office.Interop.Access.Dao</code> to the GAC so I can reference it in PowerShell scripts? </p>