Group Policy to Disable ICF

A

Andy

Is there a way to define a group policy to disable the
Internet Connection Firewall while on the corporate LAN?
 
B

Buz [MSFT]

Hello Andy,


Here is a script you can push down that will ENABLE ICF:


<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>


The following jscript will allow one to enable ICF:


NCCF_FIREWALLED = 0x0400;

Main()

function Main()
{
var objShare = new ActiveXObject("HNetCfg.HNetShare.1");
if (objShare == null)
WScript.Echo("Failed to Create HNetCfg.HNetShare object");
else
GetFirewall(objShare);
return;
}

function GetFirewall(objShare)
{
var objEveryConnection = objShare.EnumEveryConnection;
if (objEveryConnection == null)
WScript.Echo( "Failed to enumerate EveryConnection");
else {
var objEveryEnum = new Enumerator(objEveryConnection);
if (objEveryEnum == null)
WScript.Echo("Failed to create enumerator");
else {
for (objEveryEnum.moveFirst(); !objEveryEnum.atEnd();
objEveryEnum.moveNext())
{
var objNetConnection = objEveryEnum.item();
if (objNetConnection == null)
WScript.Echo ("failed to get NetConnection");
else {
var objNetConnectionProps = objShare.NetConnectionProps(objNetConnection);
if (objNetConnectionProps == null)
WScript.Echo ("Failed to get property")
else {
var str=""
str += "Name: " +objNetConnectionProps.Name;
WScript.Echo(str);
str = "Guid: " +objNetConnectionProps.Guid;
WScript.Echo(str);
str = "Device: " +objNetConnectionProps.DeviceName;
WScript.Echo(str);
str = "Status: " +objNetConnectionProps.Status;
WScript.Echo(str);
str = "MediaType: " +objNetConnectionProps.MediaType;
WScript.Echo(str);


if (objNetConnectionProps.Characteristics & NCCF_FIREWALLED)
WScript.Echo ("Firewall Enabled")
else {
var objShareConfig = objShare.INetSharingConfigurationForINetConnection
(objNetConnection)
WScript.Echo ("Firewall Disbled")
if(objShareConfig != null) {
WScript.Echo ("Enabling Firewall");
objShareConfig.EnableInternetFireWall();
} else {
WScript.Echo("failed to get ShareConfig");
}
}
WScript.Echo("")
}
}
}
}
}
}


<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>

Buz Brodin
MCSE NT4 / Win2K
Microsoft Enterprise Domain Support

Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
 
T

Ted

Cool - it works!
How would the command
objShareConfig.EnableInternetFireWall();
be changed to disable the ICF?

-----Original Message-----
Hello Andy,


Here is a script you can push down that will ENABLE ICF:


<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
 
B

Buz [MSFT]

Well Ted to be honest with you I have no idea.

I asked around and was given this though:


===============Start========================
NCCF_FIREWALLED = 0x0400;

Main()

function Main()
{
var objShare = new ActiveXObject("HNetCfg.HNetShare.1");
if (objShare == null)
WScript.Echo("Failed to Create HNetCfg.HNetShare object");
else
GetFirewall(objShare);
return;
}

function GetFirewall(objShare)
{
var objEveryConnection = objShare.EnumEveryConnection;
if (objEveryConnection == null)
WScript.Echo( "Failed to enumerate EveryConnection");
else {
var objEveryEnum = new Enumerator(objEveryConnection);
if (objEveryEnum == null)
WScript.Echo("Failed to create enumerator");
else {
for (objEveryEnum.moveFirst(); !objEveryEnum.atEnd();
objEveryEnum.moveNext())
{
var objNetConnection = objEveryEnum.item();
if (objNetConnection == null)
WScript.Echo ("failed to get NetConnection");
else {
var objNetConnectionProps =
objShare.NetConnectionProps(objNetConnection);
if (objNetConnectionProps == null)
WScript.Echo ("Failed to get property")
else {
var str=""
str += "Name: " +objNetConnectionProps.Name;
WScript.Echo(str);
str = "Guid: " +objNetConnectionProps.Guid;
WScript.Echo(str);
str = "Device: "
+objNetConnectionProps.DeviceName;
WScript.Echo(str);
str = "Status: " +objNetConnectionProps.Status;
WScript.Echo(str);
str = "MediaType: " +objNetConnectionProps.MediaType;
WScript.Echo(str);


if (objNetConnectionProps.Characteristics &
NCCF_FIREWALLED)

WScript.Echo ("Firewall Enabled")
else {
var objShareConfig =
objShare.INetSharingConfigurationForINetConnection (objNetConnection)
WScript.Echo ("Firewall Disbled")
if(objShareConfig != null) {
WScript.Echo ("Enabling Firewall");
objShareConfig.EnableInternetFireWall();
} else {
WScript.Echo("failed to get ShareConfig");
}
}
WScript.Echo("")
}
}
}
}
}
}


===============End========================


I am not a big scripting guy, let me know if that works.



Buz Brodin
MCSE NT4 / Win2K
Microsoft Enterprise Domain Support

Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
 
T

Ted

objShareConfig.DisableInternetFireWall()
works for disabling the ICF

Thanks for your help.
Ted

-----Original Message-----
Well Ted to be honest with you I have no idea.

I asked around and was given this though:


===============Start========================
NCCF_FIREWALLED = 0x0400;

Main()

function Main()
{
var objShare = new ActiveXObject ("HNetCfg.HNetShare.1");
if (objShare == null)
WScript.Echo("Failed to Create HNetCfg.HNetShare object");
else
GetFirewall(objShare);
return;
}

function GetFirewall(objShare)
{
var objEveryConnection = objShare.EnumEveryConnection;
if (objEveryConnection == null)
WScript.Echo( "Failed to enumerate EveryConnection");
else {
var objEveryEnum = new Enumerator (objEveryConnection);
if (objEveryEnum == null)
WScript.Echo("Failed to create enumerator");
else {
for (objEveryEnum.moveFirst(); ! objEveryEnum.atEnd();
objEveryEnum.moveNext())
{
var objNetConnection = objEveryEnum.item();
if (objNetConnection == null)
WScript.Echo ("failed to get NetConnection");
else {
var objNetConnectionProps =
objShare.NetConnectionProps(objNetConnection);
if (objNetConnectionProps == null)
WScript.Echo ("Failed to get property")
else {
var str=""
str += "Name: " +objNetConnectionProps.Name;
WScript.Echo(str);
str = "Guid: " +objNetConnectionProps.Guid;
WScript.Echo(str);
str = "Device: "
+objNetConnectionProps.DeviceName;
WScript.Echo(str);
str = "Status: " +objNetConnectionProps.Status;
WScript.Echo(str);
str = "MediaType: " +objNetConnectionProps.MediaType;
WScript.Echo(str);


if
(objNetConnectionProps.Characteristics &
 
B

Buz [MSFT]

Thanks for the info Ted, that is funny because I was going to say to try
that but I didnt want to come off as as being rude or anything. : )

I did some more research and found that other script instead.

-Buz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top