How to Schedule a RemoteInteractive Session
A RemoteInteractive session is useful to combine the best of two worlds: Interactive (like direct user login) and scheduled (like batch mode with task scheduler).
Note: These instructions are intended for a Windows Server machine only. When you are running macros on your own machine, you can simply use auto-logon.
1. Create two user accounts: An administrator account (called admin in this text) and a standard user account (called iimrunner in this text). Both accounts need to have passwords.
2. As Administrator, create a RDP (Remote Desktop) shortcut
- a) Open RDP program.
- b) Put in iimrunner user name and password
- c) Now set "save password".
- d) Set IP address to 127.0.0.1
- e) Now use SAVE AS and save it as c:\rdp\iimrunner.rdp (Admin user must have access to this folder. Of course, any other folder and file name are ok, too.)
3. Test: Double-click RDP icon: A remote desktop session starts.
4. Now we need to schedule this session to run automatically: Go to "Control Panel"-> "Task scheduler" and create a new task:
Now here we have to create a new task .
- a) Use the Browse button to locate c:\rdp\rdp.bat (see code below!)
- b) Select when to start task. Choose "When my computer starts". To clarify: The task scheduler is only used to autostart the batch file (and thus the RDP session) after a server reboot. It does not really "schedule" anything.
- c) Enter user name and password of admin user.
- d) Now open the detailed settings dialog. UNcheck all boxes. Very important: "Stop the task if it runs for 72h" must be unchecked.
Rdp.bat file (called by task scheduler):
ping 127.0.0.1 -n 2 -w 1000 > NUL ping 127.0.0.1 -n 180 -w 1000 > NUL C:\windows\system32\mstsc.exe c:\rdp\iimrunner.rdp
The ping commands are used to create a delay after a server reboot, to make sure the server is ready to start the RDP session.
5. Last but not least, log in as iimrunner user. Create a shortcut for iimRunner.exe and drag the shortcut to iimrunner's autostart folder . Important: You must autostart iimRunner from within this user account. Do not use the task scheduler, otherwise iimRunner runs in Batch mode.
6. Done! iimRunner.exe starts automatically in the RemoteInteractive Session. You can use this session to automatically start any macro or script from any user account and/or any normal scheduled task. Just use iimInit ("-runner") inside your scripts.
The instructions are tested to work on Windows Server 2003/2008. They should also work fine with Vista/Windows 7. But if you only need to run iMacros locally on your PC, the easier Windows Autologon method will be sufficient.
This setup is much easier than it sounds and works very reliably. We have tested it with 500,000+ iMacros browser starts over months. Up to 25 instances were running at the same time on an average Win 2003 server with 2GB RAM.
The same setup is used by the award-winning AlertFox Website Monitoring service to run 1000s of iMacros tests each day.
For registered users we also have a demo server available and/or can assist you in the setup via remote login. This service is free as part of our Gold support.
Known issue with Amazon EC2 instances: The password that is encrypted on the RDP file can be decrypted only on the same machine in which it is saved. The problem is that every time you shut down and reload the Amazon image it is technically another machine and so the password is not saved. But there are workarounds:
- Use the "Terminal Service Configuration" and specify on the "Logon Settings" that you want always to use the same credential user: iimrunner and pwd.
- Or: Use the Autologon option (see below)
Related FAQ: How to run iMacros non-stop.
Alternative: Use Windows Autologon
If your PC or server is in a secure environment (e. g. a data center) there is an even easier method to create a RemoteInteractive session: Enable Autologon. This will start up the session right after your PC is booted up.
Note that when you want to connect to a console session (session 0) created by autologon via remote desktop you need the /admin command line switch:
mstsc -v: 22.214.171.124 /admin
As before, iimRunner must be started via a shortcut in the startup folder of the iimRunner user account , not via task scheduler.
We suggest to use the iimTakeBrowserScreenshot function to take automatic screenshots if an error occurs. This way you know exactly what is going on in your setup. It is also useful for debugging tricky setup issues.
Screenshots from a (web) server running iMacros non-stop: