My last post for using cacls for providing permissions seems to be not working well for applying permissions on folders under program files, so i have modified the script a bit and used SetACL to give permissions . Following is the script to give permissions. I m also adding script to apply permissions on registry. Do let me know if you face any issues.

 

Option Explicit
'On Error Resume Next
Dim Objshell,ObjFSO,Setpath,DestPath,SetExe1,SetExe2,ProFiles
set objshell=createobject("Wscript.shell")
set objFSO=createobject("Scripting.FileSystemObject")
proFiles=objshell.ExpandenvironmentStrings("%PROGRAMFILES%")
setpath=proFiles & "\Test\SetACL.exe"
DestPath=proFiles & "\<Enter the folder name to give permission to >"
setexe1=chr(34) & setPath & chr(34) & " -on " & chr(34) & DestPath & chr(34) & " -ot file -actn ace -ace " & chr(34) & "n:domain1\user1;p:full" & chr(34)
setexe2=chr(34) & setPath & chr(34) & " -on " & chr(34) & "hklm\software\microsoft\policies" & chr(34) & " -ot reg -actn ace -ace " & chr(34) & "n:domain1\user1;p:full" & chr(34)
objshell.run setexe1