I have an application on Windows Server 2012 R2 that runs around the clock that shares information with a separate client application. The server app only saves all of its data to files when it is closed, so I've set up a scheduled task that triggers a batch file to close it, make copies of the files, and then restart it.
the batch looks something like this:
taskkill /im myprogram.exe /f
copy "C:\programfiles\myprogram\data.file" "C:\backups\data.file"
runas /savecred /user:Administrator "C:\programfiles\myprogram.exe"
When no one is logged into the server, the app starts under SYSTEM and this creates two problems:
- 1) The gui is hidden, so when someone logs in to make changes, they have to restart the application as Admin to interact with it.
- 2) The client side app is unable to communicate properly with it and sometimes doesn't even see it.
I have tried setting up my scheduled task to run both as Admin and as System, and in both cases I leave the box for Run with highest privileges unchecked.
Aside from the regular backup, a similar task is also in place to run on startup and reinstate the most recent backup before starting the application (this prevents the app from starting with a broken database in the event of a system crash). both tasks are set up with the same credentials and permissions.
Are there any other options that need to be set to make sure that the application is always started as Administrator?