{"id":68943,"date":"2005-09-16T19:41:00","date_gmt":"2005-09-16T19:41:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/09\/16\/how-can-i-turn-off-the-windows-xp-service-pack-2-firewall\/"},"modified":"2005-09-16T19:41:00","modified_gmt":"2005-09-16T19:41:00","slug":"how-can-i-turn-off-the-windows-xp-service-pack-2-firewall","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-turn-off-the-windows-xp-service-pack-2-firewall\/","title":{"rendered":"How Can I Turn Off the Windows XP Service Pack 2 Firewall?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I turn off the Service Pack 2 firewall?<BR><BR>&#8212; JC<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, JC. You know, if there\u2019s a drawback to working at Microsoft (and if our manager is reading this we hasten to add that there are <I>no<\/I> drawbacks to working at Microsoft) it\u2019s this: no matter what you do some people will be glad you did it and others will be \u2026 not so glad \u2026 that you did it. The Windows Firewall released as part of Service Pack 2 is a good example of that. By default, the Windows Firewall is turned on the moment you install Service Pack 2. That made a lot of people happy; after all, without having to do anything they now had protection against hackers, crackers, and other ne\u2019er-do-wells. <\/P>\n<P>Of course, it\u2019s also true that other people &#8211; particularly those who were already running a firewall program of some kind &#8211; weren\u2019t quite as excited to find out that the Firewall was enabled by default. Unlike hot fudge sundaes or million-dollar bills, two firewalls aren\u2019t necessarily better than one. Because of that, if you\u2019ve already set up and configured your original firewall, there\u2019s a good chance that all you want to do with the Windows Firewall is get rid of it.<\/P>\n<P>So can you turn off the Windows Firewall using a script? Yes, you can, although there\u2019s one important caveat we\u2019ll talk about in a moment. For now, though, this script will disable the Windows Firewall:<\/P><PRE class=\"codeSample\">Set objFirewall = CreateObject(&#8220;HNetCfg.FwMgr&#8221;)\nSet objPolicy = objFirewall.LocalPolicy.CurrentProfile<\/p>\n<p>objPolicy.FirewallEnabled = FALSE\n<\/PRE>\n<P>As you can see, there\u2019s really not much to this; just three little lines of code. We begin by creating an instance of the <B>HNetCfg.FwMgr<\/B> object (catchy name, huh?) and then create an object reference to the Firewall\u2019s <B>CurrentProfile<\/B>. After doing that all we have to do is set the <B>FirewallEnabled<\/B> property to False, and the Firewall will be turned off. If later on you decide to turn the Firewall back on then simply set the value of FirewallEnabled to True.<\/P>\n<P>If you\u2019re thinking to yourself, \u201cWow, that\u2019s too easy; there must be a catch,\u201d well, sadly, you\u2019re right: there <I>is<\/I> a catch. For better or worse (and we\u2019ve heard conflicting arguments on both sides), the Windows Firewall cannot be managed remotely; that means that this script must run locally on the computer where you need to disable the Firewall. If you need to disable the Firewall on only a few computers you could probably just go around from machine-to-machine and run the script; alternatively, you might want to run this as a computer startup script. Definitely not the most convenient way to do things, but you don\u2019t have a lot of choice: there aren\u2019t even any command-line or GUI tools that can be used to manage the Firewall remotely. Outside of a logon or computer startup script, your only other option for remote management is to use Group Policy.<\/P>\n<P>If you\u2019d like more information about the Windows Firewall and how it can be managed using scripts, you might take a look at our <I>Tales from the Script<\/I> column <A href=\"http:\/\/null\/technet\/scriptcenter\/resources\/tales\/sg1104.mspx\" target=\"_blank\"><B>I Married Bigfoot. Oh: and Service Pack 2 Made My Computers Disappear<\/B><\/A>.<\/P>\n<P>And, yes, we <I>do<\/I> get paid to sit around all day and think up titles like that. Why do you ask?<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I turn off the Service Pack 2 firewall?&#8212; JC Hey, JC. You know, if there\u2019s a drawback to working at Microsoft (and if our manager is reading this we hasten to add that there are no drawbacks to working at Microsoft) it\u2019s this: no matter what you do some people [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[161,3,63,5],"class_list":["post-68943","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-firewall","tag-scripting-guy","tag-security","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I turn off the Service Pack 2 firewall?&#8212; JC Hey, JC. You know, if there\u2019s a drawback to working at Microsoft (and if our manager is reading this we hasten to add that there are no drawbacks to working at Microsoft) it\u2019s this: no matter what you do some people [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/68943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=68943"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/68943\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=68943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=68943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=68943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}