Wednesday, August 29, 2007

Update to VBScript below

I found a script on the Internet that allows me to change the security for each one of the folders created by the logged on user.

What this means is:
When the user runs the script, a folder is created and inherits the permissions from the parent folder. I have it set so that all Authenticated Users have full Access. Remember, we told the users, do not scan anything that would embarrass you or the company! Well, now when the user runs the script, because they are a member of the Authenticated Users group with full control, the user is able to create the folder named after their user name. As the script continues, running CACLS (Utility to modify the Access Control List) allows me to remove the Authenticated Users group from the users folder. The user still has full right to their folder, but this now prevents any user from backing out of the UNC path and explore other users folders.

Here is the example script that I found. I modified it for my use and works very well.


' Cacls.vbs' Example VBScript to set Administrators permissions with Cacls' Version 2.1 - September 2005'
Option ExplicitDim strHomeFolder, strHome, strUserDim intRunError, objShell, objFSO
strHomeFolder = file://grand/home/user
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y cacls " _
& strHomeFolder & " /t /c /g Administrators:F ", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If
WScript.Quit
' End of Cacls example VBScript


Again, I love Scripting!

0 comments: