Lokesh
Lokesh

Reputation: 359

How to check IIS 7 or 7+ is installed or not using innosetup?

I want to check whether IIS 7 or 7+ is installed or not before my main installation starts in innosetup. If IIS7 or 7+ is not available,an alert should be shown. What condition i need to check? can i get any function to achieve this task?

Upvotes: 2

Views: 1912

Answers (1)

TLama
TLama

Reputation: 76713

Based on this example for NSIS, you might try the following code. The IsIIS7AboveInstalled function should return True if IIS at least in version 7 is installed, False otherwise:

[Code]
const
  IISRegKey = 'SOFTWARE\Microsoft\InetStp';

function GetIISVersion(var MajorVersion, MinorVersion: DWORD): Boolean;
begin
  Result := RegQueryDWordValue(HKLM, IISRegKey, 'MajorVersion', MajorVersion) and
    RegQueryDWordValue(HKLM, IISRegKey, 'MinorVersion', MinorVersion);
end;

function IsIIS75AboveInstalled: Boolean;
var
  MajorVersion: DWORD;
  MinorVersion: DWORD;
begin
  Result := GetIISVersion(MajorVersion, MinorVersion) and (MajorVersion >= 7);
end;

Upvotes: 2

Related Questions