Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I have a Windows 2008 R2 VM that runs a 3rd party ERP system. They have a utility that will run scheduled jobs to backup the Oracle database and their app data nightly with a 7 day rotation.

The problem is that it must run as a desktop app interactively within a session. It can't run as a service. While I'm not thrilled about leaving an account logged in, I've learned to allow it. The primary issue here is that if the server gets rebooted it can be days before I realize that the account is no longer logged into the server with the app open.


Can (and if so, how) I create a task that runs at startup that logs a user onto the VM (creating a session) and launches an app on that session's desktop?


If this is too difficult or not possible, anyone got ideas on how to check and see if this app is running in that account's session and if not send an alert? I'm cool with even a custom event log error since I can pick that up through remote monitoring.

share|improve this question
up vote 8 down vote accepted

I'm assuming that the program needs to display its UI and that you can't just run it non-interactively. (I love these "gems" of software...)

Here's what I'd do, personally:

  • Configure the server computer with an AutoAdminLogon as the user you want to run the application as. This will cause the server's console to logon as this user automatically on boot.

  • Add a script to the autologon user's personal "Startup" group that starts the task asynchronously, monitors the process list for the task being present (I'd use WMIC PROCESS LIST, personally), alert if the task goes missing from the process list and, if so-desired, restart the process. I'd also lock the workstation, too.

The script in the Startup group could be as simple as (calling the program you've got to run eqalert.exe):

@echo off
start "" "C:\Program Files\EQFU\EQWin32\eqalert.exe"
rem Delay 30 seconds between checks
ping -n 30 >NUL 2>NUL
wmic process list | find /i "eqalert.exe" >NUL 2>NUL
if not errorlevel 1 goto check_loop
echo eqalert.exe not running - restarting
eventcreate /T ERROR /ID 1 /L APPLICATION /D "eqalert.exe not running - restarting"
goto restart

This script assumes that there will only be one instance of the task running and is only check for the task's presence in the process list. If the process hangs and otherwise dies this script wouldn't catch that. (Monitoring if the program is "responding" to Windows-- i.e. if its message pump is still-- erm-- pumping-- is a more involved prospect.)

share|improve this answer
I find it strangely eerie that you knew which 3rd party app I was referring to. ;) – TheCleaner May 2 '13 at 13:50
I could just tell by how you phrased it. I have a strong intuition relating to crappy software and stupid demands to have interactively logged-on sessions. (And I have to deal with this dog in a couple of sites. Don't even get me started about the upgrade we just did 3 weeks ago to the 2012 version-- my poor Customer was running one-off SQL scripts from the vendor for days after the upgrade was done just to get back basic functionality.) – Evan Anderson May 2 '13 at 13:53
Very nice. Thanks for the insight, I'll get to work on it. (Now if they'd just make their ERP app's icons look like they weren't from 92) – TheCleaner May 2 '13 at 14:00
It does look pretty dated, doesn't it? I've never actually had to use it, thankfully. (I'd like to see the requirements for the Borland Database Engine dropped, personally... I think it is from '92... >smile<) – Evan Anderson May 2 '13 at 14:01
Actually, BDE isn't so much of a problem. You can even package it with the application itself and not have to install it on the machine. It's not trivial because you have to extract all the binaries as well as the config file, but it works. – Stephane May 2 '13 at 14:06

First, are you sure you really need an interactive session ? Chances are you can actually run it inside a scheduled task if set it up property.

Now, assuming the above is not possible/practical/allowed:

You can setup your VM to automatically log in a user. The process is described here but here are the high points:

  • Open HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon in regedit
  • Create two registry entries DefaultUserNameandDefaultpassword`
  • Edit the AutoAdminLogonentry and set it to 1

(alternatively, you can just download and use AutoLogon)

I'm sure you can see the potential issue here so I won't elaborate.

Your second request is pretty easy to do with a batch. Here is a sample that uses blat:

tasklist | find "myprocess.exe"
if %ERRORLEVEL%==1  blat tasknotrunning.txt -to

If you want to use the event log instead, then you can use the built-in eventcreate command like this:

tasklist | find "myprocess.exe"
if %ERRORLEVEL%==1  eventcreate.exe /L APPLICATION /ID 911 /D “task XXX is not running” /T INFORMATION

(I picked 911 here as event ID but you can use whatever you see fit as long as it doesn't conflict with something else).

share|improve this answer
Thanks...this helps as well. You both have great answers to the issue. – TheCleaner May 2 '13 at 14:01

They have a utility that will run scheduled jobs to backup the Oracle database and their app data

If that's all the task is doing, there are other ways to backup an Oracle database. You mentioned other app data as well, but I expect that also could be captured separately. Have you looked into whether more general backup tools, such as BackUp Exec, Barracuda, Acronis, etc, that you may already be using for other services, could accomplish the same goal? It sounds like this tool is intended for smaller customers that may not otherwise have a real backup solution.

share|improve this answer
The "manufacturer" is really, really anal about using their job scheduler. They pretty much demand it and make it a condition of support. It's crazy. – Evan Anderson May 2 '13 at 14:02
We are also using CommVault's iOracle agent, but the 3rd party ERP support still requires a nightly EXP dump based on their app "just in case we can't use the CommVault restore". All it really does is an Oracle EXP dump nightly...I can easily script what it does, but they insist. EDIT: yeah what @EvanAnderson said – TheCleaner May 2 '13 at 14:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.