I need to find all the web servers in my environment that have the default documents enabled. I am looking for the existence of the “web.config” file in this folder “C:\inetpub\wwwroot” and contains the line defaultDocument enabled=“true”.
below is the content of the file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
<security>
<requestFiltering>
<verbs>
<add verb="TRACE" allowed="false" />
<add verb="TRACK" allowed="false" />
</verbs>
</requestFiltering>
</security>
<defaultDocument enabled="false">
<files>
<clear />
<add value="iisstart.htm" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
This is the query that I am trying but it is not working. I get error “The operator “true” is not defined.”
exist file “C:\inetpub\wwwroot\web.config” whose (exists (line of it) whose (it contains “defaultDocument enabled=“true””))
I think I need to use xpaths to get the desired results but I haven’t been able to get the working either. Any help with this would be greatly appreciated.
Thanks.