Hi all,
I'll jump straight to the point.....I'm trying to create a vb script which sets permissions on a folder and everything beneath it in the tree.
I need to give two groups of users modify control, these are 'Global Staff' and 'Global Students'.
I have a script which changes permissions on the folder, but I'm not sure how to tell it to apply to everything below it in the tree.
Here is the script:
===========================================
Option Explicit
Dim FolderToChange, FolderToChangePath
FolderToChange = ("""C:\solidworks data\browser""")
FolderToChangePath = ("C:\solidworks data\browser")
'WScript.Echo FolderToChange
Call ChangePerm(FolderToChange)
Function ChangePerm(FolderToChange)
'WScript.Echo ("function1")
Dim objfso, WshShell, Result, Command, objShell, Command2
Result=False
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objfso.FolderExists(FolderToChangePath) Then
'WScript.Echo ("inside if")
Set objShell = CreateObject("Wscript.Shell")
Command = ("%COMSPEC% /c Echo Y| cacls " & FolderToChange & " /e /g /a /d y /r ""Global Staff"":c")
objShell.Run (Command)
Command2 = ("%COMSPEC% /c Echo Y| cacls " & FolderToChange & " /e /g ""Global Students"":c")
objShell.Run (Command2)
Result = True
End If
ChangePerm = Result
End Function
============================================
Thanks in advance!
James
I'll jump straight to the point.....I'm trying to create a vb script which sets permissions on a folder and everything beneath it in the tree.
I need to give two groups of users modify control, these are 'Global Staff' and 'Global Students'.
I have a script which changes permissions on the folder, but I'm not sure how to tell it to apply to everything below it in the tree.
Here is the script:
===========================================
Option Explicit
Dim FolderToChange, FolderToChangePath
FolderToChange = ("""C:\solidworks data\browser""")
FolderToChangePath = ("C:\solidworks data\browser")
'WScript.Echo FolderToChange
Call ChangePerm(FolderToChange)
Function ChangePerm(FolderToChange)
'WScript.Echo ("function1")
Dim objfso, WshShell, Result, Command, objShell, Command2
Result=False
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objfso.FolderExists(FolderToChangePath) Then
'WScript.Echo ("inside if")
Set objShell = CreateObject("Wscript.Shell")
Command = ("%COMSPEC% /c Echo Y| cacls " & FolderToChange & " /e /g /a /d y /r ""Global Staff"":c")
objShell.Run (Command)
Command2 = ("%COMSPEC% /c Echo Y| cacls " & FolderToChange & " /e /g ""Global Students"":c")
objShell.Run (Command2)
Result = True
End If
ChangePerm = Result
End Function
============================================
Thanks in advance!
James