I'm trying to push a custom SharePoint WebPart to my farm. By all accounts I should do this with Install-SPSolution... I wrote a PowerShell script to perform the command but it says it can't find my .wsp file which is clearly in the directory. Here's the script:
cd 'C:\pathtodir'
Add-PSSnapin Microsoft.Sharepoint.Powershell -EA 0
Install-SPSolution -Identity mywebpart.wsp -GACDeployment -WebApplication "https://myserver/"
The exact error is 'Install-SPSolution : Cannot find an SPSolution object with Id or Name: mywebpart.wsp.' but I know for sure it is in there. Now when I first wrote this script up it worked fine, but I had an update to the WebPart so I needed to redeploy it and ever since then I get this error. Any ideas?
Thanks.
You need to use Update-SPSolution
if you are updating the wsp file with a newer version (https://technet.microsoft.com/en-us/library/ff607724.aspx):
Update-SPSolution -Identity mywebpart.wsp -LiteralPath 'C:\pathtodir\mywebpart.wsp' -GACDeployment