Haneef Puttur

Script to edit folder permission

Dim strHomeFolder, strHome, strUser
 Dim intRunError, objShell, objFSO
 
 strHomeFolder = “C:\test”
 
 Set objShell = CreateObject(“Wscript.Shell”)
 Set objFSO = CreateObject(“Scripting.FileSystemObject”)
 If objFSO.FolderExists(strHomeFolder) Then
  intRunError = objShell.Run(“%COMSPEC% /c Echo Y| cacls ” _
  & strHomeFolder & ” /e /c /g everyone:F “, 2, True)
  
  If intRunError <> 0 Then
   Wscript.Echo “Error assigning permissions for user ” _
   & strUser & ” to home folder ” & strHomeFolder
  End If
 End If

.

Exit mobile version