Enumerate every solution for each WebApplication
-
10-12-2019 - |
Question
I'm performing an inventory and I need to get list of sharepoint solutions (*.wsp) deployed to every individual web-application and ideally, it would also be great to list what Application pool on what web-server this web-application belongs to?
Something like this >>
solution-name.wsp / web-application-name / application-pool-name
I've tried using Get-SPSolution, but output doesn't contain web-app name & Get-SPWebApplication doesn't give the list of .wsp for each web-app listed.
stsadm -o enumsolutions seems to contain info I need, but don't know how to change output format to something similar mentioned above.
This is MS SharePoint Server 2010 running on W2K8R2 STD.
Solution
First, get all your web applications and iterate through them. While in the loop print web application name and application pool name. Last, iterate all solutions and print their names - like this:
$contentWebAppServices = (Get-SPFarm).services |
? {$_.typename -eq "Microsoft SharePoint Foundation Web Application"}
foreach($webApp in $contentWebAppServices.WebApplications)
{
Write-Host "Web Application : " $webApp.name
Write-Host "Application Pool : " $webApp.ApplicationPool.Name
Get-SPSolution | ForEach-Object {
if ($_.LastOperationDetails.IndexOf($webApp.url) -gt 0)
{
Write-Host " Solutions:"
Write-Host " " $_.DisplayName
}
}
}
The output looks like this:
Web Application : SharePoint - 1337
Application Pool : SharePoint - 1337
Web Application : SharePoint - 80
Application Pool : SharePoint - 80
Solutions:
customer.intranet.wsp
The first web application (SharePoint - 1337) doesn't have deployed solutions, but the second (SharePoint - 80) has one.