Re: Scheduled script problem



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/

.



Relevant Pages

  • Re: Scheduled script problem
    ... I think I had already tried the Run command, ... at least when running the script from the command line. ... So I assume that a separate shell that is being launched to run the strPath ... Dim nRes ...
    (microsoft.public.windows.server.scripting)
  • How to emulate this set or how to assign the result of running system "command" to a variable
    ... I currently have a MS-DOS batch file that am trying to convert to a Perl script. ... I have something like this in the .BAT file where variables are "set" based on ... rem creates a ftp command file on the root directory of the drive. ...
    (perl.beginners)
  • Re: Scheduled script problem
    ... May i know the return of strPath? ... A vbs script that sets up a command to run a batch file, ... until the scheduler stops the script after the maximum allowed time to run. ...
    (microsoft.public.windows.server.scripting)
  • Re: Regedit silent import
    ... Can anybody help me include the "regedit /s" command in a script? ... works fine in a BAT file but I cannot find how to get it to function as ...
    (microsoft.public.scripting.vbscript)
  • Re: Logon script
    ... The script is a simply bat file. ... The copy command is the last command. ... a bunch of network drives for the users. ...
    (microsoft.public.windows.group_policy)