Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Having trouble writing a logon script that will set permissions for the USER on certain directories. Seems to work, it just wont stop!
Here is what I have.
' cacls.vbs
' Use cacls to set permission levels for users
' Version 1.0 April 2007
-'
Dim objShell,permFolder,permLevel
Set objShell = CreateObject("Wscript.Shell")
'Cacls permission level R=read W=write C=change F=full
permLevel = "W"
permGroup = "Users"
'just add directories to the array permFolder using the format below
'
'permFolder = Array(_
' "c:\testdata\tests",_
' "c:\testdata\tests1"_
' )
'
permFolder = Array(_
"c:\testdata\tests",_
"c:\testdata\tests2",_
"c:\testdata\tests1"_
)
'Fire off cacls commands grant permissions
WScript.Echo UBound(permFolder)
For i = 0 To UBound(permFolder)
objShell.Run("%COMSPEC% /c Echo Y| cacls " & permFolder(i) & " /e /t /c /g " & permGroup & ":"& permLevel)
WScript.Echo permFolder(i)
Next

That looks right, but if it is getting stuck in the loop, you might try using something like
For Each strFolder in permFolder
instead of the for statment you have now.
You would also need to replace permFolder(i) with strFolder.
I don't know if this would be helpful or not, but I've posted the script that I use to create and assign rights to users home drives here
http://www.levelland.isd.tenet.edu/...
I just run the script from my machine every once and a while, and it will create and assign rights to a folder for every user in Active Directory.

![]() |
Backup strategy for MS en...
|
exchange 03
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |