Re: Scheduled script problem
- From: "Kai.Bluesky" <kai.bluesky@xxxxxxxxx>
- Date: Fri, 16 Nov 2007 18:22:25 -0800 (PST)
Dear,
You can try psexec to run the bat file.
psexec \\{IP} strPath
ps. It can execute the bat remotely, you can run the script on your
desk.
But this tool need to download.
http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx
Hope it may help.
Best Regards,
Kai
On Nov 17, 5:15 am, dk <d...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Thank you Tom.
I don't have admin rights on the server, so I did not set up the scheduled
operation. Nor can I look at it. So I don't know (yet) if the script can
run interactive.
I think I had already tried the Run command, but now I'm getting different
result, at least when running the script from the command line.
With the Run command, I now get the error:
No application is associated with the specified file for this operation.
So I assume that a separate shell that is being launched to run the strPath
doesn't know about the standard file extensions and how to run them.
"Tom Lavedas" wrote:
On Nov 16, 9:45 am, Tom Lavedas <tglba...@xxxxxxx> wrote:
On Nov 15, 11:15 pm, "dk" <kaa...@xxxxxxxxxxx> wrote:
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")
Did you specify that the script is to run Interactive? The Exec
command needs a command console, which is not possible if the
operation does not run interactive. In addition, as I understand it,
unless a user is logged in to the workstation such interactive
operations still will fail.
The correct approach, I think, is to replace the Exec with a Run with
it's operation 'hidden', something like this ...
oShell.Run strPath, 0, true
If you want to catch the return code for your log function, try
this ...
Dim nRes
nRes = oShell.Run strPath, 0, true
logFile.WriteLine "Exiting script with exit code: " & nRes
Tom Lavedas
===========http://members.cox.net/tglbatch/wsh/
Opps, there's an error in that nest to the last line of code. It
should read ...
nRes = oShell.Run(strPath, 0, true)
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
.
- References:
- Scheduled script problem
- From: dk
- Re: Scheduled script problem
- From: Tom Lavedas
- Re: Scheduled script problem
- From: Tom Lavedas
- Re: Scheduled script problem
- From: dk
- Scheduled script problem
- Prev by Date: Re: Force password Expiration to 5 days
- Next by Date: Script to parse programatically through files in a folder
- Previous by thread: Re: Scheduled script problem
- Next by thread: Re: Scheduled script problem
- Index(es):
Relevant Pages
|