How to use commands to manage Windows 7 Desktop Firewall
Last Update:2018-12-07
Source: Internet
Author: User
(1) Enable the Desktop Firewall Netsh advfirewall set allprofiles state on (2) set the Default Input and Output policies Netsh advfirewall set allprofiles firewallpolicy allowinbound, allowoutbound The above is set to allow, if set to deny the use of blockinbound, blockoutbound (3) disable TCP port 139 Netsh advfirewall Firewall add rule name = "Deny tcp 139" dir = in Protocol = TCP localport = 139 action = block (4) Disable UDP port 139. Netsh advfirewall Firewall add rule name = "Deny UDP 139" dir = in Protocol = UDP localport = 139 action = block (5) disable TCP port 445 Netsh advfirewall Firewall add rule name = "Deny TCP 445" dir = in Protocol = TCP localport = 445 action = block (6) Disable UDP port 445. Netsh advfirewall Firewall add rule name = "Deny UDP 445" dir = in Protocol = UDP localport = 445 action = block (7) use the same method to disable TCP ports 21, 22, 23, 137, 138, 3389, 5800, and 5900. Netsh advfirewall Firewall add rule name = "Deny tcp 21" dir = in Protocol = TCP localport = 21 action = block Netsh advfirewall Firewall add rule name = "Deny TCP 22" dir = in Protocol = TCP localport = 22 action = block Netsh advfirewall Firewall add rule name = "Deny TCP 23" dir = in Protocol = TCP localport = 23 action = block Netsh advfirewall Firewall add rule name = "Deny TCP 3389" dir = in Protocol = TCP localport = 3389 action = block Learning computer Netsh advfirewall Firewall add rule name = "Deny TCP 5800" dir = in Protocol = TCP localport = 5800 action = block Netsh advfirewall Firewall add rule name = "Deny TCP 5900" dir = in Protocol = TCP localport = 5900 action = block Netsh advfirewall Firewall add rule name = "Deny TCP 137" dir = in Protocol = TCP localport = 137 Action = block Netsh advfirewall Firewall add rule name = "Deny TCP 138" dir = in Protocol = TCP localport = 138 action = block (8) paused after execution Pause EchoPress any key to exit 2. Restore Initial Configuration (1) restore the initial firewall settings Netsh advfirewall Reset (2) disable the Firewall Netsh advfirewall set allprofiles state off