Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Solving setup errors by using the SubInACL tool to repair file and registry permissions

Solving setup errors by using the SubInACL tool to repair file and registry permissions

Rate This

A while back, I wrote a blog post about a .NET Framework 2.0 beta 2 installation problem that was caused by incorrect access control list (ACL) permissions on some registry hives.  In that post, I described how to use a tool in the Windows Resource Kit named SubInACL to reset file and registry ACLs to help solve this problem.

Ever since I wrote that post, I have run into installation errors for several other products that have been solved by using the SubInACL tool.  Therefore, I wanted to write a standalone set of instructions for how and when to use the SubInACL tool because the previous blog post is specific to the .NET Framework 2.0 setup and does not always appear in search results when people run into this kind of a problem and search the Internet for assistance.

How to download and run SubInACL

Here are some steps that can be used to download and run the SubInACL tool to repair file and registry permissions that are often needed to successfully install programs on Windows, particularly for MSI-based (Windows Installer) setups:

  1. Download the SubInACL tool and install it.  By default it will install to c:\Program Files\Windows Resource Kits\Tools
  2. If you are running Windows Vista, click on the Start menu, choose All Programs, then Accessories, then right-click on the item named Command Prompt and choose Run as administrator
  3. If you are running an OS other than Windows Vista, go to the Start menu, choose Run, type cmd and click OK
  4. In the cmd prompt, type notepad reset.cmd and click yes to open Notepad.exe and create a new text file named reset.cmd
  5. Copy and paste the following contents into reset.cmd (or download it from this location on my file server and rename it from reset.cmd.txt to reset.cmd):

    @echo off
    title Resetting ACLs...

    setlocal

    echo.
    echo Determine whether we are on an 32 or 64 bit machine
    echo.

    if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86

    set ProgramFilesPath=%ProgramFiles(x86)%

    goto startResetting

    :x86

    set ProgramFilesPath=%ProgramFiles%

    :startResetting

    echo.

    if exist "%ProgramFilesPath%\Windows Resource Kits\Tools\subinacl.exe" goto filesExist

    echo ***ERROR*** - Could not find file %ProgramFilesPath%\Windows Resource Kits\Tools\subinacl.exe. Double-check that SubInAcl is correctly installed and re-run this script.
    goto END

    :filesExist

    pushd "%ProgramFilesPath%\Windows Resource Kits\Tools"

    echo.
    echo Resetting ACLs...
    echo (this may take several minutes to complete)
    echo.
    echo IMPORTANT NOTE: For this script to run correctly, you must change
    echo the values named YOURUSERNAME to be the Windows user account that
    echo you are logged in with.
    echo.
    echo ==========================================================================
    echo.
    echo.
    subinacl.exe /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=YOURUSERNAME=f /setowner=administrators > %temp%\subinacl_output.txt
    echo.
    echo.
    subinacl.exe /keyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=YOURUSERNAME=f /setowner=administrators >> %temp%\subinacl_output.txt
    echo.
    echo.
    subinacl.exe /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo.
    echo.
    subinacl.exe /keyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo.
    echo.
    subinacl.exe /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo.
    echo.
    subinacl.exe /keyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo.
    echo.
    echo System Drive...
    subinacl.exe /subdirectories %ProgramFilesPath%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo.
    echo.
    echo Windows Directory...
    subinacl.exe /subdirectories %windir%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo.
    echo.
    echo ==========================================================================
    echo.
    echo FINISHED.
    echo.
    echo Press any key to exit . . .
    pause >NUL

    popd

    :END

    endlocal

     
  6. Change the values named YOURUSERNAME to be the Windows user account that you are logged in with.

    Note:  The YOURUSERNAME value should match the name of your user folder at c:\Documents and Settings (or c:\users on Windows Vista and higher).  You can also find the value to use for YOURUSERNAME by launching Task Manager and looking at the user name listed in the User Name column of the Processes tab.

  7. Save and close reset.cmd. 
  8. In the cmd prompt, type reset.cmd and press enter to run the SubInACL tool.  This tool will take several minutes to run, and it requires that the user account you are using has administrator privileges on the system.  This is why it is necessary to run it from an elevated cmd prompt on Windows Vista.  Step 2 above can be used to start an elevated cmd prompt on Windows Vista.
  9. After reset.cmd completes, try to install the product that previously failed to install correctly on your system.

