Today some e-mails where exchanged on how to best script registry permissions.
Depending on what you want to achieve here’s a couple of tools that can be of help.
SetACL.exe
http://www.helge.mynetcologne.de/setacl/index.htm
http://setacl.sourceforge.net/
SubinACL.exe
Regini.exe