Error trying to print Dymo Labels with Powershell

I like to post about the stuff that always seem to evade my google fu, or perhaps requires a LOT of searching and research to find that oddball answer in the 5th reply to a thread, so here’s one of those answers that will hopefully help someone down the road.

Scenario: Trying to print a Dymo label using the Dymo 8.x .NET SDK in Powershell. The code I was trying was actually from this Reddit post. Unfortunately, the actual parts of the script that interact with the printers didn’t work, namely GetLabelWriterPrinters() and $label.Print(‘Printername’). In both cases I got the error:

“Object reference not set to an instance of an object.”

To give credit where credit is due, I found the answer here, in a completely different Reddit thread. The answer is that the SDK is likely using COM code to interact with the software, and with the Dymo Label 8.x software being 32-bit, it cannot work with Windows Powershell x64.

Once I ran the code in Powershell x86, it worked fine. Next step is to learn how to specifically run Powershell x86 for this, or if the newer Dymo Connect will work with Powershell x64.