?
Solved

Enable\Disable "Allow incoming Echo request" in the windows firewall

Posted on 2009-02-09
1
Medium Priority
?
1,313 Views
Last Modified: 2012-05-06
I would like to enable the "Allow incoming Echo request" when my users are on our corporate network as they will be protected by our newtork. But I would like it disabled when they using ADSL off our network. Is it possible to do this and how?
0
Comment
Question by:ITZUG
1 Comment
 
LVL 8

Accepted Solution

by:
anil_u earned 750 total points
ID: 23589743
Hi

Try the following script, open notepad, copy and paste the script below into notepad, save as icmp.vbs, open command prompt and run from the directory you save icmp.vbs the following command
cscript icmp.vbs

This script takes the network name which is a variable strConnectionName which you need to change and on the computer that is run, checks to see if that nic is connected
"objItem.NetConnectionStatus = 2"
and if so, displays name, mac address and description. It then enable the echo request if its disabled. If its disabled, it enables it.
The script is commented, well a little bit :) but you should be able to amend it

The idea is that this script could be part of log on/off script which when run, does the check and enables it if required.


-----------------------
strConnectionName = "Wireless Network Connection"

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")

For Each objItem in colItems


If objItem.NetConnectionStatus = 2 Then      'If connected then...
      If objItem.NetConnectionID = strConnectionName Then      'The connected to the required network then...
                Wscript.Echo "Name: " & objItem.Name      'Show details
                Wscript.Echo "Description: " & objItem.Description            'Show details
                Wscript.Echo "MAC Address: " & objItem.MACAddress            'Show details

                  'Modify firewall
                  Set objFirewall = CreateObject("HNetCfg.FwMgr")
                  Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
                  Set objICMPSettings = objPolicy.ICMPSettings
                  
                  'Enable ICMP Allow incomming echo request if disabled otherwise disable
                  If objICMPSettings.AllowRedirect = FALSE Then
                        objICMPSettings.AllowInboundEchoRequest = TRUE
                  Else
                        objICMPSettings.AllowInboundEchoRequest = FALSE
                  End If

      End If
End IF

Next

-------------------------------------
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 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