Skip to main content

block all .zip .rar .mov top level domains

$blockedTLDs

current = @(".zip", ".rar", ".mov") $firewallRuleName = "BlockTLDsRule" $firewallRuleDescription = "Block outgoing connections to specified TLDs" $firewallRuleGroup = "BlockTLDsGroup" $firewallRuleAction = "Block" $firewallRuleDirection = "Outbound" $firewallRuleProtocol = "Any" $firewallRuleProfile = "Any" $firewallRuleProgram = "Any" $firewallRuleLocalAddresses = "*" $firewallRuleRemoteAddresses = "*." + ($blockedTLDs -join ",*.") $firewallRule = New-Object -ComObject HNetCfg.FwRule $firewallRule.Name = $firewallRuleName $firewallRule.Description = $firewallRuleDescription $firewallRule.Grouping = $firewallRuleGroup $firewallRule.Action = $firewallRuleAction $firewallRule.Direction = $firewallRuleDirection $firewallRule.Protocol = $firewallRuleProtocol $firewallRule.LocalAddresses = $firewallRuleLocalAddresses $firewallRule.RemoteAddresses = $firewallRuleRemoteAddresses $firewallRule.Profiles = $firewallRuleProfile $firewallRule.ApplicationName = $firewallRuleProgram $firewallPolicy = New-Object -ComObject HNetCfg.FwPolicy2 $firewallPolicy.Rules.Add($firewallRule)

 research
impossible