How to identify an existing IIS installation using an INNO installation?

I am looking for a way to determine if a user already has an installed version of IIS. If he does not, I will continue and run the installation of the IIS script.

I know what I'm doing:

  try
    IIS := CreateOleObject('IISNamespace');  
  except  
    RaiseException(ExceptionType, ‘IIS not installed. Setup will now install IIS on your machine. ’#13#13'(Error ‘’’+ExceptionParam+’’’ occured)’);  
  end;

but for some reason, my version of the compiler does not seem to recognize a RaiseException. I also tried turning on

uses  
SysUtils;  

but the compiler does not recognize SysUtils. Is there something like a registry key on which I can see if IIS is installed or not?
Any help is appreciated.

+3
source share
3 answers

Rishi RaiseException , .

procedure RaiseException(const Msg: String);

,

var
 IIS : variant;
begin    
  try
    IIS := CreateOleObject('IISNamespace');
  except
    RaiseException('IIS not installed. Setup will now install IIS on your machine');
  end;
end;
+4

Try:

[CustomMessages]
iis_title=Internet Information Services (IIS)


[Code]
function iis(): boolean;
begin
    if not RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\W3SVC\Security') then
        MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [CustomMessage('iis_title')]), mbError, MB_OK)
    else
        Result := true;
end

;

+2

IIS is always installed in% windir% \ system32 \ inetsrv, so you should check if certain files exist in this directory. For example, w3wp.exe must exist in this folder for IIS 6/7.

+1
source

Source: https://habr.com/ru/post/1775749/


All Articles