I need to implement a tool which adds and deletes rules in Windows Firewall. The rules can be inbound or outbound, forbidding communication on specified protocols, IPs and ports. I am having trouble with making the design decision on which of the following options I'm aware of to use:
- PowerShell, as described e.g. in https://technet.microsoft.com/en-us/library/jj554906(v=wps.630).aspx . The trouble with this option is that (correct me if I'm wrong) it seems it is not supported on Windows 7, while my tool must work on Windows 7, Windows 8(.1), and desirably later versions of Windows. Also, I'm not allowed to use C#, while PowerShell doesn't integrate with C++ except (possibly, I'm not sure) via calling PowerShell process, giving it command line options and reading/writing from/to its output/input streams.
- "netsh advfirewall firewall" way. The problem with this option is that Windows 8.1 says that "netsh advfirewall" context is deprecated and may be removed from later versions of Windows. So I'm afraid that taking this way will make my tool not working on Windows 9 or 10.
- COM interfaces of Windows firewall, as in these examples https://msdn.microsoft.com/en-us/library/windows/desktop/dd339604(v=vs.85).aspx . The required C++ coding is not a problem, though it may take longer than usage of PowerShell or command line (netsh advfirewall firewall).
Which option would be the best design decision for adding/deleting Windows Firewall rules? Are there other options or advantages/disadvantages of the options I listed?