Can’t run .vbs with Windows Task Scheduler – Open With…

Issue

Cannot run a simple .vbs script using Windows Task Scheduler. The script runs just fine if launched manually. However, if it’s run from a scheduled task as a currently logged on user, Open With dialogue opens. If it’s run from a scheduled task under a different user account, nothing happens and task stays in Running state indefinitely.

Windows Open With dialog

Resolution

The issue was resolved by running the script via wscript.exe executable, instead of trying to launch .vbs directly. To do this, configure the scheduled task’s Actions tab as follows:

  • Action: Start a program
  • Program/script: C:\Windows\System32\wscript.exe
  • Add arguments (optional): “C:\Scripts\script.vbs”

 Windows Scheduled Task - Actions

November 2019
Windows Server 2016


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *