/build/static/layout/Breadcrumb_cap_w.png

Vbscript with Cacls

I am trying to create a custom action which will allow modify rights to regular users. I have the command line that i would like to use for this but would like to create a VB custom action. Can someone tell me how to modify the script & use that script in my custom action. Thanks in advance guys.

C:\WINDOWS\System32\cacls.exe "C:\Program Files\XYZ Client" /T /E /G BUILTIN\USERS:C

0 Comments   [ + ] Show comments

Answers (4)

Posted by: anonymous_9363 13 years ago
Red Belt
0
Firstly, why bother wrapping it in script? I know why *I* would (I have a class which uses the ADsSecurity object)

Secondly, CACLS is just another program. On the web, there must be millions of examples of scripts to run programs.
Posted by: itolutions 13 years ago
Purple Belt
0

Option Explicit
Dim strHomeFolder, strHome, strUser
Dim intRunError, objShell, objFSO

strHomeFolder = "\\grand\home\user"

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /t /c /g Administrators:F ", 2, True)
If intRunError <> 0 Then
'Wscript.Echo "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If


Just replace group name.
Posted by: chichora123 13 years ago
Fourth Degree Green Belt
0
Option Explicit
Dim strHomeFolder, strHome, strUser
Dim intRunError, objShell, objFSO

strHomeFolder = "C:\Program Files\XYZ"

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /t /c /g Users:F ", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strUser & " to home folder " & strHomeFolder
End If
End If


I get "Error assigning permissions for user to home folder"
Posted by: itolutions 13 years ago
Purple Belt
0
Checked your script. Works for me.

if you are using Windows 7 try "Run as administrator" mode (Elevated mode).
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