So writing a C# program which will require network access, thus needing to add a rule to Windows Firewall.
Here is the code:
Console.WriteLine("Firewall not yet configured, doing now.");
PowerShell allowtorthroughwindowsfirewallinbound = PowerShell.Create("New - NetFirewallRule - DisplayName ""Allow TOR through Windows Firewall"" - Direction Inbound - Program ""C:\ProgramData\chocolatey\bin\tor.exe"" - Action Allow;')");
allowtorthroughwindowsfirewallinbound.Invoke();
Problem though,the “create” throws the following error:
Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method ‘Create’ takes 5 arguments TorRunner C:TorRunnerTorRunnerProgram.cs 64 Active
I can only assume the string is formatted incorrectly, so what would be the correct string format for creating a firewall string that would add a windows firewall rule with a name?
Thanks.