batch script to create a shared folder with permissions for everyone group

icecom4
icecom4 used Ask the Experts™
on
Hello,  I need a batch script to create a shared folder with permissions for the "everyone" group.  
I will be running this using psexec on several computers at once.  This way I dont have to kick the user.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mkdir D:\testshare
net share file=D:\testshare

Author

Commented:
hmmm that adds to the "everyone" group?
Yup, check it out.

It's the default and only group added to the Sharing permissions with that command.
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Author

Commented:
ok, thanks, but i notice that it names the shared path folder "file" and not "testshare"
Just substitute the example with whatever name you like:

Example

net share icecom4=D:\testshare

You can verify the results with:

net share

Author

Commented:
oops nevermind i just changed the "file" in batch
Steven CarnahanAssistant Vice President\Network Manager

Commented:
At a command prompt do a net share /?

Depending on OS version, you can set permissions as well.
Typo on my part. It was example I showed somebody else a while back.
@echo off
MD [directory]
CACLS [directory] /E /G everyone:[permission level (RWCF)]
NET SHARE [sharename]=[directory]
EXIT

use the CACLS /? for more info
use the NET SHARE /? for more info
You can set permissions but I have mastered that skill yet. =)
Steven CarnahanAssistant Vice President\Network Manager

Commented:
net share cshare=c:\shared /GRANT:Everyone,FULL

Doesn't work on XP and I don't think it works on 2000 but should work on everything after that.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial