How to set file permission with VBScript?
I am trying to write a VBScript to set Modify permission on a file for Users Group. However, I have not been able to figure out what's going wrong with the Script. Below is the Script I have. Any help will be appreciated. Thanks is advance.
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
sAllUsersAppData = objShell.ExpandEnvironmentStrings("%ProgramData%")
strFile = sAllUsersAppData & "\Folder1\Folder2\Folder3\File.ini"
strNTGroup = "Users"
If fso.FileExists(strFile)=true Then
objShell.Run "%COMSPEC% /c cacls " & strFile & " /T /E /G " & strNTGroup & ":C", 0, True