Author Topic: advanced HMI through windows scheduled task  (Read 1287 times)

LargeValuesOfTwo

  • Newbie
  • *
  • Posts: 3
    • View Profile
advanced HMI through windows scheduled task
« on: February 12, 2018, 01:03:36 PM »
Just want to start out with saying how much I love AdvancedHMI.

I wrote an application that will poll data from a dozen different PLCs, summarize the data for management, create an excel document with nice charts of the details for maintenance, and then email it to the production team. I set up this application to run at 6 am and 6 pm at the end of every shift.

For over a year this program has worked flawlessly. Recently our IT team did an update to the computer that was running the program and suddenly it is not working anymore. Unfortunately, our IT team does not know exactly what they changed (they applied a patch update to another program). I can get the program to run manually without any problems on this computer and other computers but it doesn't work when setup as a scheduled task. I'm wondering if there is some sort of dependency or resource setting that I'm missing.

The following two errors show up in the Event Viewer after the scheduled task attempts to run:

Event Viewer Application Error 1:

Faulting application name: AllProductionReport101-105.exe, version: 3.6.0.0, time stamp: 0x5a7e1eb1
Faulting module name: KERNELBASE.dll, version: 6.1.7601.24009, time stamp: 0x5a52408a
Exception code: 0xe0434352
Fault offset: 0x000000000001a06d
Faulting process id: 0x20a4
Faulting application start time: 0x01d3a202caffb958
Faulting application path: C:\ReportingProgram\AllProductionReport101-105.exe
Faulting module path: C:\windows\system32\KERNELBASE.dll
Report Id: 367536b8-0df6-11e8-9b17-6c4b9003dc92

***

Event Viewer Application Error 2:

Application: AllProductionReport101-105.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ComponentModel.Win32Exception
   at System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.OnVisibleChanged(System.EventArgs)
   at System.Windows.Forms.Label.OnVisibleChanged(System.EventArgs)
   at System.Windows.Forms.Control.OnParentVisibleChanged(System.EventArgs)
   at System.Windows.Forms.Control.OnVisibleChanged(System.EventArgs)
   at System.Windows.Forms.Form.OnVisibleChanged(System.EventArgs)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])
   at MfgControl.AdvancedHMI.My.MyApplication.Main(System.String[])

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: advanced HMI through windows scheduled task
« Reply #1 on: February 12, 2018, 01:39:50 PM »
If you run another program as scheduled task, does it run?

You can also check this out: https://helpdeskgeek.com/help-desk/fix-scheduled-task-wont-run-bat-file/

LargeValuesOfTwo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: advanced HMI through windows scheduled task
« Reply #2 on: February 12, 2018, 03:14:42 PM »
I can run a simple program like windows calculator or a batch script without any problems.

I tried the tutorial you linked on helpdeskgeek. I changed the security to allow all authenticated users full control and changed the program path to be explicit but I still get the same errors. 
 
« Last Edit: February 12, 2018, 03:17:04 PM by LargeValuesOfTwo »

LargeValuesOfTwo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: advanced HMI through windows scheduled task
« Reply #3 on: February 12, 2018, 03:52:36 PM »
I made some progress. Selecting the option in task scheduler to 'Run only when user is logged on' gets it to work.

When I select 'Run whether user is logged on or not' it will get the same error message as above. I know I'm typing in the password correctly since when I type it incorrectly it immediately errors that it is not valid.

I do not understand why this is happening but I can work with our IT team to allow me to stay logged in all the time.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: advanced HMI through windows scheduled task
« Reply #4 on: February 12, 2018, 04:45:40 PM »
Your issue started after an update was performed and, to me, that's what caused the issue (whether this update changed some permissions or installed an older version of certain dll file or ...).

I don't think that this issue is related to AdvancedHMI at all.

There are some other suggestions on the Internet that you can also check out, one of which could be this:

http://www.tomshardware.com/forum/19818-63-task-scheduler-task