BillM
Posts: 20
Joined: Thu Jan 08, 2015 3:35 pm

How to modify existing but disabled firewall rule?

I have a situation where I need to change the status of an existing Windows Firewall rule. The Windows Management Instrumentation (WMI-In) and (WMI-Out) are existing rules but disabled. I want to enable them without adding a new rule. I can't see a way to change an existing system rule or even add a rule for an EXE that isn't part of the package. It's looking like I'll have to hack this programmatically. Is that correct?

Edit: Nevermind. I found my own answer 2 minutes after posting this. For anyone else, I use a Run Windows Powershell Script deferred action just before Finish Execution:

Code: Select all

enable-NetFirewallRule -DisplayName "Windows Management Instrumentation (WMI-In)"
enable-NetFirewallRule -DisplayName "Windows Management Instrumentation (WMI-Out)"
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to modify existing but disabled firewall rule?

Hello,

Please note that in the Firewall Exceptions Tab you can add a new firewall rule and add the full path to the existing .EXE file (e.g. [SystemFolder]svchost.exe) in the Program Path field.

Using a custom action is not the recommended approach as you also need to add the rollback functionality. In case of an error during installation, you need to leave the environment unchanged. Also, in case of an uninstall, you need to revert the changes. Read more about the execution time of a custom action in the Setting execution time for custom actions article.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”