Scheduled Tasks and Environment Variables
I have a scheduled task, a batch file, that uses an environment variables which is set system-wide.
On server 1, the scheduled task runs under a domain account and the environment variable works. The environment variable also exists in my session and when I runas as the service account.
On server 2, the scheduled task runs under a different domain account and the environment variable DOES NOT work. However, the environment variable does exist in my session and when I runas as the service account.
On both servers the environment variable has been set system-wide by the same script originally. The script runs again every now and then and as far as I can see noone has tempered with the environment variable.
The scheduled tasks are set up identically on the two servers (using the same XML file) and the two service accounts are identically configured (as far as I know).
What am I doing wrong?
I solved the problem by allowing the scheduled task to "run with highest privileges" on both servers.
I don't know why that helps but apparently on server 2 the domain account just doesn't see the environment variables when not run with highest privileges.