Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm having some issues with an automated backup macro script I've written using Autohotkeys.

My specific issue is that I need the script to run on a Windows based server at a given time during the night and run the macro in a Windowed environment. I have successfully created a Scheduled Task using Task Scheduler, this task launches my autohotkey binary and that part works just fine, task scheduler loads it with the correct arguments at the correct time of day.

The issue is that the scheduled task doesn't have an environment where Windows for the macro to interact with can exist (the macro clicks on buttons, checks to see if certain windows exist, etc), as there is no display device connected to the server. I have ran this script when connected via RDP, and as RDP acts as a display device it worked without a hitch.

I then downloaded AutoLogon which schedules a login to a windowed environment at a specific time. This of course works, in so far as it logs a user in at a given time to produce a windowed environment, and will work if a monitor is connected to the server. The issue here is that the server does not have a monitor attached and so does not actually render anything, so my script fails.

I'm at a loss on how to go forward from this point. Does anyone have any ideas or a similar experience which could possibly help me?

share|improve this question
You shouldn't need a monitor plugged in for it to render the windows. But you will need to be logged in in order for it to function. What backup are you trying to do? Maybe there is an easier way to accomplish what you are trying to do without needing a locally logged in account. – MikeAWood Sep 24 '13 at 19:51
Ah the backup in question is for the U.K edition of Sage Line 50. It uses a propriety data format to store flat data tables. The issue is the sage backup routine doesn't have any kind of in built scheduler to run. It all works via the software GUI. The directory can be copied but causes all sorts of issues due to file locking and other nastiness. I created a macro script to automate the process but obviously it needs to be able to get a window handle to do its job. – Daniel Lane Sep 25 '13 at 9:20
you could trigger a remote machine to login via RDP and execute your script. That would give it an unlocked console to run in and force run your backup script. Since you can control things like the resolution and such, that should make it a bit easier.. Can you pause the database services and copy it that way? (of course that assumes you have time where the system is idle).. – MikeAWood Sep 25 '13 at 18:40
The resolution of the screen isn't much of an issue, the macro works almost entirely on key presses. It's not even a 'proper' database engine. It's entirely file system based which is an incredibly stupid idea in my opinion but hey, gotta work with what you've got right? So in short, I can't pause a database service as there isn't one. File integrity checking and the like occurs on the client software, which needs to be done each day just in case the data has been corrupted. Don't want to backup corrupt data. – Daniel Lane Sep 26 '13 at 9:16
I have it set up on a server with an SMB share for two main reasons really. The first is that it allows the software to be used around the office that I work at, and the second is that I figured I can automate the backup process via the server that holds the files. Using RDP on a schedule should work in theory, but it's a sort of chicken or the egg scenario really. It makes things more difficult and impractical. Thanks for the advice though, it definitely helps to have a second set of eyes when approaching a problem. – Daniel Lane Sep 26 '13 at 9:20

Your Answer


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

Browse other questions tagged or ask your own question.