Import-Module WebAdministration clear $sites = @{Expression={$_.Name};Label="Site Name"}, ` @{Expression={$_.applicationPool};Label="Site App Pool";}, ` @{Expression={$_.PhysicalPath};Label="Site Physical Path";} dir IIS:\Sites | Format-Table $sites -AutoSize # List File Path for web.config files ForEach($item in (dir IIS:\Sites)) { write-host $item.Name $filePath = $item.PhysicalPath $fileName = "web.config" Get-ChildItem -Recurse -Force $filePath -ErrorAction SilentlyContinue | Where-Object { ( $_.Name -like "*$fileName*") } | Select-Object FullName | format-Table * -AutoSize -HideTableHeaders }
GitHub: https://gist.github.com/dkittell/90b53d1136d80f1c53c0
Last Updated on February 12, 2016