I have an .ps1 script grabbing applications under each app pool as follows
param([string]$appPool)
import-module webadministration
$apps = (Get-WebConfigurationProperty
"/system.applicationHost/sites/site/application[`
@applicationPool='$appPool']" "machine/webroot/apphost" -name path).ItemXPath
$out = @()
foreach ($s in $apps) {
$name = $s -replace "\/system.applicationHost\/sites\/site\[\@name='", ""
$name = $name -replace "' and \@id='\d{1,10}'\]\/application\[\@path='",
$name = $name -replace "'\]",""
$out += @{
appPool=$appPool;
location=$name
};
}
$out
which is then called through powershell by the following command
$applications = .\Get-AppsInAppPool.ps1 -appPool "ADTTest"
$applications
What I'm aiming to do is to save the results to a SQL server Database Table.
But stuck in how this will be done