Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Scheduled Task using VBScript

Status
Not open for further replies.

ipisors

Programmer
May 18, 2020
2
US
I've been struggling with trying to create a scheduled task using VBScript. What I want to do is prompt the user for some inputs, such as the time of day. I can handle that part if I even get a script that works. I need a script that works for recurring (daily m-f) for any time of day, then I can handle user inputs and translating that into the time for the script. I've tried the stock code listed at the bottom of this page and it doesn't even work - it returns unknown error code #8.

I've come across other examples but they don't schedule a re-ocurring task, only a one time task, which is useless. :(

Can anyone point me in the right direction to create a recurring daily scheduled task at a given time with the action to start a program? I want it to run without highest privileges.
 
> unknown error code #8

[tt]Win32_ScheduledJob[/tt] was designed to work with the now somewhat aging AT protocol - and the AT protocol was deprecated back in Windows 8, and is nowadays switched off by default (and is the root cause of error 8 that you are seeing). You can switch it back on with the following registry entry(with all the normal caveats about editing the registry):

[tt]Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Configuration
Name: EnableAt
Type: REG_DWORD
Value: 1[/tt]

but you might be better off looking at the Task Scheduler Scripting Objects instead. it is a little more compledx top use, but there are numerous examples there.
 
Okay I will look at the Task Scheduler Scripting Objects instead. thank you for the tip !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top