Video Screencast Help

User Variables

Created: 28 Aug 2012 • Updated: 28 Aug 2012 | 2 comments

We are having issues with the folders and files specific to users (in the USER_TEMPLATE folder of the layer) not redirecting to users (new/existing) on the machine. The problem seems to be with the user variables resolving incorrectly. All variables except 2, seem to be directing everything to the local Administrator profile instead of the current user's. The only changes we have made to our base image are Windows and application updates. However, I don't feel like this is the issue because I ran the updates on a previously working image and the layer redirections worked as expected.

I attached the fslrdr\USERVARS files from a working and non-working machine to show where things are seemingly being redirected.

We are currently using SWV 6.1 SP7 MP2 (6.4.1550)

Comments 2 CommentsJump to latest comment

Jeremy_Hurren's picture

The USERVARS file in the layer is a cached version of an in-memory data structure that we use to variablize paths. It is possible that it has somehow gotten out of sync or corrupted, etc. You can safely delete this file and it will be regenerated. The way that this file gets generated and regenerated is by pulling the data from the registry. I will walk through a high-level overview of how this happens that may help with troubleshooting.

First, we look at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList] to get a list of profiles on the machine. We will scan this at startup, and we also watch for changes as the machine runs and profiles get added or deleted. When these happen, we look more closely at the profile to pull variable information from it.

To find variable information we start looking at [HKEY_USERS\S-1-...-1000\Software\Microsoft\Windows\CurrentVersion\Explorer] at a subkey named "Shell Folders" or "User Shell Folders" (I can't remember off the top of my head which one it is - they are very similar). We scan the values here and load them as user variables. We also watch this key for changes, adds, removals, changes to value, etc. and we load those changes into memory.

Any time this in-memory list gets updated, it should write the data back out to USERVARS so it is cached. The main purpose of USERVARS is so that we don't have to scan (potentially) hundreds of profiles for variables - basically it speeds up our load time.

Jeremy Hurren, Sr. Principal Software Engineer, Symantec

lukas879's picture

Thanks Jeremy!

I took a look at those locations and noticed that [HKEY_USERS\S-1-...-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders] wasn't getting "updated" when users logged in.

After so investigation and Googling I was able to trackdown the issue. It turns out that, in an attempt to speed up logon times, the guys here disabled some Logon events in the registry.

Apparently "Windows Desktop Update" is responsible for making the modifications to the values in the previously mentioned key, so that they reflect the currently logged on user. It turns out, running "regsvr32.exe /s /n /i:U shell32.dll" is kind of important. Once I ran that command, the USERVARS cache was immediately updated and things started working again!