3

I have a ClickOnce application that we start on Log on and recurring. After I install the application the tasks work fine, but if I reboot the machine the scripts run but they fail to start my application. I added logging to the BAT file and I know it is executed, but calling the rundll32 line produces no result and generates no errors.

If I manually run the script, from explorer, it works and task scheduler executions start working as well. Also, if I manually run the clickonce shortcut the scripts start executing from the Task Scheduler. Is there someway to verify that dfshim is loaded, or load it before executing it? What am I missing? I tried clearing the cache and that seemed to fix it on one machine, but it seems like a coincidence because it did not fix it on another machine.

VBS Script Called first(Called By Task Scheduler):

Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("C:\Users\brnapolitano\AppData\Roaming\FirstAmerican\TaskScheduler\AppReferenceInvoke.bat", 0)
set WshShell = Nothing     

BAT Script Called Second(Called by VBS above):

rundll32.exe dfshim.dll,ShOpenVerbShortcut 
C:\Users\brnapolitano\AppData\Roaming\Microsoft\Windows\Start 
Menu\Programs\FastLocalService\FastLocalService.appref-ms

I would like to make this a script fix, but if that's not possible, I will try adding it to the startup and see if that resolves my issue.

  • Possible duplicate of [ClickOnce app not starting from the scheduler](https://stackoverflow.com/questions/3110008/clickonce-app-not-starting-from-the-scheduler) – xdtTransform Aug 07 '19 at 07:18

2 Answers2

4

I found the answer(linked below). I am still in the process of testing, but it seems to work. dfsvc needs to be run, if not active, before running the command to start the shortcut.

ClickOnce app not starting from the scheduler

1

It's not clear from your post what is happening after reboot. After the reboot are you trying to run the scheduled task after logon or before logon? If the latter, your vbs and bat files are most likely running under a different security context than what you think it is. That could also be the case after logon depending on the settings in your scheduled task.

See Task Scheduler is not supporting option "Run with highest Privilege" and "Run weather user is logged on or not"

thx1138v2
  • 566
  • 3
  • 6
  • Logon and recurring tasks were scheduled, both start to fail after a reboot. The script is executed, but the process isn't started. I found the answer on another thread. Thanks for your time. – Brent Napolitano Jun 19 '17 at 18:05