Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Scheduled Task ERROR. Please HELP


I want to make my program run at a cetrain time, so I search thru this forum, and found that I should add the program in the scheduled task.
But I get the error and can't start the program.
Is there anything that I have to do make this work?
I attached the screen shot of the error I got.

Could anybody help me with this?
Thank you very much.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Add A Scheduled Task
How do you add a program to run at a certain time using VB, to be a scheduled task?

I want this done automatically using VB if at all possible.

Add A Scheduled Task
how to add a scheduled task though coding ?

Scheduled Task
I am trying to create a scheduled task from within my application (AT command). Does anyone know how i can do this.

Scheduled Task Problem
From a scheduled NT Task i am calling a access database, which inturn then calles a a batch file using the Shell command to connect to a ftp server and transfer a file.

When I run this from access it workes fine, however when I run the scheduled task it hangs when trying to open the ftp server.

Any ideas why this is happening, and is it possible to send the ftp commands from within Access VBA?

Any suggestionshime would be wolcomed.

Creating A Scheduled Task
Does anyone know of a way to create a Windows 2000 Pro scheduled task within a VB6 application? Is it possible?

Thanks!

JC

Creating A Scheduled Task
Hi all,

I've searched the forums, but nothing really stuck out to me. I want to automatically create a scheduled task of my application. I have this code, but it's not working correctly:

Code:
Option Explicit

Private Declare Function NetScheduleJobAdd Lib "NETAPI32.dll" (ByVal servername As String, Buffer As Any, ByRef JobId As Long) As Long

Private Type AT_INFO
JobTime As Long
DaysOfMonth As Long
DaysOfWeek As Byte '127 = all days (01111111b)
Flags As Byte
Command As String
End Type

Private Const JOB_RUN_PERIODICALLY As Long = &H1

Private Sub cmdAddTask_Click()
Dim ai As AT_INFO
Dim t As Date
Dim apiTime As Long
Dim strFile As String

strFile = "G:luecardQueue CleanerCleaner.exe"

'check for invalid time
On Error Resume Next
Err.Number = 0
t = CDate(txtDept.Text)
If Err.Number > 0 Then
MsgBox "Invalid Time!"
Exit Sub
End If
On Error GoTo 0

apiTime = (Hour(t) * 3600 + Minute(t) * 60) * 1000 'convert to milliseconds
ai.JobTime = apiTime
ai.DaysOfWeek = 127
ai.Flags = JOB_RUN_PERIODICALLY
ai.Command = StrConv(strFile, vbUnicode)

'the null 'servername' parameter uses the local computer
NetScheduleJobAdd vbNullString, ai, 0&
End Sub
This will create the task, but the task will never run.

Wont Run As Scheduled Task
Hi There,

I have written a program to run on a windows2000 server. It is designed to connect to an ACT! database to create a CSV file of certain records. The program works correctly if i launch it from the exe. if i run the exe with the command line parameter autorun it does it automatically, this also works. But if i create a scheduled task with the command line paramater autorun it does not. as far as i can tell the process loads but does not do anything.

Please provide me with any suggestions as to what may be causing this.

Kind Regards

SkreeM

Verify Scheduled Task Ran
Is there a way to code a VB project to verify a scheduled task ran? I don't want to set up any file updates from the scheduled application to check. I just want to check Windows some how to verify it after the first project ran. I'm using Windows 2000 Professional.

Basically it's running on a remote computer and I want to set it up to send me an email if it's predecessor didn't run.

Change A Scheduled Task?
Is it possible to change/create a scheduled task using VB without envoking the wizard?

Thanks

Delete A Scheduled Task
hey guys i was wondering, how to delete a job that was created uding vb? i'm using the at command to make the job

Delete Scheduled Task
Is it possible? I hope someone will guide me on how to do it.

Create A Scheduled Task
Is there a way to interface with the Windows Scheduled Task Manager to create a new task that runs hourly?

Create Scheduled Task Thru VB
Hi all,

Does anyone know how to create a Scheduled Task thru VB ?? The Task wizard creates an encrypted file in the WindowsTasks folder that has the extension of JOB. I figure it's along the lines of creating a Shortcut but I searched codehound and others and came up empty.

