I have found that I can get the connection string from the website's web.config with this:
$connectionstrings = $iis.GetApplicationHostConfiguration().GetSection("connectionStrings","/www.myweb.com").getCollection()
$connectionstrings | select -ExpandProperty RawAttributes
But my site has virtual application running in user it that use different web.config files with different connection strings. I have tried
$connectionstrings = $iis.GetApplicationHostConfiguration().GetSection("connectionStrings","/www.myweb.com/myapp").getCollection()
$connectionstrings | select -ExpandProperty RawAttributes
but it gives me the websites connection string instead of the individual application's. How can I access the connection string for /www.myweb.com/myapp?
Thanks!