VB Script not working from Task Scheduler RRS feed

  • Question

  • Good morning,

    I have a VB script file that I'd like to run every hour.  This script works correctly when called manually.  This script was also working for several months from the task scheduler under a different user account.  The person who setup the system is no longer with us, so his account does not exist anymore.  I deleted the task and recreated a new task, calling the same script, with a new admin user account.  I also put the script into a new folder and set the permissions to both to Everyone.

    The task runs fine and says completed without issue, but the script isn't actually being executed.  I've read for a couple days, and tried all posted answers in relation to this issue, including testing other scripts, other admin user accounts, permissions settings, etc. but VB scripts won't execute from the task scheduler for some reason.

    This particular script pulls weather information from a website and logs values to a database.

    - VB script location: C:\Scripts\weather.vbs (folder/file permissions set to Full Control for Everyone)

    - task settings: New folder under Task Scheduler Library called Scripts; New Task created; Security Options set using local admin account, Run whether user is logged on or not, Run with highest privileges;  Triggers daily, repeat every hour; Action Start a program C:\Windows\System32\wscript.exe, Add arguments  C:\Scripts\weather.vbs //b

    It runs and says operation completed successfully without actually running the script.  If I go and double click script in the folder, it runs fine and updates the weather values.

    After reading for few days and trying everything I can think of, I've come to the conclusion that I can't solve this or find the answer.  I believe I've read every other post here regarding VB scripts and the Task Scheduler.

    Any help would be appreciated.


    Monday, December 3, 2012 6:18 PM


  • Without seeing your script and the command line you use for the scheduled task, it is impossible to tell you what's wrong. The usual way to resolve such problems is to start very simply, then build things up until you know what's wrong. Here is what I would do:

    1. Create the batch file c:\Scripts\Test1.bat with these lines:
      @echo off
      echo %date% %time% >> c:\Scripts\Script.txt
    2. Run the batch file from the command prompt then check the log file.
    3. Invoke the batch file through the Task Scheduler then check the log file.
    4. Create the script file C:\Scripts\Test2.vbs with these lines:
      Set oFSO = CreateObject("Scripting.FileSystemObject")
      sLog = "c:\Scripts\Script.txt"
      Set oLog = oFSO.OpenTextFile(sLog, 8, True)
      oLog.WriteLine Date() & " " & Time()
    5. Run the script file from the command prompt then check the log file.
    6. Invoke the script file through the Task Scheduler then check the log file.

    These tests should give you lots of useful pointers.

    • Proposed as answer by jrv Tuesday, December 4, 2012 4:59 PM
    • Marked as answer by IamMred Thursday, December 6, 2012 4:56 AM
    Monday, December 3, 2012 6:37 PM