I am trying to automate a VBScript by using Windows Task Scheduler. However, I tried to use cscript.exe
+ "C:\...\script.vbs"
but it didn't run. I also tried to directly run the same command in CMD (cscript.exe "C:\...\script.vbs"
) and it worked.
What might be the problem?
EDIT :
I just tried to switch the setting to "Run only when user is logged on"
from "Run whether user is logged on or not"
and it worked. I am wondering if there is a way to make my task scheduled run even when the user is logged off.
Group Policy settingsSelect Group Policy Object (GPO), and then right-click and select Edit. Double-click and edit the Allow VBScript to run in Internet Explorer setting. Click Enabled to enable the policy. Under policy Options, select Enable from the list.
Greg answered this https://superuser.com/a/816073
Basically you need to create 2 folders:
You have to create a folder (or two on a 64bit-windows):
(32Bit, always) C:\Windows\System32\config\systemprofile\Desktop
(64Bit) C:\Windows\SysWOW64\config\systemprofile\Desktop
Fixed the issue for me (and I could point to the .vbs file, not bat needed).
After hours of research, one of Blake Morrison (from Microsoft)'s blogs came up; it mentioned that
If running a .vbs / .ps1 script, try launching it from a .cmd / .bat script
see Help! My Scheduled Task does not run…
That blog also explains a lot of rules/tips when using Task Scheduler.
So please create a .cmd/.bat file that calls for your VBScript. For example: cscript.exe YourScript.vbs
would be in your .cmd/.bat script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With