MS Windows – PowerShell – List Registered Network Filters

Background

Quick stolen code for listing Network Filters, Maximum Number of Network Filters allowed, and current count.

BTW, this is a quick follow up to our last post.

Code



$mesg="";
$branch = "hklm:\SYSTEM\CurrentControlSet\Control\Network"

$objNetwork = (get-itemproperty $branch)

if (!$objNetwork)
{
	$err = "(get-itemproperty $branch failed!"
	
	Throw $err
}

$maxnumfilters = $objNetwork.maxnumfilters

$mesg = "Maxnumfilters: " + $maxnumfilters
Write-Host $mesg
Write-Host 

$children = get-childitem -path $branch\"{4d36e974-e325-11ce-bfc1-08002be10318}" `
				| get-childitem `
				| where-object {$_.PSChildName -eq "Ndi"} `
				| get-itemproperty `
				| where-object {$_.FilterClass} `
				|get-itemproperty -name FilterClass


if (!$children)
{
	$err = "(get-childitem $branch failed!"
	
	Throw $err
}

$mesg="Filter Count: " + $children.count
Write-Host $mesg
Write-Host 

Write-Host "Filter List: "
Write-Host "-------------"
Write-Host 

$header =    "{0,-20} {1,-20} {2,-60}" `
				-f "infPath",    "componentID",  "description"
				
Write-Host $header

$headerSep = "{0,-20} {1,-20} {2,-60}" `
				-f "-------",    "-----------",  "-----------"
				
Write-Host $headerSep

$children | foreach-object { 

	$_objPath = get-itemproperty -path $_.PSParentPath 

	$_infPath = $_objPath.InfPath
	
	$_componentID = $_objPath.ComponentId 

	$_description = $_objPath.Description

	$data = "{0,-20} {1,-20}  {2,-60}" `
	          -f $_infPath, $_componentID, $_description

	Write-Host $data

}

Sample Output

networkfilters-self-20161019-0347pm

 

Takeaway

  1. Number of Network Filters
    • The # of Network Filters is 9
    • 9 is 8+1
    • And, that explains why we received an error when we tried to manually add netnm3.inf
    • BTW, the error message is “Filters currently installed on the system have reached the limit
    • Our experience is detailed here
  2. Based on collaborating posts on the Net, we increased our soft limit from 8 to 15

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s