How to get Rid of Windows Task Scheduler Password Issue with Amazon EC2 Instance

If you have tasks scheduled on a Windows 2003 or 2008 Server instance running on Amazon Elastic computing cloud (EC2) you may run into a problem. If your scheduled tasks are enabled (“run only if logged on” check box is ticked off) to be run even when an user is not logged on you have to set an user id and password so that the scheduler service use that credential to run your tasks even if you are not logged on. The “Run as” box stores the user id as MachineName\UserID. However, the problem is every time you reboot or restart your instance the default behavior of Amazon EC2 assigns a new machine name to your machine. The machine name is defaulted to the convention ip-PrivateIP. This cause the scheduler tasks to be assigned to invalid user credential and the tasks won’t execute even though they will be triggered.

Fortunately we can resolve this issue. The trick is Amazon allows us to configure a fixed machine name so that it wont change after restart. To do that go to “C:\Program Files\Amazon\Ec2ConfigService folder on your EC2 machine and run the EC2ConfigServiceSettings.exe. Tick off the check box under “Set Computer name”. Now change your computer name to your choice (edit My Computer properties) and restart your instance. When the machine is up, right click on one of your scheduled tasks and select properties. Edit the User name (to reflect the new machine name), click on Set Password and re-enter your password. All other tasks credential will be automatically updated and you are doen. Next time you reboot or restart your scheduled tasks will be executed properly without any password issue as your machine name won’t change.

Leave a comment