Computing.Net > Forums > Windows Server 2003 > vbs cacls logon script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vbs cacls logon script

Reply to Message Icon

Name: zperkins
Date: April 10, 2007 at 10:45:33 Pacific
OS: 2003
CPU/Ram: 1g
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: cturner
Date: April 14, 2007 at 13:53:01 Pacific
Reply:

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.


0
Reply to Message Icon

Related Posts

See More


Backup strategy for MS en... exchange 03



Post Locked

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


Go to Windows Server 2003 Forum Home


Sponsored links

Ads by Google


Results for: vbs cacls logon script

Logon Script troubles www.computing.net/answers/windows-2003/logon-script-troubles/1367.html

logon script-help plz www.computing.net/answers/windows-2003/logon-scripthelp-plz/3294.html

Logon Scripts won't run every time www.computing.net/answers/windows-2003/logon-scripts-wont-run-every-time/4231.html