firebolt
firebolt

Reputation: 139

How to list isapi filters by name in Powershell

Hi I am trying to view list of isapi filters that are currently configured to IIS. I am using

C:\Windows\System32\inetsrv\appcmd.exe list config /section:isapiFilters

Which gives me the output:

< system.webServer > < isapiFilters > < filter name="ASP.Net_2.0.50727-64" path="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll" enabled ="true" enableCache="true" preCondition="runtimeVersionv2.0,bitness64" / > < filter name="ASP.Net_4.0_32bit" path="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enabled="tru e" enableCache="true" preCondition="runtimeVersionv4.0,bitness32" / > < filter name="ASP.Net_4.0_64bit" path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll" enabled="t rue" enableCache="true" preCondition="runtimeVersionv4.0,bitness64" /> < filter name="shibboleth" path="C:\opt\shibboleth-sp\lib64\shibboleth\isapi_shib.dll" enabled="true" /> < /isapiFilters> < / system.webServer>

I want to filter this xml out by only displaying the filter name "shibboleth" Im trying to follow this blog but I'm looking for extra guidance https://blogs.iis.net/eokim/understanding-appcmd-exe-list-set-config-configurationpath-section-name-parameter-name-value

Upvotes: 1

Views: 1655

Answers (2)

charlie arehart
charlie arehart

Reputation: 6884

While firebolt's main question (how to find only a certain filter in the results) was indeed answered by Lex, I would just add a caution to readers who find this post, who may be looking for how to "find ALL filters that exist in ALL sites".

The appcmd offered in both the question and answer will ONLY find those filters defined at the SERVER level in IIS. It will NOT find any defined at one or more SITE levels.

To find things at the app level, you would (sadly) need to repeat the command for each site, such as with:

appcmd list config "somesite" -section:"isapiFilters"

Or use techniques to cause that to be run once for each site, whether in powershell or with piping. But just wanted to leave this clarification of how it only looks at SERVER level config, not site-level, by default.

Upvotes: 1

Lex Li
Lex Li

Reputation: 63173

Combine the query with findstr command, or use other PowerShell tricks to filter the generated XML snippet,

appcmd list config /section:isapiFilters | findstr shibboleth

Upvotes: 0

Related Questions