Hello all. I need to migrate to a new sysytem and recreate some shares/premissions. I would like to script this process so that it is less error-prone. The OS is win7.
Here is my scenario. I have a user/system martix. Very simple - just one user per system. The names do not necessarily correspond to the numbering system (i.e user3 may have systemXYZ).
user1 / passworda / system1
user2 / passwordb / system2
user3 / passwordc / system3
I would like to:
1. script the creation of each user with correspondig password
2. create two folders per system like this:
folder\
. \[system-1]_share.ro
. \[system-1]_share.rw
. \[system-2]_share.ro
. \[system-2]_share.rw
3. share each folder
4. grant each corresponding user read-only / Full control to the applicable folder
5. Grant administrators group full control to each folder
6. add each user to a couple of common security groups
Creating the folder structure is not an issue but I don't have a great deal with scripting permissions / shares. So I am looking for advice and/or examples of how others have done this.
Advice on script for shares / permissions
Moderator: DosItHelp
Re: Advice on script for shares / permissions
I'm not sure if you intend creating new user accounts within Windows 7, or the shares.
sleepy...
Scripting the creation of a share with read permissions can be done like this (untested)
net share /? shows the options.
sleepy...
Scripting the creation of a share with read permissions can be done like this (untested)
Code: Select all
net share mysharenameA="c:\folder\in\some\location" /grant:username1,read
net share /? shows the options.
-
- Posts: 129
- Joined: 08 Feb 2016 20:25
Re: Advice on script for shares / permissions
I need to create: users, folders, then share the folders
I was also looking at the icacls command - seems like there is overlapping functionality with the NET command.
I was also looking at the icacls command - seems like there is overlapping functionality with the NET command.
Re: Advice on script for shares / permissions
There are file/folder permissions and there are share permissions.
-
- Posts: 129
- Joined: 08 Feb 2016 20:25
Re: Advice on script for shares / permissions
There are file/folder permissions and there are share permissions.
Thanks for the reminder . The last time I created a bunch of shares I has some access issues - verified/re-verified the share permissions with no luck. I finally had to grant file permissions on the folder for "everyone" to fix the problem.
Re: Advice on script for shares / permissions
mirrormirror wrote: I finally had to grant file permissions on the folder for "everyone" to fix the problem.
That's what I do here as it's the easy way out, but is only suitable in a home environment where security isn't something you need.
The secure way to to grant the users themselves permissions to the folder and files, and not use 'everyone'.
I see that the net command can create users and there is an example here: http://www.windows-commandline.com/add- ... mand-line/