by November 1, 2004 0 comments



Windows Internet Connection Firewall on Win XP/2003 is a feature that can’t be readily turned off and there seems no externally visible way to easily do this. The only way to do it, apparently, is to use WMI classes and objects. 

You have PCs connected on a LAN, and a PC running Win XP or Server 2003 is connected to the Internet. For simplicity, you decided to share the Internet connectivity among other PCs using ICS (Internet Connection Sharing) that comes built-in with Windows. And for the firewall, you enable ICF (Internet Connection Firewall), also built-in. Sometime later, you want to move to RRAS (Routing and Remote Access Service) for performance reasons; but when you try running RRAS, you continuously get an error message, disable ICF from the server to configure RRAS, even after the ICF/ICS service is stopped and disabled! What’s the solution? The way out is to run a WMI script that disables
ICF.

Direct Hit!
Applies to: System administrators
USP:
Write your own VB script to disable the firewall
Links:
www.microsoft.com/technet/ scriptcenter/ 

The WMI (Windows Management Instumentation) script opens a connection to the WMI ‘HomeNet’ class. This class provides access to the Windows ICF and exists only when there are shared or firewalled network connections on that PC.

Then, we step-through each connection and explicitly set its ‘IsFirewalled’ property to False, effectively disabling the firewall.

The ‘Obj.Put_’ statement saves the settings back to WMI. The script is given below. 

Set WMI = GetObject(“WinMgmts:\root\Microsoft\HomeNet”)
Set Objs = WMI.InstancesOf(“HNet_ConnectionProperties”)
For Each Obj In Objs
Obj.IsFirewalled = False
Obj.Put_ 
Next
Source: www.mcse.ms/archive46-2004-3-5951.html

To use it, open a notepad, type in the script and save it as ‘disableICF.vbs’. Double click on the file to run it and ICF will be disabled. The firewall will be re-enabled if you change the value for ‘Obj.IsFirewalled’ to True and run the script. You can extend this script to manipulate Network Bridges (between two network adapters on the same PC), and ICS-using the IsICSPublic, IsICSPrivate, IsBridgeMember and IsBridge properties. WMI implements a vast collection of classes, each having myriad methods and properties, open to manipulation. The MSDN website (msdn.microsoft.com/library/en-us/wmisdk /wmi/ wmi _classes.asp) details each one and a wizard is available (Automate Windows Admin Tasks, PCQuest, page 38, Aug 2003) to generate scripts. We’ve put this on the PCQuest forum
(http://forums.pcquest.com).

Sanjay Majumder

Quick WMI Primer




WMI is the native architecture in all versions of 32 and 64-bit Windows that allows you to access, modify and use the internal administrative components of the OS. Many of the features that we script WMI for, are usually obscure, and otherwise, inaccessible components. These components are known as ‘WMI Classes’. There exists atleast one WMI class per Windows’ feature that you can manipulate.

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.