Windows – Automatically Running a Program Without Task Scheduler

scheduled-taskswindowswindows-server-2008-r2

I have a small program that needs to be run without use of the Task Scheduler. It uses the QBFC API from Intuit, which demands to be run "within the context of a user." The program sweeps some data from a SQL server running on the same machine and pushes it into QuickBooks. Thus, the program needs to run every half-hour or so and requires no user interaction. The machine is running Windows Server 2008 R2.

If I manually run the program, it works as expected. Attempts to use the Task Scheduler have resulted in the program crashing when it attempts to connect to QuickBooks.

Best Answer

I am guessing you want the application to start when the user logs into their profile? If you want the program to automatically start, in any other case, that would require a scheduled task.

actually, you can also just place it in startup. I placed it in startup in the registry (currentversion=>run) and I can confirm it works.

now to answer OP's actual question, I believe I found the answer to the question-> not necessarily a solution to reach the goal.

QB and QBXML SDK applications have to run in the context of a user.You will have to have a Windows session open, but the user does not have to be logged in to QB for your application to run against it. However, QB will have to be opened by an admin the first time your application makes the connection and you authorize unattended mode.

intuit.developer

Windows Scheduler has changed from Desktop base to Service based from Vista or Win7 onwards, and the new OS has the Scheduler as Service based.

QuickBooks and QODBC are desktop based application/driver.

QODBC uses QuickBooks SDK, and QuickBooks SDK uses QuickBooks Application to get data from company file.

QuickBooks SDK requires an active desktop session (someone to is logged in) to the machine because QuickBooks is a desktop-based application. If no one logged on the server/machine, you will get the error "Could not start QuickBooks".

Even if you have specified the username/password and have a user logged into the machine, you may notice the same error. This is because task executed from Task Scheduler runs as a different user / new session.

The workaround is to use a Desktop Based Scheduler like Z-Cron or http://alternativeto.net/software/task-scheduler/?platform=windows.

source of quoted text

now this may not be the solution you want. but it does answer your question/problem and includes a workaround.

i am also facing the same dilemma and am looking for a solution. this may have to be the way i go. another option is to kick off your console application on any user login, and keep track of your last successful run, current application status (whether its currently running or not) - so you ensure you run within your specified schedule. but not only is it a relatively messy solution, you do not necessarily have a guarantee someone will login during your required time allotment (they may not even login for a week).

i tried to kick off a remote session, which causes the app to run from startup, from another server using task scheduler. but that gave me the exact same result.

im currently looking into QBWC, to see if either of those approaches would allow me to achieve the desired goal of communication with QB on a scheduled bases autonomously.

i regret that I could not provide a definitive solution for you, but I think you and others can gain from the research ive already done so far. Additionally I hope this information helps you find the right solution.