Here is how to do both.
1. Make a txt file and put this in (Lets say the file name is reg_per.txt)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root [1 5 7 11 17]
Then just run
regini.exe reg_per.txt
In the text file you add each reg key you want to change permissions on.
2. Make a bat file say reg.bat
In the bat file put
regedit /s legacy_mpssvc.reg
now run the bat file with psexec.exe
psexec.exe -i -d -s cmd.exe /c reg.bat
And that will run cmd.exe as the system account at which point cmd.exe runs the bat file we made
Shane