Create network shares via command line with specific permissions

The command you're looking for is net share. The /? help on the command is pretty straightforward, but here is an example:

net share MyShareName="C:\My Local Path\SomeFolder" /GRANT:Everyone,FULL

As far as security goes, from what I've read, the best-practice is to do as above, grant the Everyone group full control on the share, and then manage the permissions on the files and folders themselves. This is because the share permissions are a restriction filter over top of the actual file and folder permissions.


This should be the information that you are looking for:

::Create a drive letter map to an existing network share
net use z: \\servername\share password /USER:domain\username /PERSISTENT:YES

:: grant user 'jsmith' full control access to the jsmith directory
cacls z:\jsmith /T /E /G jsmith:f

You can also remove permissions, or edit permissions on the directory using cacls.exe. My recommendation would be to read up on cacls.exe

Cacls

http://technet.microsoft.com/en-us/library/bb490872.aspx

or just "cacls /?" from the command line should work as well.