Hi,
I have created this script and for some reason the script assigns only full
permssions to user home folder i am not able to assign only Modify permission
.. what i need is give Adminsitrator full access and user modify permission
only instead of full access .
Can you please check and let me know what i am doing wrong in this script .
option explicit
dim i
dim Fol
dim objFSO
dim objFolder
dim colSubFolders
dim objSubFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
for i = 1 to 2
If i = 1 Then
Set objFolder = objFSO.GetFolder("\\Storage Location1")
Else
Set objFolder = objFSO.GetFolder("\\Storage Location2")
End If
for each objSubfolder in objfolder.SubFolders
If objSubFolder.Name = "praveen" then
'MsgBox objSubFolder.Path
SetPermissions objsubfolder.Path, objSubFolder.Name
End if
next
next
msgbox "done"
Function SetPermissions(strHomeFolder, name)
Dim strHome, strUser
Dim intRunError, objShell, objFSO
'strHomeFolder = "C:\Test"
'MsgBox strHomeFolder
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strHomeFolder) Then
intRunError = objShell.Run("%COMSPEC% /C Echo Y| cacls " _
& strHomeFolder & " /E /C /G " & name & ":M ", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If
End Function
Any help would be appreciated.
Thanks
Masti
Bookmarks