?
Solved

How do I close Windows port from Command Line?

Posted on 2010-08-24
7
Medium Priority
?
1,199 Views
Last Modified: 2012-05-10
How do I close Windows port from Command Line?
0
Comment
Question by:dennisk1718
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:clw3388
ID: 33511508
netsh will assist you in setting windows firewall exceptions..
http://support.microsoft.com/kb/875357
0
 
LVL 10

Accepted Solution

by:
jorlando66 earned 200 total points
ID: 33511532
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
 
LVL 10

Assisted Solution

by:jorlando66
jorlando66 earned 200 total points
ID: 33511567
If you are on windows 7 or server2008 use use "netsh advfirewall firewall" instead.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Assisted Solution

by:alexfarias
alexfarias earned 100 total points
ID: 33511597
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
 
LVL 3

Expert Comment

by:alexfarias
ID: 33511616
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
 
LVL 23

Assisted Solution

by:Stelian Stan
Stelian Stan earned 100 total points
ID: 33511654
If you want to close port 139

netsh firewall delete portopening TCP 139
0
 
LVL 12

Assisted Solution

by:kadafitcd
kadafitcd earned 100 total points
ID: 33511661
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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question