SharePoint: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

I was deploying WSPs on my SharePoint box using the deployment script I created earlier and I hit the following error: "This solution contains resources scoped for a Web application and must be deployed to one or more Web applications." 
On checking the script I found that I had forgotten to check whether a particular  Solution contains a Web application resource or not.
if($Solution.ContainsWebApplicationResource)   
{
Install-SPSolution -Identity $SolutionPackageName -WebApplication $WebApplication -GACDeployment -Confirm:$false
}
else
{
Install-SPSolution -Identity $SolutionPackageName -GACDeployment -Confirm:$false
}
profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+