mitchell1981 Posted July 11, 2007 Posted July 11, 2007 Hi All, This is the first time I've had to bulk create a set of user accounts and home folders. My problem is that the folders I have created (300 of them) all have the share permission set to 'Read' and I want it set to 'Full Control' as I use the NTFS permissions to handle the security. Does anyone have a batch file or similar that will enable me to change this permission for all the folders in one hit? Really don't want to do it manually! Thanks.
plexer Posted July 11, 2007 Posted July 11, 2007 net share username /delete net share username=d:\home\students\05\05ramys /grant:everyone,full Put all your usernames into excel i.e column a. Then in B put: ="net share " & a1 & " /delete" C: ="net share " & a1 & "=d:\home\students\05\" & a1 & " /grant:everyone,full" Copy that all the way down save the contents as 2 batch files and run them. First one delets the shares second one makes them correctly. Ben
craiglay Posted July 11, 2007 Posted July 11, 2007 If you have all these folders in a folder and the folder names are the same as the username you can do this: First delete the existing shares: Open the "Computer Management MMC" in administrator tools. Goto Shared Folders, then Shares. Select the folders you want to remove the share names for, right click, then stop sharing. Then recreate the shares with the right permissions I used this in a .CMD file that I placed in the same folder as the folders to be shared. FOR /D %%G IN (*.*) DO NET SHARE %%G$=%CD%\%%G /GRANT:Everyone,FULL /CACHE:None Basically, it loops through all the folders in the folder it is placed in, and shared them with everyone, full access and offline files disabled. The folder names must be the same as the username though. Craig **Disclaimer: This worked for me... Make sure you have a backup of your system... I cannot be responsible for breaking anything** 1
ajbritton Posted July 11, 2007 Posted July 11, 2007 There's no need to create a single share for every user. Just create one share and then let folder redirection take care of the rest. eg Create - D:\Users Set permissions on D:\Users as follows; - Administrators: Full Control (This folder, subfolders and files) - System: Full Control (This folder, subfolders and files) - Domain Users: Create Folder (This folder only) - CREATOR OWNER: Full Control (Subfolders only) Share D:\Users as Users Set Share permissions to Everyone: Full Control Set MyDocs folder redirection for users to \\server\Users\%username%\MyDocs If you still need a drive mapped to home directory, set path to \\server\Users\%username%\MyDocs If you want to do Application Data or Desktop redirection, then you can redirect to \\server\Users\%username%\AppData and \\server\Users\%username%\Desktop respectively
mitchell1981 Posted July 11, 2007 Author Posted July 11, 2007 Thanks to everyone who replied. I used Craiglay's solution in the end as it was the quickest and worked perfectly. I agree that actually sharing just one folder makes more sense, but this would have been more difficult to implement on our system as we have folder redirection set up to individual shares on all our exisiting users. Thanks again.
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