Jump to content

Recommended Posts

Posted

Guys would just like to say kudos on a fantastic resource.

 

I have one poser for you script kings out there, we would like to give our new/existing students a more easier life by pre-creating (if they dont exist already) subject folders per year.

 

eg: A year 9 student will have three "root" folders under their redirected "my docs" ie: Year 7, year 8, year 9 and each of these will have the core subjects under each year. Next year they will gain a Year 10 folder

 

There must be an easy script to do this at login time.

 

Anyone done this before ? I have managed to get myself part of the code, (attacthed) but im stuck on knowing how to parse the Home Folder of the student and to choose the folder depending on what year they are in.

 

our AD is structurered to re-direct My docs to a "My Documents" under the home directory and each students is a member of a group per ou based on the year they joined (but I cud start to Maintain a "Year x" group structure as well, or just change the script each year)

 

here's living in hope!!

 

Gary

create_folders.vbs

Posted

This could be quite straigth forward.

 

CD into the folder containing the student folders.

Do directory enumeration and then a foreach to create the subject folders for each student.

Posted

Sorry I should have explained more, I want to use this as part of a login script so to check/create them at first/subsequent logon.

 

This way new users and users who have deleted them will still have the structure. (also this way the previous versions client instructions can make sense to my users)

Posted

My preference would be too prefab the folders before login and set permisisons so that users can't delete folders.

 

You'll have to test it but it could be a dreag on your logn time depending on how convoluted the folder tree is.

Posted

not bothered at the moment if they delete them, however a vb solution would be preferable, I would rather that they created the folders for ownership reasons.

 

It isnt possbile to do this before login , as we are using folder redirection , so the "My Documents" folder wont be created for a new users until first login.

 

Also I'm not too sure of a neat way to do this per year group with a single script.

 

Sorry if the goal posts are quite fixed.

Posted

OK let's go back to the beginning. Is your goal to create a sturcture like this?

 

 

MyDocs share

|

|____Year7

| |__English

| |__Maths

| |__Sci

|

|____Year8

| |__English

| |__Maths

| |__Sci

Posted

Do your usernames start with the year of entry or some other means of identifying their yeargroup? If so, inspecting the username will allow you to find out how many folders you need to create.

 

You can then iterate through the list of folders within the level of My Documents and add the required folders.

Posted

You can have a look at the user and group sample scripts on the Technet Script Center. They all seem to involve taking a group and enumerating the members and doing reptitive matching till you find the right user. For a school of 2000 students this may not be ideal.

 

What you can do is try the NetworkGeezer's quick and dirty group determination algorithm.

 

Create a folder for each year and then put a text file in folder. Now set the NTFS permissions so that only a member of particular year group can access the textfile. OK maybe the folder creation step may not be necessary just provide a token file which only group can access.

 

All you have to do to find the group a student is in is to do an if file exists test until you can access one of the files. This will give you their year group.

 

IF EXIST ..\year7\Year7_token.txt Year_Group=YEAR7
IF EXIST ..\year8\Year8_token.txt Year_Group=YEAR8
....
....
IF EXIST ..\year11\Year11_token.txt Year_Group=YEAR11

 

This would mean in the worst case it would take 5 attempts (or 7 if you have a 2 year sixthform) to find the year group.

Posted

Can't you pass the year into the login script as a parameter:

 

Open up ADUC and find all your year 7 (say) users. I think you've said that you have an OU for each year, so that should be easy.

 

Select all the year 7 users > properties > profile tab

 

Set the login script to e.g. "loginscript.bat year7"

 

In the login script the parameter will be available as %1 so you can do some IF statements to get the desired result. If you pass in "7" instead of "year7" you could even use the greater than/less than comparisons in the IF statement.

 

NB I've never tried this 'cos we use KiXtart for login scripts and it has all this stuff built in. Go KiX!

Posted

I've cracked it nown a vb solution which is what I wanted. I use the parameter part of the AD policy to pass the year group.

 

 

When im back in tomorrow ill post my finished script.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...