I am trying to set permissions using VBScript and xcacls.exe on a folder in Program Files. For whatever reason it will not work. Does anyone have an idea what I am doing wrong?

Set objShell = CreateObject("Wscript.Shell")
objShell.Run("xcacls.exe C:\Program Files\SMfitACT-Calibration-R3.1\* /T /G Everyone:F"),1,True

Thanks,
Phil
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
just a guess, but you may want to place chr(34) ASCII double quote around your path, and omit the trailing backslash and wildcard...
Answered 02/21/2005 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Aogilmor is right, but your brackets are also in the wrong place (in fact your don't need them at all unless you want the return code).

It should look something like this (although I haven't tested it):

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "xcacls.exe " & Chr(34) & "C:\Program Files\SMfitACT-Calibration-R3.1\*" & Chr(34) & " /T /G Everyone:F", 1, True

Otherwise, you could use the "shortpath" (8.3 format).

By the way, why are you using "xcacls.exe" to do something that the standard windows command "cacls.exe" could do?
Answered 02/22/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
Here's the "Cacls.exe" version:

Set objShell = CreateObject("Wscript.Shell")
iRetVal = objShell.Run("%SystemRoot%\System32\Cacls.exe " & Chr(34) & "C:\Program Files\SMfitACT-Calibration-R3.1" & _
Chr(34) & " /E /T /G Everyone:C", 0, True)
Set objShell = Nothing
Msgbox iRetVal

I've added "/E" to edit the ACL instead of overwriting it. I also changed the permissions to "C" because it's usually enough - best practice is to give the most restrictive permissions that are required.

I changed the "WindowStyle" value to 0 in order to make the horrible black box invisible.

I included the full path to "cacls.exe" to ensure that the correct copy is used, and in case the machine "path" environment variable has been corrupted.

I've captured the return value too so we can be sure that the command ran.
Answered 02/22/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
hi ....

.... i used "Execute Program From Destination" to run Xcacls ... and it works fine :) .... no need to make a "script" :)



Tab "Execute Immediate" -> "Execute Program From Destination"

.... commandline : cmd /c xcacls ....................
(i included xcacls in the package - so i knew the location, and that the file would be there)


... it took me a while to find out how the commnadline should be .... :)

Gizmo - Denmark :)
Answered 03/07/2005 by: gizmo
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity