How to select files to copy as per operating system version in Inno Setup? - inno-setup

I have built an installer with Inno setup. Recently it was found that some applications do not work in Windows XP. These applications work fine with Windows 7 onward. I need to copy files as per Windows version user is installing on and create program menu shortcuts accordingly. How can I implement this?

All sections have MinVersion parameter, which you can use to limit a specific section entry to a specific minimal version of Windows:
[Files]
Source: "NeedsWin7.exe"; DestDir: "{app}"; MinVersion: 6.1
[Icons]
Name: "{group}\Needs Win 7"; Filename: "{app}\NeedsWin7.exe"; MinVersion: 6.1

Related

Has Inno Setup dropped support for images inside RTF files for Windows 10?

I've recently migrated from Windows 7 to Windows 10 and a specific issue has shown up in Inno installers.
Whenever I create an installer and use the directive InfoBeforeFile and specify a RTF file containing images, those images are not shown.
This began to happen after I migrated to Windows 10 LTSC.
I'm currently using Inno Setup Compiler version 6.2.1, but I'm also experiencing this on older versions too.
Has someone experienced the same?
Thanks.
Following is the code and some images.
Code Snipet:
#define MyAppName "My Program"
#define MyAppVersion "1.5"
[Setup]
AppId={{00000000-0000-0000-0000-000000000000}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
InfoBeforeFile=Pics.rtf
OutputDir=c:\
OutputBaseFilename=mysetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Files]
Source: "*"; DestDir: "{app}"; Flags: ignoreversion
RTF File contents:
Output of Inno Installer:
Link to RTF file:
Pics.RTF
When I open your .rtf file in WordPad, it displays this warning:
When I refuse to display the blocked contents, it does not display the images:
I'm sure that's the same reason, why the images do not display in Inno Setup. Make sure your document does not contain any untrusted contents.
After few tests, it seems that it is caused by images inserted into the document in Microsoft Word. Inserting the same images in WordPad cause no problems.

In Inno Setup Scripting, how to check windows version and copy corresponding files [duplicate]

I have built an installer with Inno setup. Recently it was found that some applications do not work in Windows XP. These applications work fine with Windows 7 onward. I need to copy files as per Windows version user is installing on and create program menu shortcuts accordingly. How can I implement this?
All sections have MinVersion parameter, which you can use to limit a specific section entry to a specific minimal version of Windows:
[Files]
Source: "NeedsWin7.exe"; DestDir: "{app}"; MinVersion: 6.1
[Icons]
Name: "{group}\Needs Win 7"; Filename: "{app}\NeedsWin7.exe"; MinVersion: 6.1

Execute different command in Inno Setup Run section based on Windows version

I need to know if the Windows is XP, 7, 8, 2003, 2008 or 2012, because depends on version I will run a specific command.
I tried to install IIS in Windows 2008, but it did not work. I tried in Windows 2012 and it worked normally.
Filename: pkgmgr; Parameters: "/iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-Performance;IIS-ManagementConsole;IIS-WindowsAuthentication;IIS-WebServer;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;IIS-ASPNET;NetFx4Extended-ASPNET45;IIS-ASPNET45;IIS-NetFxExtensibility45;NetFx4Extended-ASPNET45"; Flags: 64bit; Check: IsWin64
I had to run this manually in Windows 2008:
start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-ASPNET;IIS-HttpLogging;IIS-NetFxExtensibility;IIS-HttpErrors;IIS-DefaultDocument;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-StaticContent;IIS-ManagementConsole;IIS-DirectoryBrowsing;IIS-WindowsAuthentication;IIS-WebServer;
Use the MinVersion and OnlyBelowVersion parameters in the [Run] section:
[Run]
; for Windows 2012 and newer:
Filename: pkgmgr; Parameters: "/iu:..."; MinVersion: 6.2
; for older versions (Windows 2008)
Filename: pkgmgr; Parameters: "/iu:..."; OnlyBelowVersion: 6.2
Learn the Windows version numbers.

How can I install IIS on Windows Server 2012 R2 using InstallShield

I want to activate IIS on Windows Server 2012 via InstallShield setup. I tried the following DISM command:
DISM.EXE /enable-feature /online /featureName:IIS-WebServerRole /featureName:IIS-WebServer
Described here: Installing IIS 8.5 on Windows Server 2012 R2
When I execute my Setup, an error occurs:
The Process Monitor says, that DISM will be executed in C:\Windows\SysWOW64\DISM.EXE and results in Exit Status 11. As File Location I used [SystemFolder]. When I define File Location C:\Windows\System32 it also uses C:\Windows\SysWOW64\DISM.EXE.
What is a tough way to activate IIS?
Per this post, error code 11 indicates that the 32-bit version of DISM is being used on a 64-bit system. This corresponds with installing a 32-bit MSI on a 64-bit system and using it to locate and launch DISM. Windows Installer does not allow you to refer to 64-bit locations from a 32-bit MSI. Heath Stewart's article Different Packages are Required for Different Processor Architectures touches on this, but mostly from the angle of installing to 32- or 64-bit locations. As it turns out, finding files there is just as hard.
In order to launch a 64-bit DISM from a 64-bit location, you will need some other code. It may be possible to locate the 64-bit system folder from 32-bit code, but I know some 64-bit locations can only be correctly queried by 64-bit code. As such I would suggest you write a 64-bit helper exe to find and launch the 64-bit DISM. Then you will need two variants of your custom action so that you only try to use the 64-bit wrapper on a 64-bit system (when VersionNT64 is defined) and use a 32-bit wrapper or direct call on a 32-bit system.
Alternately, if upgrading and using an exe is an option, InstallShield 2013 and later include support for installing Windows Features as part of the Suite project type, which will thus handle this work for you. (Disclaimer: I am paid to work on InstallShield.)

InstallShield installs to SysWOW64 and not in System32

I'm creating a InstallShield 2012 Spring project, and I need to copy some jpg into System32 subfolder.
In Application Data/Files and Folders, I put that into [WindowsFolder]/System32/akrmf and when install, it copies to SysWOW64/akrmf on Windows 7
The installation project doesn't include any exe or dll, only text files and images.
I tried using [SystemFolder] and copies into SysWOW64 too.
Is there any way to force installation into System32/akrmf folder ?
Thanks
To target the true (64-bit) system folder with Windows Installer, your MSI needs to be a 64-bit package (see Targeting 64-bit Operating Systems). Unfortunately this prevents it from installing on 32-bit systems.
To do this with InstallScript, there are related approaches that do not require creating two separate packages, but you may find it easiest to create two different components where only one is selected for installation.

Resources