/build/static/layout/Breadcrumb_cap_w.png

Using cacls

Hi ,
I've an app which needs to create three folders say name,root and system on C:\ drive and needsto give modify permissions to the user ofr these 3 folders can u help me how to write a script using cacls. I'm new to scriptting.I tried to write a script but its not executing.
Thanks,
Usha

0 Comments   [ + ] Show comments

Answers (2)

Posted by: itolutions 13 years ago
Purple Belt
0
Try this


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

MY_FOLDER1 = "c:\system"

if Not objFSO.FolderExists(MY_FOLDER1) Then
MakeDir(MY_FOLDER1)
End if

GrantPermissionToDirectory MY_FOLDER1

Function MakeDir (strPath)
Dim strParentPath, objFSO

strParentPath = objFSO.GetParentFolderName(strPath)

If Not objFSO.FolderExists(strParentPath) Then
MakeDir strParentPath
End if
If Not objFSO.FolderExists(strPath) Then
objFSO.CreateFolder strPath
End if
MakeDir = objFSO.FolderExists(strPath)
End Function

Function GrantPermissionToDirectory(directory)
Dim Result,strCommand,objShell
strCommand = "icacls " & Chr(34) & directory & Chr(34)& " /grant *S-1-5-32-544:(OI)(CI)F /grant *S-1-5-32-545:(OI)(CI)F"
Result = objShell.Run(strCommand, 0, True)
If (Result <> 0) Then
clsLogfile.WriteLine strLogfile, 8, "ERROR: Can't grant permissions to '" & directory & "' directory - Errorcode: " & Result
Quit(Result)
End If
End Function
Posted by: itolutions 13 years ago
Purple Belt
0
be carefull i am using icacls
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