I use powershell to inventory information about our internal websites. One of the items I track is what databases the site uses. Previously, I have used PowerShell like this to get the connectionstrings:
$allConnectionStrings = (Get-Webconfiguration $sitePath -filter "connectionStrings/add")
I now have a new site that uses the configBuilders
attribute (https://learn.microsoft.com/en-us/aspnet/config-builder) on the connectionStrings tag like this:
<connectionStrings configBuilders="SitecoreConnectionStringsBuilder">
and the PowerShell command throws this error:
Get-Webconfiguration : Filename: \\?\C:\inetpub\wwwroot\MySite\web.config
Line number: 2
Error: Unrecognized attribute 'configBuilders'
At C:\scripts\Get-DatabaseNamesFromIisSite.ps1:89 char:34
+ ... nStrings = (get-webconfiguration $sitePath -filter "connectionStrings ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WebConfiguration], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.GetConfigurationCommand
Is there a way I can get this to work for config that uses configBuilders in PowerShell or by using a .NET Class? The solution needs to work outside of the site code--it must be accessed externally.