I am trying to run a powershell script in server1 to deploy WSP file present in server2. Here is my code:
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("username",$password)
Enter-PSSession -ComputerName server2 -Credential $cred
Add-PSSnapin Microsoft.Sharepoint.Powershell –EA 0
Update-SPSolution -Identity TechSoup.Web.wsp -LiteralPath "C:\Program Files ...Debug\Some.wsp" -GacDeployment
I am successfully able to enter server2 using the first 3 lines. I now want to run the bottom two lines as administrator on server2 from server1. I am getting this error:
Update-SPSolution : Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again.
Can anyone help me with this ?? I need to deploy the wsp solution remotely.