vbs scripting to list and add NTFS permissions

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
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 10 years and 5 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
ging8990
Posts: 1
Last visit: Wed Oct 09, 2013 1:19 pm

vbs scripting to list and add NTFS permissions

Post by ging8990 »

I want to write a script to list the current NTFS permissions on the network share folders and then add new groups (multiple groups) to the network share folders.
But it didn't work, please help!!!


Set sh = CreateObject("WScript.Shell")

fldr = "\\servername\myshare"
group = "TA\admin"

rc = sh.Run("%COMSPEC% /c icacls """ & fldr & """ | find /i """ & group _
& """", 0, True)
If rc <> 0 Then sh.Run "icacls """ & fldr & """ /grant " & group & ":F"
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: vbs scripting to list and add NTFS permissions

Post by jvierra »

ICACLS cannot list share permissions.

net share users | findstr /i "permission"
This topic is 10 years and 5 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