Vbscript with Cacls
Add your rating:
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)
Please log in to answer
Posted by:
anonymous_9363
13 years ago
Posted by:
itolutions
13 years ago
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
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.