Re: Create folder structure inside current folder. by McKirahan
McKirahan
Wed May 25 07:28:35 CDT 2005
"Woody" <TOSCA925@YAHOO.CO.UK> wrote in message
news:1117023632.604248.114780@z14g2000cwz.googlegroups.com...
> I am going to be cheeky now and ask if you can help me with this script
> dilema i have before i create another post in the group.
> I am using this script below to create the permissions on the users
> Home Area which gives them Full Control, Administrator Full Control and
> Staff Modify.
>
> What i want to be able to do with a new script is only give read access
> to the root of the pupils home directory but full control of the
> folders (and subfolders which they will be able to create themselves)
> of the folder structure i have created for them.
>
> I currently use this.
>
> Const ForAppending = 2
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.OpenTextFile ("c:\sec.bat", ForAppending,
> True)
>
> REM
>
****************************************************************************
****
> Set objOU = GetObject ("LDAP://ou=ENTRY 97,OU=PUPILS,DC=LIB,=UK")
> REM
>
****************************************************************************
****
>
> For each objuser in objOU
>
> REM
>
****************************************************************************
****
> commandtorun = "CACLS
> "&chr(34)&"D:\HOMEDIRS\entry97\"&objUser.SAMAccountName&chr(34)&" /T /C
> /P "&chr(34)&objUser.SAMAccountName&chr(34)&":F administrator:F
> STAFFG:C <c:\y.txt"
> REM
>
****************************************************************************
****
>
> Set WshShell = CreateObject("WScript.Shell")
> REM WshShell.Run commandtorun, 1, TRUE
>
> objTextFile.WriteLine(commandtorun)
> objTextFile.WriteLine(attribcommand)
>
> REM This will make the account not expire DO NOT USE IF WANT USER TO
> CHANGE PASSWORD WHEN LOG ON
>
> Next
> objTextFile.Close
>
>
> REM RUN VBS FILE
> Set WshShell = CreateObject("WScript.Shell")
> WshShell.Run "c:\sec.bat", 1, TRUE
> REM objFSO.DeleteFile("C:\sec.bat")
> Wscript.Echo "User Security has been set"
>
> Any ideas?
>
"Const ForAppending = 2" is wrong:
ForReading = 1 ' Open a file for reading only. You can't write to this
file.
ForWriting = 2 ' Open a file for writing. If a file with the same name
exists, its previous contents are overwritten.
ForAppending = 8 ' Open a file and write to the end of the file.
Other than that, start a new post for this problem.