Solved

Using cacls with VBS to set folder permissions

Posted on 2009-05-08
5
1,169 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
ID: 24339267
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
ID: 24339415
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
ID: 24339580
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
ID: 24340099
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
ID: 24340618
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

17 Experts available now in Live!

Get 1:1 Help Now