Solved

Using cacls with VBS to set folder permissions

Posted on 2009-05-08
5
1,165 Views
Last Modified: 2013-11-25
Hi,

I'm trying to incorporate setting folder permissions on a newly created folder into a .vbs file but having problems with the syntax as the domain groups I'm trying to add both have spaces in the names and use some non alpha numeric characters.

I can get the below script to work with certain groups but when trying to add the group below (with an * in the name) it doesnt set the permissions and I want to add multiple groups with Domain\authenticated users being another one.  

set Objtest=CreateObject("WScript.Shell")
Objtest.run "cacls \\Server\projects\fusion\public /E /G Domain\*Fusion_TL:M", 7, True

Can someone tell me where I'm going wrong and also explain the correct format for adding or changing the permissions for multiple groups.

Thanks.
0
Comment
Question by:barryhiggins3
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:rejoinder
Comment Utility
As far as I know, you cannot have a wildard in the group/user area, only the folder/file area.
http://support.microsoft.com/default.aspx/kb/162786
"You can specify more than one file, user, or group in a command. Wildcard characters in file and directory names are supported."
I think the above quote means you can name multiple people (using the full names etc) while the folder or files can use the wildcard.
0
 
LVL 4

Author Comment

by:barryhiggins3
Comment Utility
Thanks,

I dont actually want to use a wild card, I'm specifying the exact  the group names they contain the asterix * character.
0
 
LVL 14

Expert Comment

by:rejoinder
Comment Utility
As a test can you try this...
Objtest.run "cacls \\Server\projects\fusion\public /E /G ""Domain\*Fusion_TL"":M", 7, True
This way the domain and group name are enclosed in quotes and might be looked at as text rather than a wildcard.
0
 
LVL 4

Author Comment

by:barryhiggins3
Comment Utility
I ran the test. No luck I'm afraid, it didnt apply the permissions.
0
 
LVL 4

Accepted Solution

by:
barryhiggins3 earned 0 total points
Comment Utility
I've managed to figure it out.

The If I use the pre windows 2000 logon name instead for the group that works.

The following applies the permissions for multiple groups including the one causing the problem.

Objtest.run "cacls \\Server\projects\fusion\public /E /G ""NT AUTHORITY\Authenticated Users"":R ""Domain\_Fusion_TL"":M", 7, True
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now