Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install program shortcuts for all users?

I'm creating an installer msi file using the Windows Installer XML toolkit. When installing the created msi file, a shortcut placed under the ProgramMenuFolder folder results in a shortcut for the Administrator user only. How do I let the installer create a shortcut under the All Users profile, so that everyone on the machine has the shortcut?

like image 533
vividos Avatar asked Apr 15 '09 10:04

vividos


People also ask

How do I install programs on Windows all users?

Just make a shortcut in the folder for all users (right click on the start menu, or the All Program and choose Open All Users).

How do I put icons on all users desktop Windows 10?

To work around this, go into C:\Users\Public\Desktop and delete all the program icons. Then each of you will have to respectively go to the program folders that contains the program executables > right-click > Send to > Desktop (create shortcut) to create the program icons/shortcuts on your respective desktops.


2 Answers

Based on the SampleFirst.wxs in the WIX Tutorial http://www.tramontana.co.hu/wix/lesson1.php there were two parts that I changed.

First, add the property ALLUERS = 1 "". That installs the shortcut to the all users profile as others have noted.

Second, change the root for the registry value for Component 'ProgramMenuDir' to HKMU. The installer will decide if it should use HKLM (Local Machine) or HKCU (Current User) at install time, based on the on the ALLUSERS property.

You should then be able to add dialogs to modify the ALLUSERS property, with the registry root changing accordingly.

<?xml version="1.0" encoding="utf-8"?>
<!-- Original Source available at "http://www.tramontana.co.hu/wix/download.php?file=samples/samplefirst.zip&type=application/zip" 
  This version has been modified for a local machine install (all users) vs a user install-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Name="Foobar 1.0" Id="YOURGUID-CD32-4B20-BB4F-58A5C3B21A7C" UpgradeCode="YOURGUID-EDCE-42A2-9DA2-59FB08AC4FA6" Language="1033" Codepage="1252" Version="1.0.0" Manufacturer="Acme Ltd.">
        <Package Id="*" Keywords="Installer" Description="Acme's Foobar 1.0 Installer" Comments="Foobar is a registered trademark of Acme Ltd." Manufacturer="Acme Ltd." InstallerVersion="100" Languages="1033" Compressed="yes" SummaryCodepage="1252" />
        <Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
        <Property Id="DiskPrompt" Value="Acme's Foobar 1.0 Installation [1]" />
        <Property Id="ALLUSERS" Value="1" />
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Id="Acme" Name="Acme">
                    <Directory Id="INSTALLDIR" Name="Foobar 1.0">
                        <Component Id="MainExecutable" Guid="YOURGUID-2191-4A98-806B-2554B0DD8FC3">
                            <File Id="FoobarEXE" Name="FoobarAppl10.exe" DiskId="1" Source="FoobarAppl10.exe" KeyPath="yes">
                                <Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" WorkingDirectory="INSTALLDIR" Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
                                <Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Name="Foobar 1.0" WorkingDirectory="INSTALLDIR" Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
                            </File>
                        </Component>
                        <Component Id="HelperLibrary" Guid="YOURGUID-7BA7-4BD1-90B9-C0DFC21674B1">
                            <File Id="HelperDLL" Name="Helper.dll" DiskId="1" Source="Helper.dll" KeyPath="yes" />
                        </Component>
                        <Component Id="Manual" Guid="YOURGUID-F60A-48D6-83FD-44ED01AA579A">
                            <File Id="Manual" Name="Manual.pdf" DiskId="1" Source="Manual.pdf" KeyPath="yes">
                                <Shortcut Id="startmenuManual" Directory="ProgramMenuDir" Name="Instruction Manual" Advertise="yes" />
                            </File>
                        </Component>
                    </Directory>
                </Directory>
            </Directory>
            <Directory Id="ProgramMenuFolder" Name="Programs">
                <Directory Id="ProgramMenuDir" Name="Foobar 1.0">
                    <Component Id="ProgramMenuDir" Guid="YOURGUID-2D4F-443F-9ADA-563DB3C1581F">
                        <RemoveFolder Id="ProgramMenuDir" On="uninstall" />
                        <RegistryValue Root="HKMU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
                    </Component>
                </Directory>
            </Directory>
            <Directory Id="DesktopFolder" Name="Desktop" />
        </Directory>
        <Feature Id="Complete" Level="1">
            <ComponentRef Id="MainExecutable" />
            <ComponentRef Id="HelperLibrary" />
            <ComponentRef Id="Manual" />
            <ComponentRef Id="ProgramMenuDir" />
        </Feature>
        <Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />
        <UI />
    </Product>
</Wix>
like image 63
mcdon Avatar answered Oct 06 '22 01:10

mcdon


In the Package element, add an InstallScope attribute like this:

InstallScope='perMachine'
like image 32
Wim Coenen Avatar answered Oct 06 '22 01:10

Wim Coenen