I need to register an HTTP port after installation, but I guess this could be abstracted to generally executing any command line command. Here's what I've got so far:
<CustomAction Id="ExecPortOpen" Directory="INSTALLFOLDER" Execute="immediate" ExeCommand="cmd.exe "netsh http add urlacl url=http://+:1234/ user=Everyone"" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="ExecPortOpen" After="InstallFinalize" />
</InstallExecuteSequence>
This just opens a command prompt mid-install and does nothing with it. I've tried adding /c (I have no idea what it does) inbetween cmd.exe and the command but that just opens and closes the command prompt without executing the command. How do I make this work? I'm using WiX 3.8.
Solved myself, was actually an UAC/ permissions issue. For any interested parties here is the working code:
<CustomAction Id="ExecPortOpen" Directory="INSTALLFOLDER" Execute="commit" Impersonate="no" ExeCommand="cmd.exe /c "netsh http add urlacl url=http://+:1234/ user=Everyone"" Return="check" />
<InstallExecuteSequence>
<Custom Action="ExecPortOpen" After="InstallInitialize" />
</InstallExecuteSequence>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With