Go here How to use Xcacls.vbs to modify NTFS permissions and download their VBS file.
I use this as part of new user creation, after I have another script to create the user folder.
I'm trying to piece together VBScript that will be run from the server on the client side at login. It will get the user name and create a folder with that name on the server. So far so good.
I'm having troubles actually sharing the folder with the user having permissions.
How can I 'Share' the folder and give the permissions that I want?
Any thoughts or where can I go to get this info, my googl-fu couldnt find it.
I have a small application I bought years ago which converts a list from a notepad file into folders which is handy. You probably could do this with a script. As for sharing and permissions, take a look at Scriptlogic's Autoshare.
xcacls.exe "\\Server\FolderRoot\%Username%" /E /T /C /R /G "%Username%":M /Y
Should work... untested was just off the top of my head...
I'm not a VBS guy but I suppose you could either call a .bat or do it completely in batch or get someone to help you convert it all into vbs.
jmair (21st May 2009)
You might want to take a look at my script here:
My Docs, Class Shared & Shortcut generator
... it does a lot of what you want to do plus a few other bits. If nothing else it would certainly provide a good example to help with your own script.
In terms of sharing I'd recommend creating a single shared folder manually for all users, set the Share perms to EVERYONE FULL and then tie down access using the NTFS security groups and perms. The script above, uses xcacls.vbs to handle the folder permissions for the end user so that's really the only hard bit.
FYI: I'm in the process of updating my script again, most likely sometime tomorrow, so expect a new release that should finish things off a bit more.
Thanks for the info guys, very helpful!
I'll post the solution we chose for this issue in case it may be usefull to somebody else in the future.
After playing for a while, I've chosen this to solve the issue. It's a quick batchfile that i'm running as a login script from an OU named after the graduation year of the students. The share needs to be read/write/execute in order for the folder to be created (although the dont have access to the root of the shared folder I'll be running the below batch file afterhours.Code:@ECHO on %comspec% nul /cmd \\servername\sharedfolder\%USERNAME% xcacls \\servername\sharedfolder\%USERNAME% /t /g "domainname\%USERNAME%":f /y NET USE u: \\servername\sharedfolder\%USERNAME% /PERSISTENT:No
Resides inside the shared folder. This batch removes all security permissions from each folder inside the share. It the adds admin full permissions and username permission to full, and gives teachers read and write access.
Code:for /D %%I in (*) DO XCACLS "%%I" /T /G BUILTIN\ADMINISTRATORS:F "NT AUTHORITY\SYSTEM":F "parkco\%%I":F "domainname\teachers":RW "%%I":C pause
There are currently 1 users browsing this thread. (0 members and 1 guests)