Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup CreateOleObject('IISNamespace') throws exception on Windows Server 2012

I am trying to create IISSetup in the Windows Server 2012 (IIS version 8.5) through the below install script but throws error "Invalid class string". code:

var
  IIS, WebSite, WebServer, WebRoot, VDir: Variant;
  ErrorCode: Integer;
begin
  { Create the main IIS COM Automation object }
  try
    IIS := CreateOleObject('IISNamespace');
  except
    RaiseException(
      'Please install Microsoft IIS first.'#13#13'(Error ''' +
      GetExceptionMessage + ''' occurred)');
  end;
end;
like image 558
Jagan Krishnan Avatar asked Jun 28 '26 15:06

Jagan Krishnan


1 Answers

I had the same issue on a Windows Server 2008 R2 Enterprise with Service Pack 1.

procedure TForm1.Button1Click(Sender: TObject);
var
  iis: OleVariant;
begin
  iis := CreateOleObject('IISNamespace');
end;

iisnamespace

The solution for me was a missing IIS feature. One has to install the IIS 6 thingy.

(germany version, don't know english)

  • IIS 6-Verwaltungskompatibilität
    • IIS 6-Metabasiskompatibilität
    • IIS 6-WMI-Kompatibilität
    • IIS 6-Scriptingtools
    • IIS 6-Verwaltungskonsole

I am not sure but "IIS 6-Scriptingtools" should be enough.

iis features

like image 126
complete_stranger Avatar answered Jul 02 '26 04:07

complete_stranger