Share via


CreateObject fails with 0x80040154

I've got a handful of stand-alone script files (mostly JavaScript) which I run from cscript.exe or wscript.exe to perform various tasks. Unfortunately, when I was setting up one of these scripts on a Server 2008 box it started to fail when attempting to instantiate one of my COM objects.

 

If you go lookup the failure code (0x80040154) you will see that it is the value for the "class not registered" error. Ok, no problem, just re-register the DLL again (via regsvr32.exe), and re-run the script. But, alas, this gave me the same error. So now I go digging through the registry to manually ensure the chain of keys and all their nodes look valid. I then try oleview.exe, and it is able to see the COM object and instantiate a version of it, so now things are really starting to get interesting (and a simple task which should have taken me a couple of minutes is now dragging out).

 

After a bit of further fruitless digging around, it occurs to me that the COM object is in a 32 bit DLL, and I'm running on a 64 bit version of Server 2008. Hmm, I wonder if that is the issue. I then go searching through my windows directory for all the copies of cscript.exe, and come across two: one in "system32" and one in "syswow64". So I then go and run the syswow64 version on my script file, lo and behold, it executes flawlessly.

 

So if your computer tells you that your COM object isn't installed, but you are pretty darn sure it is, check to ensure you are also running a compatible script host...

Comments

  • Anonymous
    September 18, 2008
    As seen earlier , it can be problematic to run scripts which rely on 32bit COM objects on a 64bit platform.