How can I use internetfirewallenabled to determine whether to enable Windows Firewall?

Source: Internet
Author: User
¥ $ 10/27/2007 4:10 am PST
  Question
  Hello, I encountered a problem when testing the ISA RQs script sample (rqscript. vbs) provided by Microsoft. In the script, assume that Windows Firewall is enabled (allfw = ture) on the computer, and use internetfirewallenabled to determine whether Windows Firewall is enabled on a specific network connection?
#######################
Function check_isicfenabled
'--------------------------
'Returns true if all non-VPN connections are firewalled
Const progid_netconlib = "hnetcfg. hnet0000.1" 'hnetcfg. dll
Const ncm_tunnel = 5' mediatype = VPN
Dim connmgr, connlist, Conn, connprops, connconfig, allfw
Allfw = true
Set connmgr = Createobject (progid_netconlib)
Set connlist = connmgr. enumeveryconnection
For each Conn in connlist
Set connprops = connmgr. netconnectionprops (conn)
Set connconfig = connmgr. inetsharingconfigurationforinetconnection (conn)
If connprops. mediatype <> ncm_tunnel then
Allfw = allfw and connconfig. internetfirewallenabled
End if
Next
Check_isicfenabled = allfw
End Function
########################################

My question is: how can I determine that Windows Firewall is enabled on my computer?
In addition, I am a beginner with no programming experience. I have read progid_netconlib =
"Hnetcfg. hnet0000.1", you do not know how to query the reference of hnetcfg. hnet0000.1. I found primitive:
Hnetcfg. dll page, but do not get the required information. How can I find enumeveryconnection, netconnectionprops, and other methods?
Thanks in advance!

 
  Was this post helpful to you?      
  Reply   Top  
 
 
 
Jialge@prcvap.microsOft.com 10/29/2007 am PST
  Answer
  Hello,

For your first question, you can use firewallenabled property to detectHttp://msdn2.microsoft.com/en-us/library/aa364717.aspx. Or check the registry:
HKLM/system/CurrentControlSet/services/sharedaccess/parameters/firewallpolicy/standardprofile/
Enablefirewall REG_DWORD 0x00000001 (1) indicates enable
If it is 0, it is disable.

For the second question, this program is actually using the late binding method to create hnetcfg. hnet0000.1 object (Createobject), because you are using VBScript, you only need to use this object in the following code as in early binding. For reference to hnetcfg. hnet0000.1, Windows Firewall has registered this type.

Thank you.
GE Jialiang

 
  Was this post helpful to you?      
  Reply   Top  
 
 
 
Jialge@prcvap.microsOft.com 11/23/2007 am PST
   
  Hello,

I do not know what the current situation is?

Thank you.
Jialiang

 
  Was this post helpful to you?      
  Reply   Top  
 
 
 
??? 11/26/2007 5:19 am PST
   
  I forgot to reply. Firewallenabled property is used. Thank you.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.