jussy65 Posted August 12, 2008 Posted August 12, 2008 Hello, we have a set of user home folders that have been migrated from our old domain to our new domain and they have broken ACLs. I know how to use cacls commands but the %username% parameter needs to match the foldername. how do I parse the folder name and use it as the username to match the user to the folder? Pleae help. racking brains and brains failing!! Jussy65
cookie_monster Posted August 12, 2008 Posted August 12, 2008 (edited) Well you could script it (i have one at work i can provide) or you could use the free NTFSFix WiseSoft - NTFSFix. NTFS Permissions Utility. Edited August 12, 2008 by cookie_monster
maniac Posted August 13, 2008 Posted August 13, 2008 I found this VB script, but I havn't personally tested it, so use it with caution. It seems to do what you want, as long as the username is exactly the same as the folder name you're changing. You can change the CACLS command line to totally replace the ACL if your ACLs are totally broken, follow the help attached to the CACLS program to find out what switches you need to change. You will also need to add in the other users you want to have access e.g adminstrator to the end of the CACLS line if you do this. Running it in its current form edits the ACL and adds in the necessary permissions for the matching user only. Set objFSO = CreateObject("Scripting.FileSystemObject") strPath = "\\Server\HomefolerPath" '<--- Homefolder UNC path Set objFolder = objFSO.GetFolder(strPath) Set colSubfolders = objFolder.Subfolders For Each objSubfolder in colSubfolders strFolderName = objSubFolder.Name Set objShell = CreateObject("Wscript.Shell") strExec = objShell.Run("%COMSPEC% /c Echo Y| cacls " _ & strFolderName & " /E /T /P " & strFolderName & ":F ", 2, True) '<--- 1st "strFolderName" reflects the homefolder name. 2nd "strFolderName" reflects Username If strExec <> 0 Then MsgBox "Error with " & strFolderName & " and folder: " & strFolderName End If Next If running it on the server, which I would recommend you do, and not from a workstation across the network, change from using the UNC path to the local path insted. hope that's of help. Mike.
mac_shinobi Posted August 13, 2008 Posted August 13, 2008 Well you could script it (i have one at work i can provide) or you could use the free NTFSFix WiseSoft - NTFSFix. NTFS Permissions Utility. I was just about to suggest this and realised you had already - anyway just wanted to add a side note and mention that registration is free and then you can get to the downloads ( which are obviously free as well ) afaik ( at least they were last time I checked ) very handy utils on that site as well ( password changer, ntfs fixer ) and possibly some other ones.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now