WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Service
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Interactive Desktop Service Issue


Question:

This routine runs fine as an exe.. Cannot seem to get it to run as a service.. It generates an OLE error on; "foreach objWindow In Shell.Windows" ONLY when run as a service. I have it on the local system account with allow to interact enabled. I am logged in as administrator and got even worse results when tried to log on as me. ANY IDEAS? this is driving me nuts.. Is it possible? any other way to see if a specific browser window (url) is open when run as a service?

Answer:

The service cannot see your desktop windows. This point can't be stressed enough... Services configured to interact with the desktop are a *BAD* idea. As mentioned before, Microsoft is making changes in Vista and Longhorn to eliminate services that interact with the desktop and which share a session with any other interactive users [session #0].

Anybody who is writing a script intended to run as a service needs to consider what tasks the script will perform and then determine if any of those tasks involve interaction that cannot be eliminated. If any interaction is involved, then the script cannot run as a service, no "ifs", "ands" or "buts" about it.

Although it may seem more complex, the proper solution to the interactivity part is to split the service into 2 pieces. There's the service itself that runs as long as the system remains booted, and then there's an "agent" application that runs in the user's interactive session via the "Startup" folder or via the "Run" registry key or via a logon script. The "agent" can perform interactive tasks, and then it can communicate with the service via a TCP stream or a named pipe or some other IPC mechanism. This is what Microsoft is recommending and it is a very workable and technically sound method to use.


Article ID:   W17262
File Created: 2007:07:03:14:29:04
Last Updated: 2007:07:03:14:29:04