Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed

You need to check whether the PowerShell instance you are running your PS code under is 32-bit or 64-bit and make your solution build for that target platform. You can check this using:

if([IntPtr]::size -eq 8) { Write-Host 'x64' } else { Write-Host 'x86' }

Source

As pointed out in the comments setion, if you are running PowerShell 64-bit, building your solution for AnyCPU and unchecking "Prefer 32-bit" solves the issue.


Following on from @Jenish Zinzuvadiya's answer regarding PowerShell running as x86/x64, in my case the problem was that I was launching PowerShell from Visual Studio by using the "Open Command Line" plugin, which was launching PowerShell as an x86 process.

Launching PowerShell from the Start Menu did so as an x64 process and that resolved the problem for me.