Thanks in advance.
John

Scheduled Task Not Working
I have a job that was added to Windows Task Scheduler through NetScheduleJobAdd, but they do now run at the specified time. It seems that it does not like directory paths with spaces in the name(i.e. "Program Files"). Is there a way around this? The only two solutions I could think of is either make a shortcut in the root directory or add the directory path to the path environment variable.

Scheduled Task - Can't See Printers
When no one is logged on and I run a VB program via NT Scheduled Tasks,
the VB program cannot see any printers, even though it
logs in via WNetAddConnection2 and the login parameters
provided to "Scheduled Task".

Also, word needs to be able to see the printers, as well.

Scheduled Task Does Not Instantiate Excel
I have some VB 6.0 code that looks through an Access 97 database and exports various records to an Excel 97 spreadsheet. The code I use for opening the Excel is as follows:


Set xlApp = New Excel.Application
'---
'Open Excel
'---
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Add
Set xlsSheet = xlApp.ActiveWorkbook.Sheets(1)
xlApp.Visible = False

When I run the code from the server (logged into the server) the code works great. However, when I schedule the task to run at night the code breaks at the Set xlApp = New Excel.Application line.

I set the security on the Scheduled task to run as the same user that works when I am logged into the system.

I'm at a loss...Please help.

Scheduled Task In Windos 2000
Hi there!

I am currently runing my application in Windows2000 Scheduler for 24hours every mminute.

My Problem is.. When I change the timezone in PC programatically the Scheduled Task seems to not recognize the next run time?

Is there a setting for this to be done?

So that it will still be running 24 hours?

IANIAN

Running Scheduled Task From .vbs File
Hi there.

I have created a scheduled task that I would like to be able to run by dbl clicking a .vbs file (with code to run scheduled task). Trouble is I don't know the code to run the task so can anyone help.

Thanks a lot

James Brown

Running A Scheduled Task From ASP Page
Hi,

I have a scheduled task that runs at the appointed time fine. Now, in my web app (ASP,VBScript) I'd like a user to be able to click a button which would actually run the scheduled task using an onClick event).

so, something like:

<a href="#" onClick="runScheduledTaskFunction()">RUN</a>

Can this be doe?

Thanks a lot

Tony Mead

Scheduled Task With DIWriteJpg Method
Hi,

I am using Declare Function DIWriteJpg Lib "DIjpg.dll" (ByVal DestPath As String, ByVal quality As Long, ByVal progressive As Long) As Long and Public Declare Function ConvertBMPtoJPG Lib "JPGUtils.dll" (ByVal strFileName As String, ByVal JPGCompressQuality As Integer, ByVal blnKeepBMP As Boolean) As Integer to convert bmp images to jpg images.

I want the program to run as a scheduled task. When I run the program locally, it behaves the way it should and creates the jpg images at my specified location! BUT, when I put it in a scheduled mode, by passing command line argument, my whole project disappears (i.e., the application crashes), while trying to use
the "DIWriteJpg" function.

I am not able to figure out what is the possible connection between being run as a scheduled task and using the "DIWriteJpg".

Any input would be helpful!

Thank you,

Regards,
Swati Shukla

Just Curious {Windows Scheduled Task Programmatically}
Don't suppose you know how to create a "Windows scheduled tasks" with VB code do you?

SQL Server Scheduled Task Behaving Weird
Hi,

I am facing a really weird problem working with SQL server.

I have a stored procedure with an insert query. This procedure has been scheduled and running fine for last 10 months. For last 2 days, when I execute it in query analyzer, it returns about 1 or 2 rows according to the data, which is the way it is supposed to be. When the same procedure (without any single change even in comments)
is executed as a scheduled task, it returns more than million rows in stread of 1-2 rows as if it has created full outer joins on the tables in the query.

We are running sql server 7.0 with SP2. No problems with servers are noticed in last week. I dropped and recreated the procedure several times if in case execution plan has gone bad. The create procedure statement has 'with recompile' condition also.

