{"id":1203,"date":"2015-02-27T18:36:18","date_gmt":"2015-02-28T01:36:18","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=1203"},"modified":"2015-02-27T18:42:22","modified_gmt":"2015-02-28T01:42:22","slug":"more-netsh-firewall-command-options-in-windows","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1203","title":{"rendered":"More netsh firewall command options in Windows."},"content":{"rendered":"<p>Here is some very good information from Microsoft for the netsh command in Windows:<\/p>\n<p><a href=\"http:\/\/support.microsoft.com\/kb\/947709\" title=\"netsh info\">http:\/\/support.microsoft.com\/kb\/947709<\/a><\/p>\n<p>I have just listed a few of the commands in both the new version of the command and the old.  <\/p>\n<p>Show all the current firewall rules:<br \/>\nNew: <\/p>\n<blockquote><p>netsh advfirewall firewall show rule name=all<\/p><\/blockquote>\n<p>To disable or enable all firewall profiles (Domain,Private or Public):<br \/>\nOld: <\/p>\n<blockquote><p>netsh firewall set opmode ENABLE<\/p><\/blockquote>\n<p>Old: <\/p>\n<blockquote><p>netsh firewall set opmode DISABLE<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall set allprofiles state on<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall set allprofiles state off<\/p><\/blockquote>\n<p>To reset the firewall back to the defaults:<br \/>\nOld: <\/p>\n<blockquote><p>netsh firewall reset<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall reset<\/p><\/blockquote>\n<p>To log firewall activity:<br \/>\nOld: <\/p>\n<blockquote><p>netsh firewall set logging &#8220;C:\\FWLogs\\FW.log&#8221; 4096 ENABLE ENABLE<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall set currentprofile logging filename &#8220;C:\\FWLogs\\FW.log&#8221;<\/p><\/blockquote>\n<p>To open or close access to a network port:<br \/>\nOld: <\/p>\n<blockquote><p>netsh firewall add portopening TCP 80 &#8220;Open Port 80&#8221;<\/p><\/blockquote>\n<p>Old: <\/p>\n<blockquote><p>netsh firewall delete portopening TCP 80 &#8220;Open Port 80&#8221;<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall firewall add rule name=&#8221;Open Port 80&#8243; dir=in action=allow protocol=TCP localport=80<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall firewall delete rule name=&#8221;Open Port 80&#8243; protocol=tcp localport=80<\/p><\/blockquote>\n<p>To enable a program:<br \/>\nOld: <\/p>\n<blockquote><p>netsh firewall add allowedprogram C:\\myprograms\\myprogram.exe &#8220;Allow My Program&#8221; ENABLE<\/p><\/blockquote>\n<p>New: <\/p>\n<blockquote><p>netsh advfirewall firewall add rule name=&#8221;Allow My Program&#8221; dir=in action=allow program=&#8221;C:\\myprograms\\myprogram.exe&#8221;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here is some very good information from Microsoft for the netsh command in Windows: http:\/\/support.microsoft.com\/kb\/947709 I have just listed a few of the commands in both the new version of the command and the old. Show all the current firewall rules: New: netsh advfirewall firewall show rule name=all To disable or enable all firewall profiles [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[265,162,390],"class_list":["post-1203","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-firewall","tag-netsh","tag-window"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1203"}],"version-history":[{"count":4,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1207,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions\/1207"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}