Avatar of icecom4
icecom4
Flag for United States of America asked on

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

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.
Windows Batch

Avatar of undefined
Last Comment
Steven Carnahan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
motnahp00

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
icecom4

ASKER
hmmm that adds to the "everyone" group?
motnahp00

Yup, check it out.

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

ASKER
ok, thanks, but i notice that it names the shared path folder "file" and not "testshare"
Your help has saved me hundreds of hours of internet surfing.
fblack61
motnahp00

Just substitute the example with whatever name you like:

Example

net share icecom4=D:\testshare

You can verify the results with:

net share
icecom4

ASKER
oops nevermind i just changed the "file" in batch
Steven Carnahan

At a command prompt do a net share /?

Depending on OS version, you can set permissions as well.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
motnahp00

Typo on my part. It was example I showed somebody else a while back.
Francois_IT

@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
motnahp00

You can set permissions but I have mastered that skill yet. =)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Steven Carnahan

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.