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
Originally Posted on November 10, 2015
Last Updated on February 12, 2016
Last Updated on February 12, 2016
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.