Actually Wahid I thought (hoped) you were on to something there but unfortunately ApplicationPool
is under EnterpriseSearchServiceApplications.EnterpriseSearchServiceApplication.
I believe I addressed this in another post, but there appears to be something strange with the New-SPServiceApplicationPool cmdlet. Even if you specify a friendly name (as we have done in the script for the Search App Pool), the app pool in IIS still gets
created with a GUID.
We can confirm that the friendly name we specified really did get picked up by the script though by simply doing a
Get-SPServiceApplicationPool and inspecting the values under the Name column:
SharePoint Enterprise Search Applicat... CONTOSO\SP_SearchServiceAcct
SharePoint Hosted Services CONTOSO\SP_AppPoolAccount
SharePoint Web Services System CONTOSO\SP_FarmAccount
You can even try creating an app pool after the fact(using New-SPServiceApplicationPool), and specifying a name - it will still be identified by a GUID in IIS' Application Pools list.
The even stranger thing is, the SecurityTokenServiceApplicationPool somehow did get its name set properly in IIS!