[02/03] firewall and webservices/internet access
I have a customer who I wrote a piece of software for. The software is a windows app, but downloads information needed to run via a webservice I host on my webserver.
Everything works great, except sometimes they go to install the software on one of their customers PCs, and the software can't hit the web because of a firewall.
I know most half decent firewall programs will generally prompt the user for access to the web when the program tries, but apparently they have run into some situations where they can't find what software is blocking the app (and these guys are NOT computer guys. I am sure if I was there I could find the offending firewall app, and allow the access, but these installs are done all over the country, and it was only my job to write the app for them)
So anyway, I am wondering if there is anything I can do to try to avoid this scenario.
Is there anyway to probe what apps are blocking connections? or anything you guys can suggest to make this a little more user friendly?
Re: [02/03] firewall and webservices/internet access
You might be able to use the WMI to detect if the firewall software is running (though I don't know if this detects all firewalls, and it may only work on XP+):
VB6 Code:
VB Code:
Private Sub DumpFirewallInfo()
Dim oLocator As WbemScripting.SWbemLocator
Dim oService As WbemScripting.SWbemServicesEx
Dim oFirewalls As WbemScripting.SWbemObjectSet
Dim oFirewall As WbemScripting.SWbemObjectEx
Dim oFwMgr As Variant
Set oFwMgr = CreateObject("HNetCfg.FwMgr")
Debug.Print "Checking the Windows Firewall..."
Debug.Print "Windows Firewal Enabled: " & oFwMgr.LocalPolicy.CurrentProfile.FirewallEnabled
Debug.Print ""
Set oFwMgr = Nothing
Debug.Print "Checking for other installed firewalls..."
Set oLocator = New WbemScripting.SWbemLocator
Set oService = oLocator.ConnectServer(".", "root\SecurityCenter")
oService.Security_.ImpersonationLevel = 3
Set oFirewalls = oService.ExecQuery("SELECT * FROM FirewallProduct") ' This could also be "AntivirusProduct"
For Each oFirewall In oFirewalls
Debug.Print "Company: " & vbTab & oFirewall.CompanyName
Debug.Print "Firewall Name: " & vbTab & oFirewall.DisplayName
Debug.Print "Enabled: " & vbTab & Format$(oFirewall.Enabled)
Debug.Print "Version: " & vbTab & oFirewall.versionNumber
Debug.Print ""
Next oFirewall
Set oFirewall = Nothing
Set oFirewalls = Nothing
Set oService = Nothing
Set oLocator = Nothing
End Sub
Private Sub Command1_Click()
DumpFirewallInfo
End Sub
Credit where credit is due: http://www.experts-exchange.com/Prog..._21645145.html
Re: [02/03] firewall and webservices/internet access
Thanks. Looks like it will be useful. Its VB6 code, but I can get it to work no problem setting a COM reference in .NET.
I am going to see if I can do it with WMI from the framework instead. I will use this as a guide.
Re: [02/03] firewall and webservices/internet access
Yeah, converting that to framework WMI should not be hard at all.