Windows Directory wrong on Terminal Server
Posted: Mon Jul 20, 2009 6:20 pm
I thought I would post this in case it can help someone else, or perhaps the folks at IA will make a change.
In a script, if you call Get Common Folder Location System->Windows Directory, I think most people would except C:\\WINDOWS or C:\\WINNT, or whatever it happens to be. On Server 2003 running Terminal Services, WINDIR will come out wrong. What you actually get is C:\\Documents and Settings\\username\\WINDOWS. This is decidedly unhelpful in an installer when we're trying to look in, for example, the WinSxS folder.
Previously I was told here that IA uses the windows API function GetWindowsDirectory. The Microsoft documentation says very clearly that this is what will happen on a terminal server. It also refers us to the function GetSystemWindowsDirectory which will always return the real windows directory (not the per-user one).
I respectfully suggest that InstallAware should be using GetSystemWindowsDirectory if one specifies the "Get for all users" option so that we always get the right folder even on a terminal server. As it is, the work-around is annoying because we have to require the user to go into Add/Remove programs and run our installer via Add New Programs. That puts the terminal server in "install mode", and the GetWindowsDirectory function works as expected.
In a script, if you call Get Common Folder Location System->Windows Directory, I think most people would except C:\\WINDOWS or C:\\WINNT, or whatever it happens to be. On Server 2003 running Terminal Services, WINDIR will come out wrong. What you actually get is C:\\Documents and Settings\\username\\WINDOWS. This is decidedly unhelpful in an installer when we're trying to look in, for example, the WinSxS folder.
Previously I was told here that IA uses the windows API function GetWindowsDirectory. The Microsoft documentation says very clearly that this is what will happen on a terminal server. It also refers us to the function GetSystemWindowsDirectory which will always return the real windows directory (not the per-user one).
I respectfully suggest that InstallAware should be using GetSystemWindowsDirectory if one specifies the "Get for all users" option so that we always get the right folder even on a terminal server. As it is, the work-around is annoying because we have to require the user to go into Add/Remove programs and run our installer via Add New Programs. That puts the terminal server in "install mode", and the GetWindowsDirectory function works as expected.