Question

Is there a way to programmatically determine which application pool a service application is using?

Further i would like to get the information about the service account the app pool is using.

Was it helpful?

Solution

In powershell use:

Get-SPServiceApplication | FT DisplayName, ApplicationPool

If you want to get the property in your own program you need to get a hold of the Service Application and the cast it to SPIisWebServiceApplication which has the ApplicationPool property

OTHER TIPS

You can use in PowerShell the following command:

Get-SPServiceApplication | ForEach-Object { $_.ApplicationPool}

This results in the name of the service application and the account of the application pool.

You can use the SharePoint Management Shell to get the information:

Get-SPServiceApplication | Select Name, @{Name="SPAppPoolName"; Expression={$_.ApplicationPool.Name}},  @{Name="IISAppPoolName"; Expression={$_.ApplicationPool.Id}}, @{Name="ProcessAccountName"; Expression={$_.ApplicationPool.ProcessAccountName}}

This command uses expressions to extract the desired parts from the app pool.

  • Name = The name of the service application
  • SPAppPoolName = SharePoint is using a dedicated name you can use inside of the CA but that is not visible in the IIS management view
  • IISAppPoolName = This is the ID of the SP app pool and is used as the name of the app pool if you check in the IIS manager on the servers the service app is running on ProcessAccount = This is the service account the app pool is running under

You can check (should not edit) the configuration of the app pool in the applicationHost.config (C:\Windows\System32\inetsrv\config\applicationHost.config). Search for the id or navigate to the xml element "applicationPools".

You could use System.Security.Principal.WindowsIdentity.GetCurrent().Name to identify the Identity in which the current application is running. This Link provides a nice utility which displays the identity under which the aspx is run.

Or read this Question :)

Hope it helps

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top