To set folder permissions in VBScript
Code:
'This script will assign Modify/C-Change (write) Permission To Power User on "C:\MyFolder" using cacls on NTFS formatted drive
Dim oShell, FoldPerm, Calcds, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
sSysDir = oFSO.GetSpecialFolder(1).Path
If Right(sSysDir,1) <> "\" Then sSysDir = sSysDir & "\"
Calcds = sSysDir & "cacls.exe"
'Chang The folder Name, User and Access rights in the following line of code
FoldPerm = """" & Calcds &"""" & """C:\MyFolder""" & " /E /T /C /G " & """Power Users""" & ":C"
oShell.Run FoldPerm, 1 ,True
Grant Permission
Bookmarks