1
votes

I want to convert a folder to an application with IIS using Inno Setup.

I found that I can do it with PowerShell, using

ConvertTo-WebApplication 'IIS:\Sites\Default Web Site\MY_APP'

I have added this to my Inno Setup script:

[Run]
Filename: "powershell.exe"; \
  Parameters: "-ExecutionPolicy Bypass -Command ConvertTo-WebApplication 'IIS:\Sites\Default Web Site\MY_APP'" \
  WorkingDir: {app}; Flags: runhidden 

But PowerShell is failing with:

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154 Class not registered

1

1 Answers

1
votes

As Inno Setup in a 32-bit application, it will by default run 32-bit version of PowerShell, which in turn will use 32-bit COM classes.

The COM class needed for ConvertTo-WebApplication seems to be available (or registered) for 64-bit only.

Add the Flags: 64bit to make Inno Setup use 64-bit version of PowerShell.

[Run]
Filename: "powershell.exe"; \
  Parameters: "-ExecutionPolicy Bypass -Command ConvertTo-WebApplication 'IIS:\Sites\Default Web Site\MY_APP'" \
  WorkingDir: {app}; Flags: runhidden 64bit

Or use the 64-bit install mode.


For a similar question, see A command in a .bat file is unrecognized when the .bat file is called from an Inno Setup but works fine when I run the bat file manually.