Jump to content

Recommended Posts

Posted

Is a script around to list network share permissions ?

This script can add permissions to a folder but not add permissions to the sub folder: Anyone know how to teak it to set permissions to the folder and sub folders and files.

 

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 & " /e /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

 

WScript.Quit

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...