Handle Path Environment Variable in an Application Layer
Many users on the "Software Virtualization Solution Support Forum have stated (and you may also have noticed) that the path environment variable included in an Application layer is not displayed during layer activation.
The system Path environment variable which is stored in the registry key "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" is included
in the Base (layer) by default. When an application search for an executable explorer.exe is called to resolve the Path variable (which specifies the search path for executable files). The explorer.exe resides in the Base and the Path variable in the Base will therefore be used due to SVS default priority order.
By default there is no User Path environment variable (stored in the registry key "HKCU\Environment") defined in the Base which makes it possible to take advantage of the default priority order. When both System and User Path environment variable are specified the User Path variable value will be appended to the end of the System Path value making these two defining the Path variable. If we make sure no applications installed in the Base setting the User Path variable we can use the User Path variable in our Application layer(s) to get the result we want.
The spawned child process (explorer.exe) located outside of the Application layer will first use files & registry entries inside it's own layer (Base) and if not found it will search for existing files & registry entries in other active Application layers (apart from files located in Data layers which has the highest priority). This means, when the User Path variable is not found in the Base the User Path variable in the active Application layer will be found and used instead. If more then one Application layer includes the User Path variable the default activation and/or priority order applies.
We can both add the User Path variable using SVSAdmin or by directly modifying the Read-only sub layer for the Application layer. SVSAdmin only supports to add registry value types String, DWORD, Binary & Multi-String and the Path variable must be specified with the registry type REG_SZ or REG_EXPAND_SZ. Environment variable that is in the form that needs to be expanded (for example, %SystemDrive%) must be stored in the registry as a REG_EXPAND_SZ registry value, we will therefore add the User Path variable in the redirection area to support this form by default.
By adding the Flags (DWORD) registry entry in "HKLM\SYSTEM\Altiris\SVS" with a value of 1 SVSAdmin will display the Sublayer Info (for example, RO=1, RW=2) in the Details view (View menu -> Details) for each imported layer.
Find the Read-only (RO) Sublayer number and launch regedit.exe. Expand to the Read-only sub layer in the redirection area (for example, HKLM\SOFTWARE\fslrdr\1) and expand further down to the "HU\USER_TEMPLATE" registry key. Add the "Environment" registry key and the "Path" (REG_EXPAND_SZ / Expandable String) value with the value of "the User Path variable value" you want (for example, %ProgramFiles%\Altiris\Tools).
Any executable located in the "C:\Program Files\Altiris\Tools" directory can now be found/executed without the full path to the file from anywhere.