The data is being acquired from two different sources using .net's server manager.
First I connect to the server and iterate through all the sites using GetSection("system.applicationHost/sites")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$iis = new-object Microsoft.Web.Administration.ServerManager
#$configPaths = $iis.GetApplicationHostConfiguration().GetSection("configPaths").GetCollection()
#lists sites
$configPaths = $iis.GetApplicationHostConfiguration().GetSection("system.applicationHost/sites").GetCollection()|Select-Object -ExpandProperty RawAttributes
foreach ($app in $siteObj.Applications){
$sites += New-Object PSObject -Property @{}
...
}
Then I am using the servermanager to getWebConfiguration and
search for all the sites that have custom SQL connection strings embedded in the application's configuration along with other application specific properties.
The result of these two processes is two custom PSObject collections with the common bond being the root IIS site itself. I have to do it this way because I do not know the names of all the sites nor do I know which applications have custom
connection strings and I wanted to avoid crafting a lot of error checking code.
I cannot use a hashtable because a hashtable only contains a key and a value. In my example I know I only included two properties but in reality there are many more.
As you can see my result is two PSObject collections with many individual pieces of data that need to be merged together. This is what I was looking for guidance on how to accomplish.