Link to information about MSI script-based custom action error codes 2738 and 2739


Heath Stewart posted an item on his blog this past week that I wanted to raise awareness about.  In the post, located at http://blogs.msdn.com/heaths/archive/2007/05/31/windows-installer-errors-2738-and-2739-with-script-custom-actions.aspx, Heath described some potential issues and workarounds for script-based custom action failures in MSI-based setups.


These error codes appear in an MSI log file when a script-based custom action fails to run correctly, and the error messages look like the following:



  • 2738, Could not access VBScript run time for custom action [2].

  • 2739, Could not access JScript run time for custom action [2].

A common resolution for this type of error is to re-register the file %windir%\system32\vbscript.dll and/or %windir%\system32\jscript.dll.  However, on Windows Vista this can present problems because if you attempt to re-register these DLLs from a normal user cmd prompt, the registration will be written to HKEY_CURRENT_USER instead of HKEY_CURRENT_MACHINE.


A key point Heath makes in his blog post that I was not aware of before reading it is that Windows Installer will not load and use scripting engines if they are registered in HKEY_CURRENT_USER (for security reasons that he described in more detail in his post).  Therefore, if you have registered the DLLs on Windows Vista from a normal user cmd prompt, that will not help fix this type of error.


If you have these scripting engines registered under HKEY_CURRENT_USER, you need to make sure that you remove that registration and re-register them under HKEY_LOCAL_MACHINE.  You can use the following steps to unregister them from HKEY_CURRENT_USER:



  1. Click on the Start menu, choose Run, type cmd and click OK

  2. To unregister the VBScript engine, run this command:  reg delete “HKCU\SOFTWARE\Classes\CLSID\{B54F3741-5B07-11CF-A4B0-00AA004A55E8}” /f

  3. To unregister the VBScript engine on a 64-bit OS, run this command:  reg delete “HKCU\SOFTWARE\Classes\Wow6432Node\CLSID\{B54F3741-5B07-11CF-A4B0-00AA004A55E8}” /f

  4. To unregister the JScript engine, run this command: reg delete “HKCU\SOFTWARE\Classes\CLSID\{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}” /f

  5. To unregister the JScript engine on a 64-bit OS, run this command: reg delete “HKCU\SOFTWARE\Classes\Wow6432Node\CLSID\{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}” /f

One last note – if you are a setup developer reading this post, I encourage you to read this post by Rob Mensching where he explains reasons why using script-based custom actions in an MSI can lead to bad results and should be avoided if at all possible.


<update date=”7/29/2009″> Added steps to unregister the VBScript and JScript engines on 64-bit OS’s. </update>


 

