Unique values of string in Web Config

Hi everyone!

I need your help, I need to know the application pool values that are not repeated within a web config. Currently I use the following query to search for it: "not exist (unique values of (it as string) of (lines whose (it as lowercase contains "application" and it as lowercase contains "path=" and it as lowercase contains "applicationpool=" ) of files "applicationHost.config" of folders "inetsrv\config" of native system folder))"
But this brings me extra values, I would need to know which are the unique values that correspond to the “applicationpool” value. In the web config they appear with the following line (as an example) "
"application path="/APPInterface" applicationPool="APPLICATION">. "

Can someone help me?

I think you need multiplicity of to filter the unique ones.
Does this get you close enough?

q: ((it, multiplicity of it) whose (item 1 of it = 1) of unique values of preceding texts of firsts "%22" of following texts of lasts "applicationpool=%22" of lines whose (it as lowercase contains "application" and it as lowercase contains "path=" and it as lowercase contains "applicationpool=" ) of it)of files "applicationHost.config" of folders "inetsrv\config" of native system folder

I think the problem here is that you will have multiple lines (with different ‘application’ values) but sharing the same application pool, and we want to get the unique names of application pools within the lines?

It’s certainly possible to do that with string parsing, but since these are XML files it’s much easier to open it as an XML document, find all of the ‘applicationPool’ attributes, and find the unique values of those attributes -

q: unique values of node values of xpaths "//@applicationPool" of xml documents of files "applicationHost.config" of folders "inetsrv\config" of native system folder
A: CCM Client Deployment Pool
A: CCM Client Notification Proxy Pool
A: CCM Security Token Service Pool
A: CCM Server Framework Pool
A: CCM User Service Pool
A: CCM Windows Auth Server Framework Pool
A: CCM Windows Auth User Service Pool
A: DefaultAppPool
A: SMS Distribution Points Pool
A: SMS Management Point Pool
A: SMS Windows Auth Management Point Pool
A: WsusPool
T: 7.017 ms

The non-xml, string-parsing version would be somewhat fragile - it’s valid for example to have spaces before or after the “=” sign which would be a problem that we don’t have with the XML-parsing version.

q: unique values of preceding texts of firsts "%22" of following texts of firsts "applicationPool=%22" of lines of files "applicationHost.config" of folders "inetsrv\config" of native system folder
A: CCM Client Deployment Pool
A: CCM Client Notification Proxy Pool
A: CCM Security Token Service Pool
A: CCM Server Framework Pool
A: CCM User Service Pool
A: CCM Windows Auth Server Framework Pool
A: CCM Windows Auth User Service Pool
A: DefaultAppPool
A: SMS Distribution Points Pool
A: SMS Management Point Pool
A: SMS Windows Auth Management Point Pool
A: WsusPool

hello jason, thank you very much for your help. What we need to verify is that each application has a single aplicationpool, for example, if there are 2 applications that share the same aplicationpool would be non-compliance

Ah, ok then, you’ll want to count the unique instances of each applicationPool using ‘multiplicity of’ the unique values as @brolly33 mentions.

q: (multiplicity of it, it) of  unique values of node values of xpaths "//@applicationPool" of xml documents of files "applicationHost.config" of folders "inetsrv\config" of native system folder
A: 1, CCM Client Deployment Pool
A: 1, CCM Client Notification Proxy Pool
A: 1, CCM Security Token Service Pool
A: 3, CCM Server Framework Pool
A: 1, CCM User Service Pool
A: 1, CCM Windows Auth Server Framework Pool
A: 1, CCM Windows Auth User Service Pool
A: 1, DefaultAppPool
A: 2, SMS Distribution Points Pool
A: 1, SMS Management Point Pool
A: 1, SMS Windows Auth Management Point Pool
A: 8, WsusPool
T: 73.260 ms

Or, to return only your noncompliant/duplicated ones:

q: (multiplicity of it, it) of  unique values whose (multiplicity of it > 1) of node values of xpaths "//@applicationPool" of xml documents of files "applicationHost.config" of folders "inetsrv\config" of native system folder
A: 3, CCM Server Framework Pool
A: 2, SMS Distribution Points Pool
A: 8, WsusPool
T: 85.024 ms
3 Likes

Thanks Jason you are a genius!!

1 Like