Note: There are a couple of scenarios where installing or running SubInAcl can fail.  For example, some non-English versions of Windows have the name of the Administrators group translated to another language, and the command lines listed above will fail in that case.  I have posted workarounds for the issues that I know of in this separate blog post.

Also note: Running the above command lines will cause SubInAcl to create a log file named %temp%\subinacl_output.txt.  If you see any errors reported in the cmd prompt after running SubInAcl, you can look in this log file for more detailed information about what file(s), folder(s) or registry value(s) are causing the errors.  To open this log file, you can click on the Start menu, choose Run, type notepad %temp%\subinacl_output.txt and click OK.

When looking at this log file, you may see some errors reported with error code 5.  That error code means Access Denied, and it is typically caused by Windows or some other program running on your system that is holding files, folders or registry values in use so that SubInAcl is unable to update the permissions for them.  Most of the time, that type of error in the SubInAcl output can be safely ignored, but you may need to try to reboot and then manually fix the permissions for these files, folders or registry keys as a workaround.

When is SubInACL useful

I have found that the SubInACL tool is most useful when a setup package fails with error code 5 or 0x5 or 0x80070005.  All of these error codes mean Access Denied, and this type of error code is often caused by missing ACLs for the Administrators group or the built-in System account.  The Windows Installer service runs with System account permissions in most cases.  If the System account does not have sufficient permissions to access the file system or parts of the registry, an MSI-based setup package will fail with an Access Denied error.

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

Example of a setup failure that was fixed by SubInACL

A customer contacted me with a problem installing Visual Studio 2005.  I looked at the main Visual Studio log file located at %temp%\dd_vsinstall80.txt, and I found that Windows Installer 3.1 setup was failing.  Then, I looked at the Windows Installer 3.1 setup log file located at %windir%\KB893803v2.log.  It showed the following error:

30.844: DoRegistryUpdates:UpdSpInstallFromInfSection Failed for MSI.Reg.Install: 0x5
30.844: DoInstallation:DoRegistryUpdates failed
30.875: Access is denied.

I had the customer run the above steps to use the SubInACL tool to update the file and registry ACLs on their system, and then they were able to install Windows Installer 3.1 and Visual Studio 2005 with no further problems.

<update date="11/15/2006"> Updated subinacl command lines to include recursive ACL updating for folders and files under %windir% </update>

<update date="3/22/2007"> Updated the steps to make them easier to follow by moving the directory change into the batch file. </update>

<update date="9/25/2007"> Updated the notes to indicate that some Internet Explorer script errors can be resolved with this tool as well. </update>

<update date="5/30/2008"> Updated command lines based on customer feedback regarding their experiences on Windows Vista. </update>

<update date="6/16/2008"> Updated command lines to cause SubInAcl to create a log file in the %temp% directory in case it is needed for troubleshooting afterwards. </update>

<update date="6/17/2008"> Added a link to a blog post where I describe a couple of workarounds for problems that can occur while trying to install and/or run SubInAcl. </update>

<update date="6/20/2008"> Updated command line to include a backslash after %SystemDrive% in the 2nd to last command. </update>

<update date="6/24/2008"> Updated wording of link to the post for troubleshooting SubInAcl errors to try to make it more visible. </update>

<update date="7/29/2008"> Updated directory ACL command lines to not affect the Documents and Settings sub-folders. </update>

<update date="3/12/2009"> Fixed broken link to reset.cmd. </update>

<update date="4/7/2009"> Added clarification about how to determine the correct value to substitute for YOURUSERNAME in the sample SubInAcl script. </update>