Comments (29)

  1. spoiledsport says:

    This is one the things that should have been taken care of by the instaler already. The instaler team has enhanced MSI for some while, but has not taken care of fixing some of the basic functionality of the product. I have submitted change request after change request for fixes to this since the beginning. Everytime I see posting referring to "this post by Rob Mensching", I completly freak out.  

    This is total rubbish. All of his assumption are total bull. IMHO

    1.- Robust code is difficult write in script.

    This is utterly nonsense, bad code can be writing in any language, but specially C. If the developer of the custom action written in script can not do a simple try{}catch() on his code, changing to C would not make it any better.

    1.  Debugging script in the Windows Installer is difficult

    Another stupid instaler team mistake and another request of mine. Has anyone on that team heard of "Active Scripting Host debug". Microsoft for some while sold us the idea of scripting debugging, I built several of them. doesn’t that team care what their customer want?

    1.  Anti-virus products kill them

    My anti-virus kills any new code I put in my machine. Many ways exist of fixing this, but the main one is: Just execute the stupid script, do not put it in the file system, get it directly from the binary table and execute it, simple isn’t it?

    4.- Make sure jscript.dll and vbscript.dll are correctly registered.

    So many things that are supposedly part of the base system (ie, media player, etc). Aren’t those part of the system too since they are required by and used by the former apps? Shouldn’t the system (MSI, etc) make sure they are in the correct state before executing an action which requires it?

    This is just the tip of the iceberg. I honestly think that script should be the ONLY allowable way of writing custom action, since they provide sort of a sandbox model to protect the end user from ill-intented code from the part of the producer of the MSI and for the most part (i could say allways) they provide all the functionality you may possible need, besides the fact that script is so easy to write and debug (with the right support, of course)

    I will send another set of emails to the Windows Installer Wishes mailto:msiwish@microsoft.com asking for some fixes for the upcoming 4.5 release. Let’s hope someone is actually listening…………

  2. Recently, while attempting to build a Japanese MSI using WiX v3.0 , I received an error message that

  3. navara says:

    Under Windows 7 x64 I also had to delete this key:

    HKEY_CURRENT_USERSoftwareClassesWow6432NodeCLSID{B54F3741-5B07-11CF-A4B0-00AA004A55E8}

  4. astebner says:

    Hi Navara – Thanks for the information.  I’ll update the main blog post to include the x64 registry values in addition to the x86 registry values for this scenario.

  5. Martin Schlemmer says:

    Having had to do this more than once (and also for Visual Studio's Wizard issues), and on more than one machine, I wrote a batch file.  Simply copy below to a .bat, and right-click -> Run as administrator

    —–RegScriptHosts.bat—–

    @ECHO OFF

    FOR /D %%I IN (%0) DO CD /d %%~dpI

    SET ARCH=x86

    rem If either is set to AMD64, we have a 64bit OS

    IF /I "x%PROCESSOR_ARCHITECTURE%x" == "xAMD64x" SET ARCH=x64

    IF /I "x%PROCESSOR_ARCHITEW6432%x" == "xAMD64x" SET ARCH=x64

    FOR %%V IN (VBScript JScript) DO CALL :Register %%V

    GOTO :done

    :Register

    CALL :SetupEnv

    IF DEFINED REGSVR32 CALL :RegScript %1

    GOTO:EOF

    :SetupEnv

    SET REGSVR32=

    IF "%ARCH%" == "x86" (

    CALL :SetupEnv32
    

    ) ELSE (

    CALL :SetupEnv64
    

    )

    GOTO:EOF

    :SetupEnv32

    SET REGSVR32=%SystemRoot%System32regsvr32.exe

    SET HKCU=HKCUSOFTWAREClasses

    SET HKLM=HKLMSOFTWAREClasses

    GOTO:EOF

    :SetupEnv64

    SET REGSVR32=%SystemRoot%SysWOW64regsvr32.exe

    SET HKCU=HKCUSOFTWAREWow6432NodeClasses

    SET HKLM=HKLMSOFTWAREWow6432NodeClasses

    GOTO:EOF

    :RegScript

    SET SCNAME=%1

    IF NOT DEFINED SCNAME GOTO:EOF

    IF %SCNAME% == VBScript (

    SET KEY=B54F3741-5B07-11CF-A4B0-00AA004A55E8
    

    ) ELSE (

    SET KEY=F414C260-6AC0-11CF-B6D1-00AA00BBBB58
    

    )

    ECHO Registering ScriptingHost for %SCNAME% (%ARCH%)

    reg delete "%HKCU%CLSID{%KEY%}" /f >NUL 2>NUL

    reg delete "%HKLM%CLSID{%KEY%}" /f >NUL 2>NUL

    "%REGSVR32%" "%SCNAME%.dll" /s

    IF ERRORLEVEL 1 GOTO :error

    GOTO:EOF

    :error

    ECHO Failed to register ScriptingHost for %SCNAME% (%ARCH%)!

    ECHO.

    GOTO:EOF

    :done

    ECHO.

    PAUSE

  6. John says:

    Hello all:

    Thanks for all the great information, but I have tried ALL of the above methods, many times, and get no further.  The error continues, even when I get positive confirmation of registration.  When I browse through the registry after the positive confirmation, the key that people sometimes had to delete is never there.  I was under the impression that registering it would create that key.

    Even if that is a wrong way to double check, things like this batch file, even though giving positive results, I still cannot install my stupid verizon access manager.  I have worked with computers my whole life, and have never felt as helpless about fixing a problem as I do now.  Any further guidance would be greatly appreciated.

    Thanks.

  7. astebner says:

    Hi John – I'm sorry for the hassles that this issue is causing for you.  The information in this blog post is not the only possible cause for this type of error.  There could be a problem within the setup package as well.  If you're only seeing this type of error from this Verizon program and not from any other programs that you are trying to install on your computer, then I'd suggest trying to contact Verizon to see if they can provide more in-depth troubleshooting for this install error.

  8. TAO says:

    thanks man

  9. Leslie (amx@index.hu) says:

    Vodafone Mobile Connect Lite VMC Lite 9.4.4.19931 causes this problem on my Windows 7 Home Premium (32bit, Lenovo OEM) also. Vodafone could not help me. Regsvr32 I've run, HKCU doesn't contain the key, but problem still arises. I'm digging the net for correct solution. Can anybody help? Thanks a lot!

  10. astebner says:

    Hi Leslie – The information in this blog post only solves one of the possible causes of this error code.  There are other possible causes as well.  A common one I've seen is anti-virus or anti-spyware software that contains script blocker functionality.  If a script blocker is running during an install that tries to run a vbscript or jscript custom action, that custom action will fail and setup will fail.  It might help to temporarily disable your anti-virus and anti-spyware, then run this installer again.

    It is also possible that this issue is caused by a bug in the installer itself.  You mentioned that Vodafone could not help – do you know what exact troubleshooting steps they had you try?

  11. Luis says:

    Mi proble es que tengo windows vista de 64 bits pero al momento de ejeuctar como administrador me sale C.windows system32> y no C:windows SysWow64 > como me deberia salir ya que tengo de 64 bit.

    Ayudenme gracias de antemano………….

  12. astebner says:

    Hi Luis – If you run c:windowssystem32cmd.exe, you will start in the system32 directory.  If you run c:windowssyswow64cmd.exe, you will start in the syswow64 directory.  For the steps in this blog post, you should use c:windowssystem32cmd.exe.

  13. Gilles says:

    Hi,

    I understand that your product has not to be installed due to this key but it's not possible to find before what is the application create this key (install or using) and solve it ?

    Kr,

    gilles

  14. astebner says:

    Hi Gilles – I'm not sure I understand your question.  Are you asking about what is causing those keys to be created in the first place?  If so, there isn't one single root cause for that.  Someone could be incorrectly registering the DLLs, or it could be a badly behaving setup program or something like that.

  15. Ashish says:

    tried re registering vb and jscrips . . .  didnt work

    deleted the 2 reg commands in W7 x64 and VOALLA  . .

    Thanks for the post . . really helped me out

  16. Michal says:

    Thanks, this article was very helpful.

  17. Roger says:

    Had this problem installing CorelDraw 12 on Win7 64bit.  Applied the 64-bit commands and it now installs properly.  Thanks for the info!

  18. Michael says:

    My problem is that i keep getting this error 2738, Could not access VBScript run time for custom action each time i try to uninstall a blackberry 9630 update and or install a srs HD audio lab software. I use a lenovo pc vista 32 bit.

  19. astebner says:

    Hi Michael – Did you try the steps listed in this blog post to see if they help resolve this error?  If you already tried those steps and they didn't help, then you may need to contact the manufacturer of the software that you're trying to install and see if they know of any other workarounds to try.

  20. DWB says:

    Deleting the registry keys worked for me.  Thanks.

  21. SHUBHAM says:

    I TRIED UNREGISTERING THE VBSCRIPT ENGINE BY CMD…BUT IT IS NOT HAPPENING…IT SAYS- The system was unable to find the specified registry key or value.

  22. astebner says:

    Hi Shubham – If you tried the commands and they reported that the registry keys are not found, then that likely means that the problem you're facing isn't the same one described in this blog post.  What version of Windows are you using, and what is the exact error you're seeing?

  23. Nayan says:

    This is what fixed my problem.. just run Microsoft Fix it to reset VBScript security settings

    blogs.technet.com/…/error-code-2738-when-running-a-microsoft-fix-it-solution.aspx

  24. Art Gola says:

    You will also get this error if you are running the WiX build on a TFS Build Server and the Service Account under which the build process is running is not in the Local Administrators group on the machine.  After adding the Build Service Account to the Local Administrators group on the build server, make sure to restart the Build Service.

    I can only assume that the Windows Installer service somehow limits access to account which are Local Administrators.

  25. David Clarke says:

    Thanks Art, very pleased I read *all* the comments.

  26. Ernie W says:

    Ref "Error 2738 Could not access VBScript runtime for custom action."

    Thanks Martin Schlemmer for your Batch file.  I had spent many hours trying to repair this error and your batch file immediately fixed the problem. I appreciate your work and sharing very much.