Remove Orphaned Application Pool Objects From Central Administration

By James|08/20/2011|,

When working with Central Administration and Service Accounts, you may find application pools listed that no longer exist on the portal. More than likely this was caused by application pools being changed or deleted directly through IIS. Although IIS knows the application pools are gone, SharePoint has no idea.

Fortunately, PowerShell can help with this. Fire up PowerShell and enter the following:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$WebApp = Microsoft.SharePoint.Administration.SPWebApplication]::Lookup ('http://<em>your_portal</em>')
$WebApp.WebService.ApplicationPools | select Name,Id | format-table -auto

This will show you a list of what application pools SharePoint has configured. To get rid of an orphaned application pool, perform the following:

$WebApp.WebService.ApplicationPools.remove("ID_OF_POOL_TO_DELETE")

To confirm the object was deleted, re-run

$WebApp.WebService.ApplicationPools | select Name,Id | format-table -auto

 

Copyright 2011 - 2024 The Lazy IT Admin | All Rights Reserved
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram