we are trying to deploy farm solution wsp file on the SharePoint server via PowerShell. The wsp is a webpart. I got this script by browsing forums...

Foll. is our code:-


$path= $solutionPath + $solution 
Add-SPSolution -LiteralPath $path
install-spsolution -Identity $solution -WebApplication $oUrl -GACDeployment 

Using the above PowerShell the wsp gets successfully deployed into the GAC. The webpart can then be added to page and used successfully.

My question is on the foll. line:-

install-spsolution -Identity $solution -WebApplication $oUrl -GACDeployment 

Since the wsp gets deployed to the GAC, then what is purpose of using -WebApplication $oUrl. Can I remove this part? Generally, the only purpose of using the -WebApplication $oURL without following -GACDeployment is to deploy the wsp to inetpub/site/bin.

Now, if our goal is to deploy the wsp to GAC, then why not use it as:-

install-spsolution -Identity $solution -GACDeployment 

Would this be correct?

This question doesnt look to be duplicate of this link as the question addresses the concern of using either -WebApplication or -GACDeployment or both together in powershell to deploy an feature. Also, the answer shows that the value of the 3rd column (Depyoled To) under Manage farm solutions depends upon the use of -WebApplication or -GACDeployment in powershell while deploying as explained by @Waqas Sarwar MCSE which I have marked as an answer.


3 Answers 3


we use the webapplication switch, if you want to target one web application(Deploys the SharePoint solution for the specified SharePoint web application.)...i.e we have 4 web applications and i want to deploy the solution on 1 web application only, then i will use the this switch, otherwise the webapplication it will deploy the solution to all web application.

GAC deployment means solution available for everybody but it does not mean that every body can use it unless you install it for every web app.

Deploy solution packages (SharePoint Server 2010)

  • 2
    You can't target web application for deploying solutions :-), when you deploy a solution, it will get deployed across farm, however you can activate features if they are scoped to web applications on a single web application or all. Feb 25, 2014 at 12:39
  • when you add(add-spsolution) the solution, then it will added to all server, but when you deploy it(install) then you can target it to web application...you can check from central admin > manage farm solution > from there you will see the deploy option...to all or a specific web app.
    – Waqas Sarwar MVP
    Feb 25, 2014 at 12:45
  • Yes, Waqas has a point as I have seen some farm solutions showing 3rd column as Deployed globally or the web address. Waqas, why this happens? Is it because of setting the scope under visual studio?
    – variable
    Feb 25, 2014 at 12:50
  • I noticed that if script is install-spsolution -Identity $solution -GACDeployment then it comes as globally deployed. Where as if we specify the -WebApplication $oUrl -GACDeployment then it shows website address in 3rd column...
    – variable
    Feb 25, 2014 at 12:54
  • @NachiketKamat and Waqas, do me a favour and develop a web application scoped feature, deploy it as a solution to a specific webapplication, now look at all other web applications, they will let you activate the feature on them, Above answer is just a logical explanation, not what happens in real... :) Feb 25, 2014 at 13:08

Since your WSP contains a webpart, it has safe control entries. And safe control entries are added to web.config files. Generally you make a check while deploying the solutions:

    Install-SPSolution -Identity $SolutionPackageName -WebApplication $WebApplication -  GACDeployment -Confirm:$false
    Install-SPSolution -Identity $SolutionPackageName -GACDeployment -Confirm:$false

You can very well remove the -WebApplication parameter from a solution which has web application resources. In that case safe control entries will be added to all web.config files of all web applications. However, if you try to deploy a solution with no such resoureces using -WebApplication aparemeter it will give error that "this solution contains no resources scoped for a web application"


In short, yes because it's an optional parameter,




Deploys the SharePoint solution for the specified SharePoint web application. The value must be in one of the following forms:

An authentic GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh

An authentic name of a SharePoint web application (for example, MyOfficeApp1)

An instance of an authentic SPWebApplication object.


If you won't going to provide WebApplication parameter, it will deploy solution to all web application.

This parameter is useful when your solution or feature is SPWebApplication scope and it going to make changes to specific web application. For example web.config changes, as said by Nadeem.


Saying all that documented, it's not easy to understand, here is an example I came across in past,

Moss Timer job deployed in one web application but running in a different web application

  • Farm solution can be scoped at web application, site collection and site level. So what exactly happens when suppose your solution or feature is SPWebApplication scope and you use script as --> install-spsolution -Identity $solution -WebApplication $oUrl -GACDeployment --> and what would happen if you didnt use the -WebApplication $oUrl ??
    – variable
    Feb 25, 2014 at 12:42
  • @NachiketKamat If you have resources that are scoped to web application level within your solution, then they will only be added to deployed solution, but if there isn't anything there it won't going to add anything to web applications, so using web application parameter becomes useless. Feb 25, 2014 at 13:03
  • Even with GAC deployment you can target to one web application...you have some requirement which needs gac deployment but you dont want that solution for all web apps then you use this switch to focus the web app...solution will available in farm for every body but only one web app will see because we target it.
    – Waqas Sarwar MVP
    Feb 25, 2014 at 13:14
  • @WaqasSarwarMCSE solution will available in farm for every body but only one web app will see because we target it. Please provide me some reference for this statement with example :-) Feb 25, 2014 at 14:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.