If your installer needs to install some files under each user profile, among the self-healing and active setup mechanism, there is always the custom actions approach.
In this thread will exemplify how to configure the installer to deliver a file under each user's profile (both registered and next users) using a .bat file. the content of the bat file can be something as follow:
Basically, the script loop through the folders in C:\Users excluding system folder. For each existing user, it will check the existence of the specified directory. If the sub-directory does not exist, it will be created and the config file will be copied at that location. For details, you can also check the xcopy article and How to launch a CMD or BAT file.
Code: Select all
FOR /f "tokens=*" %%G in ('dir /b /a:d-s-l "%SystemDrive%\Users"') DO ( IF /I NOT "%%G"=="Public" ( IF NOT EXIST "%SystemDrive%\Users\%%G\AppData\Roaming\MyCompany\demoFile.config" md "%SystemDrive%\Users\%%G\AppData\Roaming\MyCompany" xcopy.exe %1 "%SystemDrive%\Users\%%G\AppData\Roaming\MyCompany" /C /I /Q /R /K /Y ) )
A very nice thing that the script does, is that it will copy the related config file under the Default profile. That means, any future created user on the machine will end having the config file under his profile. The Default user profile is used as a template when creating future users account on the machine.
Now, let's configure the project to implement this. For this case, I've created a demo installer that installs a shortcut to the Updater on the Desktop. It simply checks if a new version of Advanced Installer is available.
Since the config file will be copied by the .bat file, then you can add both bat file and config file as temporary files. You can read more about temp files in the Temporary Files Operations in the Files and Folders Page article. To launch the .bat file, you can use the predefined launch file custom action: Of course, you can use the VBScript or a PowerShell custom action to implement this functionality or create your custom action as a custom action written in C# or a custom action written in C++.
The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file.