I have a ruby script running in the context of a scheduled task (windows server 2012r2), running as user "Administrator".
Here is the sequence of events which recreates this issue:
- Create an AWS AMI, which includes ruby script (which just logs
ENV['HOME']
to file, for example) plus windows task to run it every minute - Launch a new instance from the AMI, wait for it to do its thing
- Log in (over RDP) to the instance
One can see that before the login, ENV['HOME']
is evaluating to "C:\Users\Default", whereas afterwards it is evaluating to "C:\Users\Administrator".
The task history says that the task was run as user "SYSTEM" in both cases.
The desired (expected) behaviour is that ENV['HOME']
will always evaluate to "...\Administrator", regardless of whether a login has occurred or not.
How can this be made so?