Welcome to MSDN Blogs Sign in | Join | Help

Bryan Griffin's Blog

From the Depths of Redmond
Listing firewall exceptions with PowerShell - yes we can

On an internal PowerShell scripting DL the question was posed as to how one would get a list of applications with firewall exceptions.  Here was the answer that I sent:

function getfwexceptions
{
    $fwmgr = (new-object -com hnetcfg.fwmgr).localpolicy.currentprofile
    $fwmgr.authorizedapplications
}

This function instantiates an instance of the HNetCfg.FwMgr COM object and gives you back something like this:

Name                 : Internet Explorer
ProcessImageFileName : C:\program files\internet explorer\iexplore.exe
IpVersion            : 2
Scope                : 0
RemoteAddresses      : *
Enabled              : True

Of course, with PowerShell you're passing around objects and can filter this output to your liking.

Happy scripting!

Posted: Wednesday, February 18, 2009 7:02 PM by bryangr
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker