Many times you have to install files in folders located in user profiles. This kind of files has to be installed on each user logged on.

In order to do that, you have to set up the Active Setup option for this package. The Active Setup will run Per-User repair at user first logon. 

If the files are set in the File table inside the MSI database to be installed directly on User profile folder the MSI will take the file from CAB and will install the file in the designated folder. The main issue with this solution is that the MSI needs CAB every time when the Active Setup is running. This is not so good because when we deploy the package from SCCM the original MSI is not kept in the CCMCache folder so the CAB is not available on the machine and in order to have a successfully Per-User repair the MSI have to be downloaded every time from Distribution point. This is translated into a big consumption of resources.

-          Using this solution two ICE messages will appear all the time due to file installed directly per-user: ICE38 and ICE91

o   ICE38: Component Component1 installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file. – This error can be solve by creating a per-user registry entry in Registry table, assign it to the component and set it as Key Path. An existing HKCU registry entry can be used if exists in Registry table.

o   ICE91: The file 'file.txt' will be installed to the per user directory '[2]' that does not vary based on ALLUSERS value. This file won't be copied to each user's profile even if a per machine installation is desired. – this warning will persist and you cannot solve it if you are using this method to install the file in User profile.

In order to avoid the MSI to ask for CAB every time when is running repair or self-healing per user follow the bellow guide to handle this kind of files. Using this solution all the ICE messages related to per-users components and files are eliminated and the CAB is not required when the per-user repair is performed.

1.       Install all the files in a per-system folder, in C:\Program Files (x86)\[INSTALLDIR] or C:\Apps\[INSTALLDIR] folder for example.

·         If the files are already included in installation, you can change the installation location from Component table; just change the installation folder in the “Directory_” column, if you want to install the files included in a specific component in INSTALLDIR just simply change the “Directory_” to be INSTALLDIR;

2.       Set up the Active Setup for the package.

·         Create the Active Setup registry keys in Registry table:

RegistryRootKeyNameValueComponent
Registry1
2Software\Microsoft\Active Setup\Installed Components\[ProductCode]_EUC
Version
1,0ActiveSetup
Registry2
2Software\Microsoft\Active Setup\Installed Components\[ProductCode]_EUC
Stubpath
msiexec  /fomus [ProductCode] /qn
ActiveSetup
Registry3
2Software\Microsoft\Active Setup\Installed Components\[ProductCode]_EUC

[ProductName]
ActiveSetup

·         [ProductCode] – Will use the ProductCode property set up in the Property table

·         Very important: Use “omus” option for repair command line in order to run all the actions from InstallExecuteSequence

 

·         Create the ActiveSetup component in the Component table:

ComponentComponentIDDirectory_AtributesConditionsKeyp







·         Assign the ActiveSetup component to a Feature in FeatureComponents table:

Feature_

Component_

FeatureName

ActiveSetup

 

3.       Create an entry in MoveFile table for each file you want to be copy during MoveFiles action to user-profiles.

FileKeyComponent_SourceNameDestNameSourceFolderDestFolderOption
MoveFile1
AllOtherFiles
Example1.txt
Example1.txt
INSTALLDIR
USERPROFILE
0
MoveFolder1
AllOtherFiles
*
INSTALLDIR
USERPROFILE
0

·         Options: 0 = copy files; 1 = move files.

·         The MoveFiles action is executed before InstallFiles action and is simply copy or moving a file from a Source folder to another folder.

·         Very important: this action is running during repair only if the “omus” options are set is not running if you are use only the “u” option.

·         Using wildcards we can copy all the files from a specified folder (SourceFolder) to destination folder (DestFolder)

·         We can rename the file using the DestName field or if we leave the DestName blank the copied will have the same name as the original file

·         More information about MoveTable here: https://msdn.microsoft.com/en-us/library/aa370055(v=vs.85).aspx

 

4.       Create an entry in DublicateFile table; this table is duplicating the original file installed in PerSystem folder on any other folder.

·         The MoveFiles action is working only with files already installed in the machine, will not move files installed during current executing sequence.

·         The DuplicateFile is used to copy per-user files during installation. This action is using the files included in MSI CAB.

FileKey

Component_

File_

DestName

DestFolder

File1

AllOtherFiles

Exemple1.txt

EXEMPL~1|Exemple1.txt

USERPROFILE

·         The File has to be the key specified in File table for desired file to be duplicated.

·         DestName: Localizable name to be given to the duplicate file. If this field is blank, then the destination file is given the same name as the original file.

·         More information about DuplicateTable here: https://msdn.microsoft.com/en-us/library/aa368335(v=vs.85).aspx