Powershell error: 'Retrieving COM class factory failed: class not registered (REGDB_E_CLASSNOTREG)'

The problematic command and full error message was:

"get-webconfigurationproperty : Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).“

I was pretty stuck on the above error while trying to run a script for setting up sites in IIS which involved some calls to get-webbinding (in the WebAdministration module). After much digging around I finally ran into this post. Turns out, genius that I am, I had created a shortcut to the x86 version of Powershell when I first created the VM, so I’d been using the wrong bitness the entire time. I’m surprised I didn’t have more issues!  Anyway, running the 64-bit (i.e. regular) version of Powershell fixed the problem immediately. Thanks jasonint32 ;)