I have found the answer here:
I hope this helps someone who needs this.
Here is how it worked for me:
On Client:
Enable-PSRemoting Enable-WSmanCredSSP -Role "Client" -DelegateComputer clientmachinename -Force Also, go to gpedit.msc and look at the following policy: Computer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credentials and Allow Delegating Fresh Credentials with NTLM. Enable the state and add SPN to Server List for Remote Server(Sandbox 7). In our case it will be: WSMAN/clientmachinename. Click Okay, save and exit.
On Server: (Where WSP file is present and needs to be deployed)
Enable-PSRemoting Enable-WSmanCredSSP -Role Server winrm set winrm/config/winrs '@{MaxShellsPerUser="25"}' winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="600"}' Click Yes/Yes to all till the dialog box appear.
Now Our System is configured for Remote execution of Powershell command.
Once, this is done, go to Client and run this command:
$password = ConvertTo-SecureString "your password" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("username",$password) Invoke-command -computername yourServerName -credential $cred -authentication CredSSP -scriptblock {Add-PSSnapin Microsoft.Sharepoint.Powershell –EA 0 Update-SPSolution -Identity yourfile.wsp -LiteralPath "C:\Program Files (x86)\(location of your file)...\yourfile.wsp" -GacDeployment} The above script will deploy our wsp file to Server. Make sure that you run these commands in administrator mode.