The icacls tool is limited to files and directories, while subinacl managed services and registry as well.
For services (and registry?), you may want to try GPO: http://support.microsoft.com/kb/256345
To script a solution, the best I could find in my search is to use Set-Acl: http://technet.microsoft.com/en-us/library/hh849810.aspx
via SubInACL.exe for Windows 7.
You will need to run ‘Subinacl Tool’ to reset the permission to normal. To reset system permissions, follow the steps:
1. Download subinacl.msi from the following link, and save it on the desktop.
2. On the desktop, double-click subinacl.msi to install the tool.
3. Select C:WindowsSystem32 as the destination folder.
Note This step assumes that Windows is installed in C:Windows. If Windows is installed elsewhere, select the appropriate path to .System32.
4. Open Notepad.
5. Copy the following commands and then paste them into the opened Notepad window.
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=system=f
6. In Notepad click File, Save As, and then type: reset.cmd
7. In Notepad click Save as type, and then select All Files (.).
8. Save the reset.cmdfile to your desktop, and close Notepad.
9. Double-click the reset.cmdfile to reset the Windows Update permissions.
Note This step may take several minutes, so please be patient. When the permissions have been reset, you will be prompted with \”Finished, press any key to continue.\”
10. Press any key to complete the installation.
Check if you have the right permissions to all the folders for all users.
For more information you may check the article given below. The article given is for Windows XP updates, but still holds good for Windows Vista as well as Windows 7.
via How to reset all user permissions to default? – Microsoft Community.