This question already has an answer here:
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:-
$oUrl="http://mysite:9999/" $solutionPath="C:\MySolutions\" $solution="FarmSolution.wsp" $path= $solutionPath + $solution Add-SPSolution -LiteralPath $path install-spsolution -Identity $solution -WebApplication $oUrl -GACDeployment WaitForJobToFinish
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.