hi all,
Here is the vbscript to apply permissions to a folder uing cacls,since, setACL has a complex syntax, i thought to use cacls.exe present in system to apply permisions to a folder just replace the folder where u wish to apply permissions
hope u find it helpful
Option Explicit
Dim strHomeFolder, strHome, strUser,WshShell,SysRoot
Dim intRunError, objShell, objFSO
Set WshShell = CreateObject("Wscript.Shell")
SysRoot = WshShell.ExpandEnvironmentStrings("%SystemDrive%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHomeFolder = SysRoot & "\Personal"
msgbox strHomeFolder
If objFSO.FolderExists(strHomeFolder) Then
msgbox"start"
' Assign user permission to home folder.
intRunError = WshShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /e /c /g Users:F ", 2, True)
msgbox intRunError
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If
WScript.Quit
Yes I understand what you are saying....but i had to give permissions to a folder of mine, which happened to be in rootdrive(C:\), and the application shortcut worked only after giving full permissions to that folder. Anyways, since this script can be modified as per the user requirement, i just wrote it. Another purpose behind writing this script was removing the dependency on secacl exe to give permissions to folder, since, its syntax is a bit complicated. - talonsprem87 12 years ago