|
ChPermisionOnFiles
Changes permisions of all files in a folder and sub folders.
Uses the tool cacls.exe check
http://www.techrepublic.com/article/use-caclsexe-to-view-and-manage-windows-acls/
Thank's to Sudhakar for typing check
' all rights goes to Deltaboy.dk
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Temp"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
Wscript.Echo objFile.Name & " set perm"
strFile = objFile.Name
'Set WshShell = CreateObject("WScript.Shell")
setPerms = "%COMSPEC% /c echo Y| C:\windows\system32\cacls.exe " & Chr(34) & strFile & Chr(34) & " /G emea\everyone:F"
wscript.echo setPerms
WshShell.run setPerms
If Err.Number > 0 then
Wscript.Echo objFile.Name & " Error " & Err.Number & " was returned!"
Wscript.Quit(1)
End If
Next
Set objFSO = Nothing
Wscript.echo "I'm done"
|