Scheduled script problem
- From: "dk" <kaatzd@xxxxxxxxxxx>
- Date: Thu, 15 Nov 2007 20:15:37 -0800
Here is the problem:
A vbs script that sets up a command to run a batch file, calls EXEC on the
command. When run from a scheduled task, it hangs on the EXEC command,
until the scheduler stops the script after the maximum allowed time to run.
If the EXEC command is commented out, the script does some other work and
completes.
The scheduled task is set to run with user permissions set explicitly for
this type of task. When the same user logs in directly and executes the
script from the command line, the batch file and vbs script completes
without problem. User has rights to run and read write in the directory
where the script resides. The user has rights to run the batch file in the
directory where the batch file resides. The user has rights to create files
at root of C: where a process the batch file kicks off wants to write.
Again, works successfully when run from the command line: cscript (or
wscript) EXAMPLENAME.VBS
Any ideas what could be wrong?
Example of what the script is doing:
Dim oShell
dim logFile
set outerFSO = CreateObject("Scripting.FileSystemObject")
set logFile = outerFSO.OpenTextFile("c:\tmp\runreport.log", 2, true)
logFile.WriteLine("Log file created")
Set oShell = CreateObject("WScript.Shell")
strPath = Chr(34) & "C:\Program Files\product name\reports\runreport.bat" &
Chr(34) & " " & Chr(34) & CreateYesterdayName & Chr(34) & " >
c:\tmp\temp.txt"
logFile.WriteLine(strPath)
oShell.exec strPath
logFile.WriteLine("Exiting script")
CreateYesterdayName is a function that creates the desired file name.
Thank you,
D.
.
- Follow-Ups:
- Re: Scheduled script problem
- From: Tom Lavedas
- Re: Scheduled script problem
- From: Kai.Bluesky
- Re: Scheduled script problem
- Prev by Date: Re: WSUS Aproved Updates - [WP]
- Next by Date: Re: Script that shows prmary DNS
- Previous by thread: Re: Script that shows prmary DNS
- Next by thread: Re: Scheduled script problem
- Index(es):
Relevant Pages
|
Loading