Hi,

I wrote a VBScript logon script to check to see if the user has a home
directory, if not create it, and then check the permissions on it.
Here is a sample of my code:

If objFSO.FolderExists(strFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strFolder & " /t /c /g " & strUserName & ":F Administrators:F ", 2,
True)

The permissions work fine but the directory is still inheriting
permissions from the parent folder. This is not good... Is there a
way to prevent that?

Thanks.

Re: Assigning Permissions for a home directory by jd71

jd71
Mon Oct 16 10:23:26 CDT 2006

I might be incorrect on this, but try setting ther perms for each user
on a seperate line, with the first using /t /g (replacing ACL), and the
rest using /t /e /g (editing ACL). This is the way I have my script
setup, and none of my new folders are inheriting perms from parent.
Below is an example of a script that I use to create student folders
and then add "administrators" as full and the "student" (acctname) as
full:

'create folder. acctname is student's id.
Set fso = CreateObject("Scripting.FileSystemObject")
FSO.CreateFolder("\\" & homesrvr & "\students$\" & acctname)

'Set perms. acctname is student's id.
Set objWSH = CreateObject("WScript.Shell")

strACLCommand = "cmd /c echo y|cacls \\" & homesrvr & "\students$\" &
acctname & " /t /g administrators:F"
objRTC = objWSH.Run (strACLCommand , 0, True)

strACLCommand = "cmd /c echo y|cacls \\" & homesrvr & "\students$\" &
acctname & " /t /e /g " & acctname & ":F"
objRTC = objWSH.Run (strACLCommand , 0, True)


-Jd

On Oct 16, 10:54 am, "K.J. 44" <Holleran.Ke...@gmail.com> wrote:
> Hi,
>
> I wrote a VBScript logon script to check to see if the user has a home
> directory, if not create it, and then check the permissions on it.
> Here is a sample of my code:
>
> If objFSO.FolderExists(strFolder) Then
> ' Assign user permission to home folder.
> intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
> & strFolder & " /t /c /g " & strUserName & ":F Administrators:F ", 2,
> True)
>
> The permissions work fine but the directory is still inheriting
> permissions from the parent folder. This is not good... Is there a
> way to prevent that?
>
> Thanks.