Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
2.6k views
in SharePoint Server by 37 41 48

I got this error "Uninstall-SPSolution : This solution contains resources scoped for a Web application and must be retracted from one or more Web applications." when trying to uninstall a SharePoint 2019 solution using PowerShell

Uninstall-SPSolution Identity 6ca32b40-73f1-4b39-8ed3-121ff6d46de5

Uninstall-SPSolution  This solution contains resources scoped for a Web application and must be retracted from one or more Web applications

How I can solve this error in SharePoint 2019?


1 Answer

1 like 0 dislike
by 159 200 385
selected by
 
Best answer

Solving: Uninstall-SPSolution : This solution contains resources scoped for a Web application

To uninstall a SharePoint WSP solution that is scoped for a web application without facing this error "Uninstall-SPSolution : This solution contains resources scoped for a Web application and must be retracted from one or more Web applications.", you have first to specify the scoped web application using this parameter " -WebApplication".

Uninstall-SPSolution -Identity 6ca32b40-73f1-4b3 9-8ed3-121ff6d46de5 -WebApplication http://webAppURL

If you don't know which web application you installed your SharePoint solution or the solution already deployed globally, you can easily use -AllWebApplications.

Uninstall-SPSolution -Identity 6ca32b40-73f1-4b3 9-8ed3-121ff6d46de5 -AllWebApplications

Once you have uninstalled (retracted) the SharePoint Solution, you have to remove it using the below PowerShell cmdlet

Remove-SPSolution -Identity SP_solution.wsp

How to get the Deployed Web Applications for a SharePoint WSP Solution?

In case, you want to know which web applications you installed your SharePoint solution, you can use the below SharePoint PowerShell cmdlet

Get-SPSolution | select Name,DeployedWebApplications | Format-List

Get deployed web application for WSP using PowerShell

Also, you get the Deployed web applications URL for a SharePoint WSP solution through the SharePoint Central Administration by doing the following:

  1. Open Central Administration > Click on System Settings. > Below Farm Management, click on Manage farm solutions.
    WSP Solutions
  2. Click on the WSP solution name to get the list of all deployed web applications for this WSP solution.
    Uninstall-SPSolution : This solution contains resources scoped for a Web application and must be retracted from one or more Web applications

See Also

If you don’t ask, the answer is always NO!
...