Few days back there was a task to add a service account to a SharePoint Farm. Started Central Administration and navigated to Security –> Configure Managed Accounts. Clicked on Register New Managed Account to add new account.
There a normal account needed to be deleted because all services should be configured to run with service account. Tried to delete that account but error message was displayed with one Application Pool mentioned.
The account was associated with this application pool but this application pool was not present in IIS. It seems the application pool was created some time ago but never used. Tried to find the application pool but failed.

After lot of investigation and searching, here's the solution for this problem which is mentioned below:

1.) Start SharePoint Management PowerShell.

2.) Type below command. It will return you a list of all SharePoint application pools with Name, Associated User ID, etc.

       

GET-SPServiceApplicationPool

3.) Identify the application pool that was mentioned in the error message and verify the associated ID.

4.) This command can be used to get the GUID of service application pool to use with Remove command or Remove command can be used directly.

     

GET-SPServiceApplicationPool –Identity <Service Application Pool Name>

5.) Use below command to remove service application pool.

    

Remove-SPServiceApplicationPool –identity <GUID received in previous step>

                                       OR

    

Remove-SPServiceApplicationPool <Service Application Pool Name>

6.) Confirmation to delete will be prompted and application pool will be deleted.

7.) Run command again from Step 2 to validate list of Application Pools.

 

NOTE: This command will permanently delete the service application pool so please make sure you are deleting the correct service application pool.