Has anyone seen this kind of problem with sql server before?
Can anybody give a logical explanation for this? Does the SQL server handles procedures differently in SQL server and as a scheduled task? This has created more than enough problems for me at work as emails are sent to the outsiders from the data inserted in the table. It might create legal problems for the company also as the program ended up sending several thousand emails to the people who has nothing to do with it. So, any explanation will be appreciated.

Here is the query:

insert into MKS_failed_notify_wrk        
select     es.shopper_id,
    ds.first_name,    
    ds.last_name,            
    ds.email,
    ds.employee_id,
    dop.order_id,
    dop.pin_id,
    dop.product_ppn,
    es.exam_score,
    es.passed_exam,
    dct.exam_date,
    dct.online_exam_id,
    0,
    '1/1/1900'
from     exam_result dct,
    exam_selected es,
    order_output2 dop,
    shopper ds        
where     dct.exam_date   > dateadd(day, -4, getdate())
and     es.online_exam_id = dct.online_exam_id
and    es.EXAM_SCORE    < 66
and    es.order_id = dop.order_id
and     dop.product_ppn like  '300477%'
and    ds.shopper_id    = es.shopper_id
and     es.exam_code in (  'ECE47701','ECE47702')
and    dop.pin_id = 'MKSDNS'

Please let me know if you can think about any reason for this behaviour.

Thanks,

Ann

Datareport Won’t Print From A Scheduled Task
I have a VB 6.0 SP6 application that processes order files.  It is setup to run either unattended as a scheduled task with a command line parameter or via a form interface.  The appl generates a report at the end of the run via a Datareport designer.

Now the bug…

When I run the appl via the form interface (or from within the VB source environment to debug) it processes normally and generates the report.

When I run the appl via a scheduled task on my machine it processes the data but doesn’t print the report.  The scheduled tasks are created using my own network credentials (which are in the domain admins group by the way) as the RunAs parameters.  Nothing appears in errors.log that is typically created in the installation directory when there’s a problem.  I also have had the printer queue opened and don’t see anything passing through.  

I’m wondering if anyone has experienced this and identified a work around.  I’m thinking it’s a part of the XP Scheduled Task process but I have full control rights to my own machine.



Gurus??? Please Help... Scripting The Creation Of A Scheduled Task In ASP With WMI
This may not be the right forum for this question, but I wasn't getting any responses in the ASP forum (so I moved the question here)...

I am attempting to create/delete Scheduled Tasks on our web server from a website running on that server. I have an ASP page that gathers all the scheduling details from the user and passes them to another ASP page that writes most of these details to an Oracle table and then calls a function in a VBS page that schedules the task.

After searching Google and MS it appears that the ‘Task Scheduler’ APIs cannot be scripted, but the ‘AT’ APIs can. (http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_man_lpja.asp).

The page referenced above makes the following statement regarding the user allowed to run scheduled tasks (it isn’t explicit about who can CREATE a task)…
    “Tasks must run under the same account as the scheduler service. By default, this is the LocalSystem account, although you can configure     the service to run under a different account.”
I don’t think I want to change the account that Scheduled Tasks run under by default on the server…

I found the following code (on one of MS’s sites and several other places), but I have had a heck of a time trying to get this to work due to 'permissions issues'.
(http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_man_lpja.asp)

Code:
    sComputer = "."
    Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & sComputer & "
ootcimv2")
    Set oJob = oWMIService.Get("Win32_ScheduledJob")
    errJobCreated = oJob.Create("C:WINDOWSNotepad.exe", "********123000.000000-420", True , 1 OR 4 OR 16, , , JobID)

    If (errJobCreated = 0) Then
        Response.Write("New Job ID: " & JobID)
    Else
        Response.Write("An error occurred: " & errJobCreated)
    End If


I was originally getting an 'Access Denied' error when I attempted to set the oWMIService object with the 'GetObject' command. However, I finally found that the issue had to do with user security on WMI itself. I granted rights to the IWAM user on WMI, and this problem went away.

Now, however, when I try to create a job (a Scheduled Task) I get an error ‘2’ returned from oJob.Create. Error number 2 = "The user did not have the necessary access".

I have tried adding the IWAM and IUSR users to the Admin group. I’m not sure where to go from here???

We are running IIS 5.1 and the web site’s ‘Directory Security / Authentication Methods’ are set to ‘Anonymous Access’, ‘Allow IIS to control password’ and ‘Integrated Windows Authentication’.

I am developing on an XP Pro box, but the production environment is a W2K server.

Any help would be greatly appreciated (although I wouldn’t want anyone to spend much time at all on this… after reading more about the limitations of tasks created by AT.exe I’m not positive that I want to use this method anyway. I have a 3rd party piece of software that I have been successful in using to accomplish what I’m trying to do. It would just be nice to not have to mess with that software and licensing, etc.)

Rob Milton

Edited by - rob_milton on 1/15/2004 3:03:07 PM

Running A VBA As A Scheduled Task. Batch File That Is
My first post. I usually find answers without posting.
Here is what I want to do:
I want a VBA script in a workbook to run at night.
My test set up:
In Windows XP I made a schedule task to open a workbook called batchtest.xls

In the workbook "batchtest.xls" I have this code on the "ThisWorkbook"
Private Sub Workbook_Open()
Application.Run "'code.xls'!mapkeytest"
End Sub

This executes when the workbook is open by the task scheduler.

It is suppose to call the macro "mapkeytest" that is in a module in the workbook "code.xls"

What happens is that when the Task Scheduler tries to open the "batchtest.xls" Excel pauses and brings up a message box "File in use" that states "PERSONAL.XLS is looked for editing by username" It gives the choices of "Read only", Notify, Cancel. If the Read only is selected it runs fine. This does not work for automation. I don't see any reference to the personal book by the other two. Now, if Excel is not running at all, it works fine. Maybe this is a Windows OS problem.
 
Any suggestions??

Thanks

Problem With Setting Start Date For A Task Scheduled.
I am using :Win32_ScheduledJob Class for scheduling a certain task using Visual Basic .I am able to schedule the task with the parameters specified in the class.But I am not able to set the start date for the task created.How to set the start date and end date of a task in Visual Basic program?

Application Is Not Working As Scheduled Task But Running With RunAs
We have developed an application in vb which access exchange public folders
and mail box using CDO 1.21 library.
I am able to run this application using RUNAS command with domain account,
but the same application is not working when it is scheduled with the same
domain account. I am getting overflow error
The scheduled task is working when the current logged on user is same as the
scheduled user.

Any Idea regarding this behavior?

Advance Thanks,
Ramana & Anil

Two-task Communication Protocol Error
Hi,

I am trying to connect to oracle database using ASP and I am getting the error

"ORA-03106: fatal two-task communication protocol error". Is there any problem with the driver I am having in my PC? I have oracle 9i Rel 9.2.0.2.0 and sql version 8.1.7.0.0

Here is my code:
<%
SET myConn=SERVER.createobject("adodb.connection")
myConn.Open "DRIVER={Microsoft ODBC for Oracle};UID=ven;PWD=kat;Server=MyOracle.WORLD"
myconn.mode = adModeReadWrite
myconn.CursorLocation = adUseClient
SQLStr="SELECT ID, NAME FROM USER ORDER BY ID"
SET result=myConn.execute(SQLStr)
IF NOT result.EOF THEN
response.write("<P>Connecting to Oracle using OLE & DSNLess connection</P>")
response.write("<TABLE BORDER=3 BGCOLOR=#0099CC><TR>" & _
"<TH>ID</TH><TH>NAME</TH>")
WHILE NOT result.EOF
response.write("<TR><TD>" & result("ID") & "</TD>")
response.write("<TD>" & result("name") & "</TD>")
result.movenext()
WEND
response.write("</TABLE>")
ELSE
response.write("<P>Error retrieving login data!!</P>")
END IF
%>

Simple Task, Annoying Error With Files
For a saved game file i have hundreds of boolean variables, but I noticed I had trouble with the values that were True, as it did not load true. I made a quick example and it still did not work. You can copy the code and create a cmd button to test it out.

Private Sub Form_Load()

Dim bool1 As Boolean
Dim bool2 As Boolean
Dim aa As String

bool1 = False
bool2 = True

aa = "C:WINDOWSDesktopzz.txt"

Open aa For Output As #1
Print #1, bool1
Print #1, bool2
Close #1

End Sub


Private Sub Command1_Click()

Dim bool1 As Boolean
Dim bool2 As Boolean

Open "C:WINDOWSDesktopzz.txt" For Input As #1
Input #1, bool1
Input #1, bool2
Close #1

MsgBox (bool1)
MsgBox (bool2)

End Sub

Maybe i'm just overlooking something so obvious, but then i run it, the 2nd boolean variables reads in false instead of true. Any help?


Also, an off-topic question, for the media player ocx, is there any way to off the .wav or whatever sound file inside the program instead of read from a path? I dont think it incorporates the file when it compiles.


All help appreciated.

Error 70 Using ActiveX Server With Task Scheduler
This is long winded so bear with...

I am using task scheduler to run an app that makes calls to an ActiveX server. The activeX server opens a connection to a SQL DB, then reads data into a recordset from one of the tables of the DB. At the point that I touch one of the items of the recordset the server pops with ERROR 70.

Worth noting: I can run this app from the desktop and no errors occur.
The DB login uses SQL authentication.

Any ideas?

WinAT Mentions that: AT jobs will NOT run under the security context of the user requesting it. Rather, they will run in whatever context the Schedule service is running, typically the operating system's context.
Which begs the question: What is the OS's security context? and is this related to my problem?

Using Visual Basic To Schedule A Task In Task Scheduler Running Windows 98.
Need to use Visual Basic to schedule a task in Task Scheduler running Windows 98.

Are there API calls to make?

AT commands that work?

Some way to programmatically schedule Task Scheduler on Windows 98?

How To Block User To End Task Our Program From Windows Task Manager....??
How to block user to End Task our program from Windows Task Manager....??

or other way is make the program disappear from the Windows Task Manager.........

Outlook Custom Form - Task Regeneration Field Error
- Newbie
- Outlook 2003
- Creating custom form
- Problem:

Have a custom calculation based on the DueDate field. However, it does not update when a recurring task is automatically regenerated.

- To Reproduce:

Create custom task form. Create user defined field "Due Date Value". Bind the value to [Due Date] in the formula box and calculate the formula automatically. Publish form. Create a new custom task using that form. Set a recurrence to regenerate task one week after completed. Due Date will change to today's date (ok). Custom field, Due Date Value, will also change (ok). Save and close. Click completed box next to the task in the folder. New task is created with new Due Date. However, Due Date Value remains today's date.

- Question:

Why does the custom field not calculate the value automatically as it should? Is there a trigger to get it to update the calculation when a task is regenerated?

Thanks!!!

