Created
December 14, 2015 13:38
-
-
Save dkittell/90b53d1136d80f1c53c0 to your computer and use it in GitHub Desktop.
PowerShell – List Sites with App Pool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment