May 13, 2008
Tip and Trick Editorial

Fix Setup Installer Package Access Denied Failure Error Code 0x80070005 (Or 5 Or 0x5)

When running an executable of setup installer or setup update package of various programs, installation process may fail with Access Denied error dialog message, or system responses or records in Event Log Viewer with error code 5 or 0x5 or 0x80070005, which all indicates Access Denied problem. Then the setup terminates itself, and installation process is rollback.

The Access Denied problem when running setup installation process for programs such as Windows XP SP3, Microsoft .NET Framework, AVG AntiVirus, QuickTime, Windows Genuine Advantage Validation Tool (WGA), Pinnacle, Visual Studio, Windows Installer and many other application, including even updates and hotfixes from Windows Update, Microsoft Update and Automatic Update. The reported issue and problem happens any Windows flavor, including on Windows XP and Windows Vista, but mostly affect MSI-based setup installer package.

The Access Denied or 0x80070005 error code on .MSI setup executable is caused by invalid or missing ACLs (Access Control Lists) for the Administrators group or the built-in System account in registry hives or file permission. .MSI setup package depends on Windows Installer service for installation. When the permissions are missing or invalid, the System account, which the Windows Installer service run as, does not have sufficient permissions to access the file system or parts of the registry, causing the installation to fail with Access Denied error.

The resolution and solution to fix the Access Denied or error code 5 problem on installation file is to use a tool in the Windows Resource Kit named SubInACL to reset and repair file permissions and registry ACLs. Follow these steps to download and run the SubInACL tool:

  • Log on with an administrator account.
  • Download the SubInACL tool (direct download link to subinacl.msi) and run the setup to install SubInACL. Note the installation path, by default, SubInACL is installed C:\Program Files\Windows Resource Kits\Tools folder.
  • For Windows XP, go to the Start menu, choose Run, type Cmd and click OK.

    For Windows Vista, click Start button, then enter Cmd in Start Search. Right click on Cmd appears in Programs list, and select Run as Administrator to open elevated command prompt. Confirm the UAC elevation request or enter administrator’s password if requested.

  • Download the ready-made reset.cmd (inside or follow instruction below to create one yourself.

    Type notepad reset.cmd and answer Yes to open NotePad to create a new file named reset.cmd. Cop and paste the following line of codes into the text editor.

    @echo off
    title Reset ACLs and Permissions in Windows

    REM Determine if it's 32-bit (x86) or 64-bit (x64) machine
    if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86

    REM 64-bit computer
    set ProgramFilesPath=%ProgramFiles(x86)%
    goto startResetting

    REM 32-bit computer
    set ProgramFilesPath=%ProgramFiles%

    REM Start processing
    cd /d "%ProgramFilesPath%\Windows Resource Kits\Tools"
    echo Resetting registry and files ACLs...
    echo The process may take several minutes to complete.
    echo ==========================================
    subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f
    subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f
    subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f
    REM Reset permissions in System drive
    subinacl /subdirectories %SystemDrive% /grant=administrators=f /grant=system=f
    REM Reset permissions in Windows directory
    subinacl /subdirectories %windir%\*.* /grant=administrators=f /grant=system=f
    echo =========
    echo Finished.
    echo =========

    Save the new text file and close NotePad. Code above assume that the installation path for SubInACL utility is at default C:\Program Files\Windows Resource Kits\Tools folder (it automatically detect correct Program Files (x86) folder if you’re using Windows Vista x64). If you have changed installation path, change the cd /d “%ProgramFilesPath%\Windows Resource Kits\Tools” to a valid full path to SubInACL executable.

  • Run the reset.cmd batch command script run the SubInACL tool to fix the ACL permissions in the registry and file system.
  • Wait for the processing to finish, which may lasts for more than a few minutes depending the ‘size’ of your Windows. When Finished. Press any key to continue is prompted, press any key to exit.
  • Try to run the setup installer again to install the product that previously failed to install correctly on your system, or run Windows Update to install updates, patches or hotfixes again.

SubInACL can also help resolve Internet Explorer script errors caused by incorrect access control permissions for specific user accounts on the system.

If you’re encoutering error message such as “Error when checking arguments – HKEY_LOCAL_MACHINE” on most registry hives in Windows Vista, try to remove /grant=administrators=f switch away from the SubInACL commands in the batch command script above. Most permissions in Windows Vista is assigned to SYSTEM built-in account, so without rights assigned to Administrators user group, the fix will work too.

Pin It on Pinterest

Share This

Share This

Share this post with your friends!