[python-win32] Re: PythonCOM & Windows Firewall

Roger Upole rwupole at msn.com
Thu May 18 04:06:30 CEST 2006


I've used it to list firewall exceptions, and it wasn't too much
more work to add an application: 

import win32com.client
fw=win32com.client.gencache.EnsureDispatch('HNetCfg.FwMgr',0)
apps=fw.LocalPolicy.CurrentProfile.AuthorizedApplications
for app in apps:
    print app.Name, app.ProcessImageFileName
    
newapp=win32com.client.Dispatch('HNetCfg.FwAuthorizedApplication')
newapp.Name='python_d.exe'
newapp.ProcessImageFileName='j:\\python24\\python_d.exe'
newapp.Enabled=True
apps.Add(newapp)


    hth
         Roger



More information about the Python-win32 mailing list