<update date="5/18/2009"> Added clarification about where to run reset.cmd after creating it. </update>

 

  • Impressive, this had saved me from insanity :)

    Sometimes windows can surprise me for the worst reasons.....

    Save me from a error: Permission denied installing asp.net webpages 2 ("pre-requisite from asp.net mvc 4")

    thank you!

  • Hello Mr Stebner, after reading about your great tools I am writing to see if any of them can help me. I have just bought Visual Studio Professional 2013. Previously on this same machine I had installed both the 2010 and 2012 versions, never had any issue. This time, shortly after the VS installer starts, when it tries to install the .NET framewrok 4.5.1 I get a setup failed message, which specifies the famous "The Windows Installer service could not be accessed" error message. I have tried many things already, as indicated on several support articles, but nothing works for me. It's just terrible . OS Windows 7 pro

    I would appreciate if you can send me to any direction to solve this problem.

  • Hi Amador - Can you please use the tool described at blogs.msdn.com/.../6458047.aspx to collect all of your setup log files, upload the file named %temp%\vslogs.cab that this tool will create to a file server (such as http://skydrive.live.com), and then reply back here and provide a link that I can use to download your log files and take a closer look?

  • Thank you very much! I know that you must be very busy and I do not want to cause you trouble. The output of that tool is over 12 megs.

    You can download it from here https://db.tt/6DH7nh3y

  • Hi Amador - From your logs, it looks like you've still got a preview version of the .NET Framework 4.5.1 installed on your computer, and that might be causing problems with the final version of the .NET Framework 4.5.1 and VS 2013.  I'd suggest trying to fully uninstall any preview versions of VS 2013 and the .NET Framework 4.5.1 that you have on your computer and then try to install VS 2013 again.

  • OMG! Can't believe this. I had this annoying 80070005 error. Tried a bunch of methods none of them worked.

    But yours did!

    Bra jobbat (well done, in Swedish!)

  • I recently installed MS Office Pro 2007 on a Dell laptop.  Every time I start MSAccess, "Microsoft Office Professional Hybrid 2007" configuration runs before opening Access.  It doesn't happen with any other Office App.  Is there any way to stop this Hybrid configuration each tme Access is opened?  Thanks in advance for your response.

  • TomV

    I forgot to mention I am running Windows XP Pro SP3.

  • Hi TomV - I typically use steps like the ones listed at blogs.msdn.com/.../219764.aspx to narrow down the cause of this type of configuration dialog.  Those steps require relatively advanced knowledge of Windows Installer though, so you might want to try to post a question on the Office 2007 forum at answers.microsoft.com/.../office_2007 to see if someone there can provide more detailed troubleshooting steps.

  • Wow!  I have been working on an iTunes registry error for about 2 1/2 days (about 14 hours total) and THIS finally did the trick.  Thank you, thank you, thank you!  There was so much I found when researching this issue that just didn't work but this did.  Thanks again.  Also - I am an IT analyst and have been around Windows for a very, very long time.  For those of you that are wondering, this utility took about 75 minutes to run.  If you'd like, you can run the process monitor (3rd party tool that's blessed by Microsoft) at the same time while this runs so that you can "see" what's going on.  

  • C:\Users\iPhone3G>cd /d "C:\Program Files\Windows Resource Kits\Tools"

    C:\Program Files\Windows Resource Kits\Tools>subinacl /subkeyreg HKEY_CURRENT_US

    ER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=iPhone3G=f

    /setowner=administrators  1>C:\Users\iPhone3G\AppData\Local\Temp\subinacl_outpu

    t.txt

    Elapsed Time: 00 00:00:03

    Done:     4114, Modified     4113, Failed        1, Syntax errors        0

    Last Done  : HKEY_CURRENT_USER\Volatile Environment\1

    Last Failed: HKEY_CURRENT_USER\Software\SecuROM\License information : 2 The syst

    em cannot find the file specified.

    C:\Program Files\Windows Resource Kits\Tools>subinacl /keyreg HKEY_CURRENT_USER

    /grant=administrators=f /grant=system=f /grant=restricted=r /grant=iPhone3G=f /s

    etowner=administrators  1>>C:\Users\iPhone3G\AppData\Local\Temp\subinacl_output.

    txt

    Elapsed Time: 00 00:00:00

    Done:        1, Modified        1, Failed        0, Syntax errors        0

    Last Done  : HKEY_CURRENT_USER

    C:\Program Files\Windows Resource Kits\Tools>subinacl /subkeyreg HKEY_LOCAL_MACH

    INE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /gr

    ant=restricted=r /setowner=administrators  1>>C:\Users\iPhone3G\AppData\Local\Te

    mp\subinacl_output.txt

  • i had installed visual stdio 10 .can i install visual studio 2010 in my system both .?

  • Hi hariom - Yes, you can install both of these versions of Visual Studio side-by-side on the same computer.

  • 'subinacl' is not recognised as an internal or external command, operable command or batch file.

    WHAT DOES THIS MEAN??

  • Hi anirudh - That error message means that the file subinacl.exe is not in the directory that you ran the command from.  That could happen if you didn't install the subinacl tool or if you didn't change directory to the folder that it is installed to before running the other commands.  Can you please double-check that subinacl is installed correctly and that you ran the steps exactly as they are listed above in this blog post?

    If it continues to happen after checking those things, please post a screenshot so I can take a closer look.

Page 18 of 21 (310 items) «1617181920»
Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post