Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-23-2008, 09:52 PM
fbords fbords is offline
Junior Member
 
Join Date: Jul 2008
Posts: 1
fbords is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default Setting folder permissions

Hi all.

I customized a script that's been floating around on the web for some time to set permissions on a shared folder. the script appears to run and set the permissions properly, however the "IF" statement to display the error keeps displaying everytime it's run. Basically, I want to strip off all of the users permissions except for SYSTEM and CREATOR OWNER and add the User itself.

Code:
Option Explicit Dim HomeDirectory, intRunError, objShell, objFSO, LogonName LogonName = "User" HomeDirectory = "\\SERVERNAME\users\" & LogonName Set objShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(HomeDirectory) Then ' Assign user permission to home folder. intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls "_ & HomeDirectory & " /T /C /G "_ & LogonName & ":F /E /R Administrators ITAdmins", 2, True) If intRunError <> 0 Then Wscript.Echo "Error assigning permissions for user " _ & LogonName & " to home folder " & HomeDirectory Else Wscript.Echo "Permissions assigned successfully for " _ & LogonName & " to home folder " & HomeDirectory End If End If WScript.Quit
The lines :
Code:
If intRunError <> 0 Then Wscript.Echo "Error assigning permissions for user " _ & LogonName & " to home folder " & HomeDirectory
is what isn't making sense. I tried adding a line to echo Err.Number and Err.Description and I get an error number of 0 and no description. By the way, LogonName and HomeDirectory are defined the way they are for testing puproses only. This will be added to an existing script which already defines them.

Please help.
Reply With Quote

This ad is part of our Revenue Sharing program
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBscript to check folder & send email if file exists along with path mahesha_babu ASP & VBScript Forum 0 06-30-2008 12:39 PM
VB Script for folder listing. Need help with filter libertyguy ASP & VBScript Forum 0 06-03-2008 07:23 PM
Scrolling files from folder! deal HTML Forum 0 04-21-2008 03:54 PM


All times are GMT. The time now is 02:17 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30