سؤال

It is probably something easy that I am not seeing, but I created a web application through powershell using the new-spwebapplication command which created an app pool based on the name provided. But I screwed something else up later in the script and wanted to start over. I was able to delete the Web Application through Central Administration, but I cannot get rid of the App Pool that it was assigned to. There are no other Web Applications on the box except the central administration web site. And the managed account says that the Farm component using this account is Microsoft SharePoint Foundation Application Pool: SharePoint - MySites (This is a SharePoint Server Standard installation).

So my question is: How do I list the Application Pools? and How do I remove an Application Pool for a web site; not a service application?

هل كانت مفيدة؟

المحلول

Have you tried deleting the AppPool using IIS manager? If you right click an AppPool and select View Applications you can see what web site the AppPool is attached to.

نصائح أخرى

You can delete you content application pool if you have the guid for the app pool in concern.

To get the id:

$applicationPools = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools

Then remove the app pool using the id:

$applicationPools.Remove("b40a1044-a9dd-4042-9773-143eca0e8f70")

Actually the Gt-SPServiceApplicationPool only manages service app pools, not those used for content web applications

User2816's answer will indeed remove the SharePoint record of the application pool (thanks) but it does not remove the physical application pool from IIS.

The removal via IIS could be completed manually afterwards but I am not sure whether this is a complete removal from a SharePoint perspective and is an extra unnecessary step too.

One method that I tested (on SharePoint 2010 and 2013) was un-provisioning the application pool (see http://alstechtips.blogspot.com/2015/04/sharepoint-2013-how-to-add-and-remove.html) as follows....

$pool = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools | where {$_.Name -eq "<my app pool name>"}
$pool.UnprovisionGlobally()

Having checked both IIS and SharePoint records of the application pool afterwards, it appears to have been successfully deleted from both when using this method.

See https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.administration.spapplicationpool_members(v=office.14).aspx for the SPApplicationPool methods (including UnProvision)

Get-SPServiceApplicationPool lists all of the SharePoint application pools.

To remove one, you would just type:

Get-SPServiceApplicationPool -Identity [name of app pool] | Remove-SPServiceApplicationPool

Run each time Get-SPServiceApplicationPool to verify if it has been deleted

In case anyone wants to do it by using PowerShell, here is the correct way to delete a SharePoint Application Pool:

 Remove-SPServiceApplicationPool "Application pool name here"

If you have screwed up the above command might fail and you will need to first run the following commands and then remove the application pool:

Stop-Service -Name SPAdminV4
Start-SPAdminJob -Verbose
Start-Service -Name SPAdminV4
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top