• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1423
  • Last Modified:

How do I close Windows port from Command Line?

How do I close Windows port from Command Line?
0
dennisk1718
Asked:
dennisk1718
5 Solutions
 
clw3388Commented:
netsh will assist you in setting windows firewall exceptions..
http://support.microsoft.com/kb/875357
0
 
jorlando66Commented:
From command line

To view ports open through the Windows Firewall
netsh firewall show portopening

To open a specific port from the command line
netsh firewall add

To close a specific port form the command line:
netsh firewall delete
0
 
jorlando66Commented:
If you are on windows 7 or server2008 use use "netsh advfirewall firewall" instead.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
alexfariasCommented:
See if that helps. Just replace "enable the" disable "and Appends the port you want. Save the file as. Bat

@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE
0
 
alexfariasCommented:
See if that helps. Just replace "enable" for "disable" and Appends the port you want. Save the file as. Bat

@echo =========  disabling unused ports  ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE
0
 
Stelian StanNetwork AdministratorCommented:
If you want to close port 139

netsh firewall delete portopening TCP 139
0
 
kadafitcdCommented:
Here's a link for a more in depth look at the netsh commands:  http://technet.microsoft.com/en-us/library/bb490617.aspx

Good Luck HTH.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now