×
Search results provided by Azure Search - read how I built it in this post.
Max Melcher

1 minute read

Short powershell script to list all IIS Web Applications with the .net version, the state of the Web Application and the assigned user/identity.

try{
Import-Module WebAdministration
Get-WebApplication

$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}

$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password

$obj = New-Object PSObject -Property $item
$list += $obj
}

$list | 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
}

And the output is a nice table:

<td style="background-color: #a81010; color: white;" valign="top" width="67">
  Version
</td>

<td style="background-color: #a81010; color: white;" valign="top" width="66">
  State
</td>

<td style="background-color: #a81010; color: white;" valign="top" width="66">
  UserIdentityType
</td>

<td style="background-color: #a81010; color: white;" valign="top" width="57">
  Username
</td>

<td style="background-color: #a81010; color: white;" valign="top" width="75">
  Password
</td>
<td valign="top" width="67">
  v2.0
</td>

<td valign="top" width="66">
  Started
</td>

<td valign="top" width="66">
  SpecificUser
</td>

<td valign="top" width="57">
  demo\spservices
</td>

<td valign="top" width="75">
  <a href="mailto:pass@word1">pass@word1</a>
</td>
WebAppName
SharePoint - 80

 

comments powered by Disqus