Setting Permissions using SetACL

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")
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


This post is locked
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