http://qs321.pair.com?node_id=1216224


in reply to [OT] Environment variable missing for scheduled task in Windows Server 2008

Its been a while but I think what I did was made a .bat file that set the environment variable and started the perl script.
  • Comment on Re: [OT] Environment variable missing for scheduled task in Windows Server 2008

Replies are listed 'Best First'.
Re^2: [OT] Environment variable missing for scheduled task in Windows Server 2008
by Lotus1 (Vicar) on Jun 09, 2018 at 16:18 UTC

    Yes, that would work. Or I could have just passed the value as parameter to the script but then the scheduled task would need to be altered each time it is installed. Or the Perl script could have it hard coded but that makes updates a hassle. Or I could have a bat file to call the Perl script and that confuses people. I wrote the script for others to install and was trying to keep it simple for them. I set up the scheduled task and exported it. Then I documented how to create the environment variable and import the scheduled task, etc. Also, this variable will be useful to have available for future scripts. It worked fine for all the servers except one with no reboots needed. I'm expecting the problem to go away after rebooting since I found other problems on the server but I have to wait until Monday.

      Did the reboot work? I guess personally I prefer config files to using the environment for this stuff.

      EDIT: ah I see it did work. Good stuff