PLEASE HELP ---> My folder permissions vbs is not working

case2k8's Avatar, Join Date: Aug 2008
Newbie Member
Here is the script that needs an expert to look at:

Note: The only thing working on this script is a successful installation of TOAD. The permissions section and the copy file section is not working. Can you help?

Code:
On Error Resume NExt
Dim objShell, objNewPort, objWMIService, oFSO, Path, strComputerA 
Dim RunErrorToReturn, Results 
Dim strComputer : strComputer = "." 
Dim objNetwork : Set objNetwork = CreateObject("WScript.Network") 
strComputerA = objNetwork.ComputerName

Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set objShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
ProgramFiles = objShell.ExpandEnvironmentStrings("%ProgramFiles%")
windir= objShell.ExpandEnvironmentStrings("%windir%")
temp = objShell.ExpandEnvironmentStrings("%temp%")
allusers=objShell.ExpandEnvironmentStrings("%AllUsersProfile%")

path= oFSO.GetParentFolderName(WScript.ScriptFullName)

objShell.Run path+"\Toad_Standalone\9_6_1_1\ToadforOracle961SetupFull.msi /qb ALLUSERS=1 ADDLOCAL=Server,Client",1,TRUE

objShell.Run """" & path & "\Setacl.exe"" -on """ & ProgramFiles & "\Quests~1"" -ot file -actn ace -ace ""n:S-1-5-11;p:full;s:y"" -actn clear -clr ""dacl,sacl"" -actn rstchldrn -rst ""dacl,sacl"" -silent",1,TRUE 

Set fso=CreateObject("Scripting.FileSystemObject")
fso.CopyFile "\\server\esl$\Oracle\Toad\9.6.1\Client\QSAuth11.key", "C:\Program Files\Quest Software\Toad for Oracle\", 0, TRUE


'If there was an error return it otherwise return 0 with a success; 
If Err.Number<>0 Then 
RunErrorToReturn = Err.Number 
Results = src1(1) & vbstatus & ", exiting." 
SMSWriteStatusMIF "if then", "TOAD961", "1", Results, src2(1) 
wscript.quit(RunErrorToReturn) 
Else 
RunErrorToReturn = 0

Last edited by shabbir; 6Aug2008 at 09:23.. Reason: Code block
0
case2k8's Avatar, Join Date: Aug 2008
Newbie Member
I got it to work with Setacl.exe. This exe has to be in the same directory as the vbs.

Also, I needed to put an "o" in front of the fso for the copy command to work.

Thanks!!
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Why arent you using the cacls command?