Skip to content

Instantly share code, notes, and snippets.

@bentk
Created October 8, 2013 07:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bentk/6881156 to your computer and use it in GitHub Desktop.
Save bentk/6881156 to your computer and use it in GitHub Desktop.
try{
Import-Module WebAdministration
Get-WebApplication
$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}
$item.Password = $webapp.processModel.password
$item.Username = $webapp.processModel.userName
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.WebAppName = $webapp.name
$obj = New-Object PSObject -Property $item
$list += $obj
}
$list #| ft -auto # -column 6 # Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password"
}
catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment