Windows-Firewall status

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to check the status of the windows-firewall? (aktiv or inaktive)

regards

Karsten
 
Is it possible to check the status of the windows-firewall? (aktiv or
inaktive)

Search microsoft.com for
get_InternetFirewallEnabled
This looks like a real adventure - good luck.
 
Is it possible to check the status of the windows-firewall? (aktiv or
inaktive)

The following seems to do it - only limited testing though.

Private Function FireWallIsEnabled()
' return true if windows firewall is enabled
' requires option strict off (late binding)
Dim enabled As Boolean
Try
Dim fwMgr As Object = CreateObject("HNetCfg.FwMgr")
Dim profile As Object = fwMgr.LocalPolicy.CurrentProfile
Dim fwe As Integer = profile.FirewallEnabled
enabled = (fwe <> 0)
Catch ex As Exception
enabled = False ' indicate disabled if any error
End Try
Return enabled
End Function
 
Thanks for your help.
Is get_InternetFirewallEnabled unmanaged C++ code?
Is your example write in vb.net?

regards

Karsten
 
Back
Top