Coding Thread, setACL help please quick aggh :p in Coding and Web Development; Had a fairly stupid accident and i need some urgent help...
This folder "H:\Home10" is home to 239 student folders, ...
4th October 2011, 03:19 PM #1
setACL help please quick aggh :p
Had a fairly stupid accident and i need some urgent help...
This folder "H:\Home\2010" is home to 239 student folders, the permissions have become fubared on all 239 folders...
I need to run a script against these to set specific permissions, the quickest method of setting these permissions would probably be to apply the student permissions using the folder name....so first off i need to know how i can tell a script to use the folder name as a username to add to the permissions list
Secondly i need to add domain admins and it teachers - this bit i can do
Does anyone know how to use the folder name? Hard to explain but i know it's possible!
IDG Tech News
4th October 2011, 03:29 PM #2
Having done this in the past I wrote a script that will enumerate all users in an OU and reset the permissions on their home directory (from AD) to full control for their username(from ad). Will take a little modifying to set the additional permissions you require.
'Initialize global variables
Set objShell = CreateObject("Wscript.Shell")
Set Container = Nothing
'Say Finished when your done
'List all Users
'Go through all Users and select them
For Each User In Cont
Select Case LCase(User.Class)
'If you find Users
ExecCommand= "cacls " & "" & chr(34) & User.homeDirectory & chr(34) &"" & " /t /e /c /g " & "" & User.userPrincipalName & "" & ":F"
Wscript.Echo "Outputting for user: " & User.name
set oCommand = objShell.Exec(ExecCommand)
WScript.Echo "***** END USER********"
Case "organizationalunit" , "container"
Thanks to saundersmatt from:
mrbios (4th October 2011)
4th October 2011, 03:30 PM #3
dir /b > textfile.txt
Copy and paste into excel,
Use the 'CONCATENATE' function to built the correct command in another column.
Copy and paste the new column into notepad and save as a bat file.
Thanks to K.C.Leblanc from:
mrbios (4th October 2011)
5th October 2011, 08:42 AM #4
5th October 2011, 08:44 AM #5
I have another query....what's the command to remove inherited permissions from a folder and just leave the non-inherited ones?
I can see the command to do the reverse but not that
5th October 2011, 08:55 AM #6
I'd use icacls /inheritance:r
By tickmike in forum Wireless Networks
Last Post: 17th September 2006, 03:44 PM
By tickmike in forum How do you do....it?
Last Post: 4th September 2006, 03:34 PM
By pooley in forum Windows
Last Post: 4th July 2006, 05:39 PM
By suesmate in forum Educational Software
Last Post: 3rd May 2006, 06:07 PM
By MuppetQueen in forum Budgets and Expenditure
Last Post: 12th December 2005, 03:10 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)