Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Last active May 2, 2016 20:53
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 iAnatoly/2e821b5a9fbfbb9abca2 to your computer and use it in GitHub Desktop.
Save iAnatoly/2e821b5a9fbfbb9abca2 to your computer and use it in GitHub Desktop.
3.5 ways to display IIS App pool identities (usernames and passwords)
[System.Reflection.Assembly]::LoadFrom( “C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll” )
$mgr = New-Object Microsoft.Web.Administration.ServerManager
$mgr.ApplicationPools | % { $pm = $_.ChildElements[“processModel”]; Write-Host $_.Name $pm.Attributes[“userName”].Value$pm.Attributes[“password”].Value }
# Or, if you do not appreciate the brevity:
[System.Reflection.Assembly]::LoadFrom( “C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll” )
$mgr = New-Object Microsoft.Web.Administration.ServerManager
$pools = $mgr.ApplicationPools
foreach ($pool in $pools)
{
$processModel = $pool.ChildElements[“processModel”];
Write-Host $pool.Name $processModel.Attributes[“userName”].Value $processModel.Attributes[“password”].Value
}
$pools = ([ADSI]“IIS://localhost/W3SVC/AppPools”).Children
foreach ($pool in $pools)
{
Write-Host $pool.Name, $pool.Properties.WAMUserName, $pool.Properties.WAMUserPAss
}
Get-WMIObject -namespace root/MicrosoftIISv2 -Class IIsApplicationPoolSetting -Property Name, WAMUserName, WAMUserPass | select Name,WAMUserName, WAMUserPass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment