Kaseya Community

Setting user permission on temp folder

  • Hello,

    I have been trying to setup a VB script using cacls to set this permission. All I have been getting is many command prompt windows opening up then a message stating Error assigning permissions to home folder. Here is my script that I have:

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

    strHomeFolder = "c:\temp"

    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 & " /g sgcmh\Administrator:F ", 2, True)
    If intRunError <> 0 Then
    Wscript.Echo "Error assigning permissions for user " _
    & strUser & " to home folder " & strHomeFolder
    End If
    End If


    On the flip side is anyone has a script already built and would love to share it I would most open to accepting it.

    Legacy Forum Name: Setting user permission on temp folder,
    Legacy Posted By Username: btgries
  • I don't have one that specifically resets permissions but I would imagine you could just execute a shell command and directly reference cacls.exe (eg: cacls foldername /t /e /c /g username:F) instead of trying to use vbscript to call cacls

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: neteffect
  • I'm not sure why, but I seemed to get away from some of the security problems and other issues by changing the agent temp directory to something other than c:\temp. I used c:\mycomapny\temp and don't seem to have any problems.

    There are some posts on some additional steps to take if you make the change.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: doug.jenkins@ispire.ca