In this post I am going to share below code the add and install the partial trust solution in solution gallery using Powershell script.
$WebApp= Get-SPWebApplication http://sharepointtest:5555
$site = Get-SPSite -WebApplication $WebApp -Limit All
$Sites = Get-SPSite -Limit All
foreach($Site in $Sites)
{
Add-SPUserSolution –LiteralPath "{WSP Path}" –Site $Site.Url
Install-SPUserSolution –Identity "{WSP Name}" –Site $Site.Url
}
$WebApp= Get-SPWebApplication http://sharepointtest:5555
$site = Get-SPSite -WebApplication $WebApp -Limit All
$Sites = Get-SPSite -Limit All
foreach($Site in $Sites)
{
Add-SPUserSolution –LiteralPath "{WSP Path}" –Site $Site.Url
Install-SPUserSolution –Identity "{WSP Name}" –Site $Site.Url
}