How Do I Hide My App From The "Task Bar"? (that&#039;s Task Bar Not The Task List) Thanks
I just need some insight on how to make my program not show in the Window's Task Bar.


I appreciate any help, thanks,
Daniel Christie

Can The End Task Like Task Manager Does Be Implemented Using Vb RESOLVED
Can the end task (like task manager does) be implemented using vb

Equivalent To End Task Button In Task Manager?
The title says it all. What API is equivalent to End Task button in Task Manager?

Windows Task Scheduler - Add A Task
Does any body have any idea how to add a task to the windows task scheduler (if its not there already) through a vb program ?

So that a program can be run through the task scheduler...
(By the way, I know how to do it manually, I just want to put a task to the scheduler through a vb program)

Thanks
Ram

Hiding A Task From Task Manager
How do I do that?

Thanx, Tadej

Please HELP!!! Add Task To Windows Task Schedular
I have a application written in VB 6.0.
I want to add my application to the Windows Task Schedular in prgramatically.
So everytime, if the PC is turned on, the application execute, for example 10:00AM every morning. So within the code I 'm going to specify to add my application to the Windows Task Schedular to execute every morning 10:00AM, if the PC is turned on.
I'm greatly appreciate if anyone can give me an idea how to do this. I really appreciate.

Cheers

Raj

Anyone Know How To Setup A New Task In The Task Manager
Trying to install my exe, and then set it up as Scheduled Task.

Valid Solution is worth a 100% vote!

IP Scanning For Scheduled WOL App
hi everyone,
Im new to the forum, as well as to "intermediate-advanced" vb programming, so Id appreciate any help you guys could offer.

Ok, so Ive been looking everywhere for a freeware Wake On LAN/network admin tool for the SOHO LAN Im in charge of, but I havent found anything free&good, so I want to build it myself. Basically, I want something that will send scheduled WOL wake-up packets to the office computers early in the morning to auto-boot them all up before the employees get there. Ive already found a free control that will create/send the packets given a MAC address, and Ive also found some code snippets that show how to translate a given IP into a MAC. So, all I need is to work on is figuring out how to "schedule" the packets and leave the program running in the server system tray(id appreciate any hints/advice on doing this...) and doing the IP scan for active hosts.

I want to add an option to the program that will automate the MAC address discovery&storage function, by clicking a button, and automatically scanning a small IP range (last block; ex.192.168.1.2 --->192.168.1.254) for active hosts, resolving each mac address, saving the MAC's, and adding them to the "WOL list" for the next morning. This way, I can auto-generate the WOL list during regular biz hours, and not have to set up each MAC manually. Theres probably only about 50 or less machines on the net. I dont even know where to start with the IP scan. Id appreciate any help anyone would be willing to offer.

Scheduled Event
Is it possible to schedule an event based on time or day and have it execute WITHOUT intervention from the user?
Namely, I want to scan a directory on a regular basis and delete files meeting some criteria. I also want to End the program at a given time every day (I am not concerned about unsaved data).

Thanks for any input or reference.

H. Chain
Houston, TX

Scheduled Tasks
I would like to make a program that changes the desktop image every 3 days. How do you do this?

Scheduled Maintenance
I have a dilemma that I am sure someone out there knows how to handle. I have a MSHFlexgrid that shows all open maintenance requests. This part works fine because so far all of the requests are user generated. My problem is I need something to generate reoccuring scheduled maintenance for me. For instance in we need to service the air conditioner once a month, then I need my program to automatically generate a request monthly. Is this possible? I was thinking that I could use the MS Calendar control... I just dont know how. Thanks,
Brandon

Scheduled Tasks
Does anyone know how I can change the "Scheduled Tasks" in Control Panel through code? Even how to shell it would help...

Thanks
Dan_

Scheduled Tasks
I need my application to run a task, at specified intervals of say 10 minutes the whole time the application is running - much like the way that Outlook checks the mail accounts at regular intervals.

I have no idea how to go about this or where to start looking. I don't even know if this is possible in VB6.

Can anyone offer some advice of where to start looking.

Thanks

Scheduled Action.
I want a sub to be called at specific times of day (such as '8:42:05 PM'). Currently, I have a timer with the interval set to 1000. Every time its called, it checks that the current 'Time' matches a value on a list (the time it's supposed to work), if so, it calls a sub. However, If there is a lag, then it may just skip over it. Is there a better way to Schedule an event besides the timer control? Thanks.

Scheduled Tasks
Can I overwrite a scheduled task?
Because when I use the Win32_ScheduledJob Create Method Winows appends new tasks..
I must execute my script at every startup.. an i must to overwrite one task or check if it exists..
Please help ME!!!

VB Script Scheduled ?
Hi,

I need to create a schedule task (Windows one or Oracle DBA_JOBS) updating tables from files.

For achieving this task, i need to use:

1- some sql to manipulate the tables
2- some shell commands like 'import' to import some dmp file to my db
3- some filename manipulation using calendar (for exemple for importing a file named 20021008.dmp to get the yesterday information)

If I want to do a bat file (DOS), I can launch sqlplus easily but I see no solution for point 3.

Same wih a DBA_JOBS embedded into Oracle (launching 2 with host).

I think VB could help for point 3 ... Is it a solution ? How to do it ?
Looking for feedback AND Good Advice ...

HELP HOTLY WELCOME !!!!!!!!

Thanks in advance,
Benouche

Copyright © 2005-08 www.BigResource.com, All rights reserved