question

NikosSkatzis-6730 avatar image
0 Votes"
NikosSkatzis-6730 asked NikosSkatzis-6730 answered

PS script for deploying undeployed solutions

Hi,

After our SP2013 farm migration, I know that all our solutions will get undeployed and I want a quick way to redeploy them.
Some of them are deployed globally and some others for specific sites.
So, I'd like a script that will recognize that and redeploy them accordingly.

In https://www.sharepointdiary.com/2015/04/deploy-multiple-solutions-in-sharepoint-using-powershell.html, I see the following script:

#Deploy all installed solutions in the farm
Get-SPSolution | ForEach-Object { if (!$.Deployed) {
If ($
.ContainsWebApplicationResource -eq $False) { #Globally deployed
Install-SPSolution -Identity $ -GACDeployment
}
else {#Localy deployed
Install-SPSolution -Identity $
-AllWebApplications -GACDeployment
}
}
}

which I think it's not correct in the case that I have a specific site.
For my testings, ps command must be
Install-SPSolution -Identity $_ -WebApplication $webAppName -GACDeployment

Could you help me finding webAppName modifying the script?
And two more things:
a) Do I have to wait (adding a sleep interval for example) until each solution gets deployed?
b) There is also -force option in install-spsolution. Does it make sense if I use it?

Pardon my ignorance but I'm not familiar with PS.

Thank you,
Nikos






windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @NikosSkatzis-6730

Answering your question one by one, it is ideal to wait for each solution to get deployed.

Considering in general the Install-SPSolution cmdlet deploys an installed SharePoint solution on the farm. Use the Add-SPSolution cmdlet to install a SharePoint solution package on the farm.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets. Using the below link.

https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-server/sharepoint-server-cmdlets?view=sharepoint-ps

You can use the below PS script to execute Install-SPSolution

    [-Identity] <SPSolutionPipeBind>
    [-AllWebApplications]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-CASPolicies]
    [-CompatibilityLevel <String>]
    [-Confirm]
    [-Force]
    [-FullTrustBinDeployment]
    [-GACDeployment]
    [-Language <UInt32>]
    [-Local]
    [-Time <String>]
    [-WebApplication <SPWebApplicationPipeBind>]
    [-WhatIf]
    [<CommonParameters>]

To get to know further about the "Install-SPSolution " Do follow the below link,

https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/install-spsolution?view=sharepoint-ps

Hope this answers all your queries, if not please do repost back.
If an Answer is helpful, please click "Accept Answer" and upvote it : )

Regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

NikosSkatzis-6730 avatar image
0 Votes"
NikosSkatzis-6730 answered

Hello,

Well, actually I'm interested to change the script and variable $webAppName and use it when the solution is not globally deployed.
Install-SPSolution -Identity $_ -WebApplication $webAppName -GACDeployment

Thank you

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.