I am trying to schedule a vbs script to run with regular user rights. The script runs fine when logged in as the user, but when I try to run the script from the task scheduler as "Run whether user is logged on or not", it gets stuck on the following line:
Set IE = CreateObject("InternetExplorer.Application")
I have tried running it with "Run with highest privileges" checked and unchecked. I am running the program from task scheduler as:
program/script: "c:\windows\system32\cscript.exe"
arguments: "test.vbs"
start in: c:\
Here is the full code:
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
set tfo = fso.createTextFile("c:\123.txt")
tfo.writeline("1")
Set IE = CreateObject("InternetExplorer.Application")
tfo.writeline("2")
tfo.close
output when ran as "Run only when user is logged on":
1
2
output when ran as "Run whether user is logged on or not":
1
additionally, the task will run correctly as "Run whether user is logged on or not" when using an admin account, but I cannot use an admin account as a solution.