views:

310

answers:

2

I would greatly appreciate some help on this one! It may be a tricky one. :)

Problem

  • I have an VB6 application which is set up as scheduled task. It starts every time, but when executing CreateObject() it fails if a user is not logged on to computer.
  • I am looking for information on what could cause this. My primary suspicion is that some Windows API fails.

Key points

  • Behaviour confirmed on Windows 2000, 2003, 2008 and Vista.
  • The application executes as user X at scheduled time, executed by Windows Task Scheduler.
  • It executes every time. Application does start!
    • If user X is logged on via RDP it runs perfectly. (Note that user doesn't need to be connected, only logged on)
    • If user X is not logged on to computer the application fails.

Failure point

  • Application fails when using CreateObject() to instantiate a DCOM object which is also part of the application.
  • The DCOM objects declare .dll-references at startup (globally/on top of .bas-file) and run a small startup function. Failure must be during startup, possibly in one of the .dll-declarations.

Thoughts

After some Googling my initial suspicion was directed at MAPI. From what I could see MAPI required user to be logged on. The application has MAPI references. But even with all MAPI references removed it still does not work.

What is the difference if an user is logged on? Registry mapping? Environment? Explorer.exe is running.

Isn't the user logged on when application executes as the user?

What info would help?

  • A definitive answer would be truly great.
  • Any information regarding any VB6 feature/Windows API that could act differently depending on whether user is logged on or not would definitively help.
  • Similar experiences may lead me in the right direction.
  • Tips on debugging this.
A: 

The VB application possibly needs to get hold on to running services that are only running when a user is logged on.

Hace
Along the same lines, perhaps the DCOM component itself needs to utilize services which are only available when the executing user has an interactive session running.
John Rudy
+1  A: 

What is the "Identity" setting of the DCOM component.

C:\WINDOWS\system32\Com\comexp.msc

  1. C:\WINDOWS\system32\Com\comexp.msc
  2. Component Services
  3. My Computer
  4. DCOM Config
  5. The DCOM Object, right click properties
  6. Identity tab

Set it to "This User" and set a user with the required permissions, and then run the app as your self to see if the DCOM component can still work, then try again from the scheduler.

Simeon Pilgrim