set install path appropriate to user, admin -vs- non-admin - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

set install path appropriate to user, admin -vs- non-admin

Greetings,

I am using AI 7.6 build 27499

I have some questions about the "per-machine if user is administrator, per-user otherwise" option and how that relates to the install path. I have read the Install Parameters documentation and read many related posts on the forum.

========== Question #1 ==========

--- Project Configuration ---
* On the Install Parameters page, I selected "per-machine if user is administrator, per-user otherwise". This option automatically sets the Application Folder to "[ProgramFilesFolder][Manufacturer]\[ProductName]"
* On the Dialogs page, I added the "InstallTypeDlg" to the "First Time Install" sequence. It is listed after "WelcomeDlg" and before "FolderDlg".

--- Environment ---
* WinXP
* standard user (non-admin)

--- Steps ---
1. Run generated msi as the non-admin user.
2. On the InstallTypeDlg, the "Only for me" option is selected by default. Click "Next".
3. On the FolderDlg, the install path is populated with "C:\Program Files\[Manufacturer]\[ProductName]"

--- Expected Behavior ---
* Since the user is a non-admin and used the "Only for me" option (well, kept the default), the install path should be populated with a user-specific folder.

--- Continued Steps ---
4. From the FolderDlg, click the "Back" button.
5. Back on the InstallTypeDlg, choose the "Everybody" radio button and then click the "Next" button.
6. On the FolderDlg, the install path will still be "C:\Program Files\[Manufacturer]\[ProductName]", which is expected.
7. Go back to the InstallTypeDlg again, choose "Only for me", click Next.
8. On the FolderDlg, the install path should *now* be populated with "C:\Program Files\<user>\Local Settings\Application Data\Programs\[Manufacturer]\[ProductName]"

This seems broken, no? It seems that if the default option on InstallTypeDlg is used, the install path is populated with the default path ([ProgramFilesFolder]), rather than with the value appropriate to the user. If you move back-n-forth between InstallTypeDlg and FolderDlg, changing the default InstallType option, only then is the correct install path used.


========== Question #2 ==========

Assuming the same configuration as described in Question #1, I would like to remove the InstallTypeDlg, but keep the FolderDlg. I would like the install path shown on the FolderDlg to be populated with the "correct" path as appropriate for the user.

* If the user is an admin, the install path should be "C:\Program Files\[Manufacturer]\[ProductName]"
* If the user is a non-admin, the install path should be "C:\Program Files\<user>\Local Settings\Application Data\Programs\[Manufacturer]\[ProductName]"

(I realize those paths are slightly different across different Windows versions. I am using WinXP style paths for convenience.)

The user may manually change the install path, but the initial path should be appropriate to the user. The idea is that we provide a "recommended path" and if they change it to a folder for which they don't have sufficient permissions, that is their mistake.

Assuming the problem described in Question #1 is fixed, can I remove the InstallTypeDlg and still expect the install path on FolderDlg to be populated correctly for the user?


========== Question #3 ==========

When I run the same msi package on my Win7 machine as a non-admin user, the option selected by default on InstallTypeDlg is "Everybody". This differs from the behavior on my WinXP machine, where the default was "Only for me".

As I said earlier, I would like to avoid using the InstallTypeDlg, but if I am forced to use it (depends on the answer to Question #2) then I would like the default option to be appropriate for the current user.

* If the user is an admin, the default should be "Everybody"
* If the user is a non-admin, the default should be "Only for me"

Do I need to configure something else, or should this be calculated dynamically at install time?


========== Question #4 ==========

The Install Parameters documentation says that for the "Per Machine/User" install type,
On Windows Vista or above this option has the same installation behavior as the previous one.
The "previous one" refers to the "Per Machine" option.

To me, this statement / comparison is misleading. If I configure my project as described above, using the "InstallTypeDlg" and "FolderDlg", then the "per-machine if user is administrator, per-user otherwise" option seems to behave the same on both WinXP and Win7 (which is good - that's what I want).

Maybe I am overlooking something, but based on my testing and the configuration I have described, the documentation is misleading. I only mention it because clearer documentation (hopefully) leads to less repeat questions on the forum. :)


========== ... ==========

Sorry this is so long and contains several questions, but all the questions are closely related and it seemed silly to post a separate topic for each.

Thanks for your help!
-Todd
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: set install path appropriate to user, admin -vs- non-admin

Hi Todd,
This seems broken, no? It seems that if the default option on InstallTypeDlg is used, the install path is populated with the default path ([ProgramFilesFolder]), rather than with the value appropriate to the user. If you move back-n-forth between InstallTypeDlg and FolderDlg, changing the default InstallType option, only then is the correct install path used.
Indeed this is a bug in Advanced Installer. Thank you for bringing it to our attention. A bugfix will be included in the next release.
Assuming the same configuration as described in Question #1, I would like to remove the InstallTypeDlg, but keep the FolderDlg. I would like the install path shown on the FolderDlg to be populated with the "correct" path as appropriate for the user.
For this you can use Directory set with formatted custom actions scheduled under "InstallUISequence" -> "CostFinalize". These custom actions can be conditioned with the Privileged property and can set APPDIR to the appropriate paths:

Code: Select all

[ProgramFilesFolder][Manufacturer]\[ProductName]
or

Code: Select all

[AppDataFolder][Manufacturer]\[ProductName]
can I remove the InstallTypeDlg and still expect the install path on FolderDlg to be populated correctly for the user?
No, the default path is changed by this dialog. If it's removed, the path in "Install Parameters" page will always be the default.
When I run the same msi package on my Win7 machine as a non-admin user, the option selected by default on InstallTypeDlg is "Everybody". This differs from the behavior on my WinXP machine, where the default was "Only for me".
This is because the way Vista and Windows 7 work. On these Windows versions limited users can be elevated, so everyone is seen as an Administrator. You can try setting the MSIUSEREALADMINDETECTION property on Vista and Windows 7 so the "Privileged" property is set correctly. You can set it through a "Property set with formatted" custom action and you can use the VersionNT property to detect the Windows version.
To me, this statement / comparison is misleading. If I configure my project as described above, using the "InstallTypeDlg" and "FolderDlg", then the "per-machine if user is administrator, per-user otherwise" option seems to behave the same on both WinXP and Win7 (which is good - that's what I want).
This statement suggests that for both options on Vista and Windows 7 the installation type will be per-machine. This is true because of the way Windows Installer evaluates the "Privileged" property. This is why "Everyone" is selected by default for a limited user (per-machine is default, even for limited users).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”