[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

Need a script to create folders and permissions

Our Geography and Regional Planning department has several classes and sections. Previously, all of the students would have a general folder mapped for them via a GPO, and the professors would assign files, etc. The problem is that the students aren't following the procedures, and placing files everywhere, causing issues for both the professors and myself (finding lost files, etc).

So, I've created a new directory tree, and each student will have his/her own folder, with no access to any other folder other than the specific class folder.

Tree: Main shared folder -> General Student Folder -> Class Specific students folder -> Specific student folder

The idea script would take a student's name from a spreadsheet, create the folder, give the student specific modify rights, domain admins full control, professors read only rights.

I have seen other questions and answers for various scripts, but I'm not a programmer, and I don't know how to modify scripts to do what I want.

Thanks in advance.
0
wheelgunr
Asked:
wheelgunr
  • 4
2 Solutions
 
Seaton007Commented:
Take a look at this: http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/e31b7f03-7bc7-4a40-826e-55ab05bb5429/

Also, here are several scripts for managing files and folders, but you may need to combine/rewrite a couple of them to get the exact result you are looking for: http://www.activexperts.com/network-monitor/windowsmanagement/adminscripts/filesfolders
0
 
wheelgunrAuthor Commented:
Thanks for the links. I'll test them out before awarding and closing.
0
 
wheelgunrAuthor Commented:
OK, I've run the script, and it does create the folders as needed. However, it doesn't create the security permission for the student. I need to have it create modify rights for that specifric student and his/her folder. Any ideas?
0
 
wheelgunrAuthor Commented:
OK, I've modified a referred script that creates a user's folder based on their user ID and then gives them Modify rights:

Const ForReading = 1

strComputer = "SERVERNAME"
Set objWMIService = GetObject ("winmgmts:\\" & strComputer _
    & "\root\cimv2:Win32_Process")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set inputFile = objFSO.OpenTextFile("C:\Scripts\bio0204.txt", ForReading)

Do Until inputFile.AtEndOfStream
    strFolders = inputFile.ReadAll
Loop

arrFolders = Split(strFolders, vbCrLf)

For i = 0 To UBound(arrFolders)
  createFolder = objWMIService.Create ("cmd.exe /c md c:\folder tree\" & arrFolders(i) & "", _
      Null, Null, intProcessID)
  assignACL = objWMIService.Create ("cmd.exe /c icacls.exe c:\folder tree\" & arrFolders(i) _
      & "" & " /Grant " & arrFolders(i) & ":(OI)(CI)M", Null, Null, intProcessID)
Next

To restrict access to specific classes,  I created a local group for each class at the root folder.

What I need is a line of code that will remove that created local user group from the folders that will be created.

Can anyone give me an idea as to that line of code?
0
 
wheelgunrAuthor Commented:
Still have an issue with removing a group that is inherited, but i'LL ask that in another queston
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now