| Login

Search this Blog


Links I like to keep around


Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Feb16

Written by:R Teachout
2/16/2010 12:43 PM 

To add environment variable overrides, so IIS doesn’t read the system environment variables, but rather reads it from a reg key
Do the following (from a dos prompt, or manually but the key in)

REG.EXE add "HKLM\SYSTEM\CurrentControlSet\Services\IISADMIN\Parameters\Environment" /v TMP /t REG_SZ /d "C:\windows\temp" /f

REG.EXE add "HKLM\SYSTEM\CurrentControlSet\Services\IISADMIN\Parameters\Environment" /v TEMP /t REG_SZ /d "C:\windows\temp" /f

Then do an ‘iisreset’ / restart IIS to force IIS to re-read the variables and activate it.

VOILA !


I found this when troubleshooting a Microsoft Jet DB error.  Jet uses environment variables for “TEMP” which in recent SP’s for Windows 2003 get set to ‘%CURRENTUSER%\Application Data\Temp” which doesn’t exist for “Network Services” or whatever the IIS app pool is running as, so the easy override is to force it back to c:\windows\temp.
Note: Sometimes, the temp variables get reset when adding new applications/sites to IIS, or when doing some windows updates, so the reg keys above ensure you don’t unknowingly screw yourself by doing what would be an “unrelated” change that messes up your env vars.

Reasoning:

IIS gets env vars from services.exe which only gets updated on a reboot.  Normally, you would just update your env vars, and reboot to activate them.

Using the above override tells a particular service to use special variables. Then just restarting that service gets those updates.. (note, doesn't work for all services, but does appear to work for IIS6 perfectly)

 

Enjoy!

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment  Cancel 

Even as a longtime critic of the company, I must admit that Microsoft occasionally flirts with the truth. Well, perhaps 'flirt' is too strong a word. Let's just say Microsoft sometimes honks and waves as it drives by her house.
-InfoWorld Editor Nicholas Petreley, 06-14-99

Inspired by Nina