Creating permissions on a new share

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
bneconie
Posts: 8
Last visit: Fri Dec 21, 2007 2:16 am

Creating permissions on a new share

Post by bneconie »

I'm a total newbee at scripting so please be patient, if I sound like I'm slow to catch on its because scripting isn't my specialty, I've got quite a learning curve ahead.I'm attempting to create/delete a Share remotely. Here is a copy of my two scripts up to this point and I'm taking advantage of PsExec.exe for the second. I'm also trying to run these scripts from, and on, either a XP/NT/Server 2k/Server 2k3 domain network - my environment is a mesh of OS'.The first script is the delete script:------------------------------------------set targetpc=computer1set targetshare=sharedfilesREM Deletes the share.psexec "%targetpc%" net share "%targetshare%" /DELETE-------------------------------------------This works perfect.The second script is to re-establish the Share with the proper Share permission and NTFS permissions:------------------------------------------REM Sets NTFS permissions on the share To Full Control For Administrators and Change (Modify) For Users.psexec "%targetpc%" cmd /c echo y^|cacls "%targetdir%" /C /G administrators:Fpsexec "%targetpc%" cmd /c echo y^|cacls "%targetdir%" /E /C /G smsusers:Fpsexec "%targetpc%" cmd /c echo y^|cacls "%targetdir%" /E /C /G users:C------------------------------------------The problem exists with this second script. It creates the proper NTFS permissions (local group called SMSUSERS). However, it only creates Share permissions for Everyone with Read Only access. I'd like for the script to create Everyone with Read and Change access.Can this be done, if so how? Or, am I totally way off the mark? In other words, there is just NO way to do what I'm trying to do?Thanks very much.bird.
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Creating permissions on a new share

Post by jhicks »

Calcs can only set NTFS permissions. Take a look at SUBINACL to set the share permissions. You can download the tool from Microsoft.
User avatar
bneconie
Posts: 8
Last visit: Fri Dec 21, 2007 2:16 am

Creating permissions on a new share

Post by bneconie »

ok. Figured things out. I've done away with subinacl, and used rmtshare as a working substitute.thx.donald.
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Creating permissions on a new share

Post by jhicks »

I've used Rmtshare in the past and for working only with shares is certainly the better way to go. Subinacl can get pretty convoluted. Where did you find rmtshare? I don't think it is part of support tools or the resource kit.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked