Wait for a Solution to deploy with PowerShell – like execadmsvcjobs used to…
June 13, 2011 1 Comment
With previous versions of SharePoint is was usually possible to wait for a solution deployment to execute by running the STSADM –o execadmsvcjobs command.
With SharePoint 2010 and PowerShell, things can be done a little differently. The script snippet below can be used to wait for a Solution deployment to complete before the script continues and usefully shows deployment progress whilst waiting…
## Get the solution
$Solution = Get-SPSolution -identity $SolutionFileName
$lastStatus = ""
## loop whilst there is a Job attached to the Solution
while ($Solution.JobExists -eq $True)
$currentStatus = $Solution.JobStatus
if ($currentStatus -ne $lastStatus)
Write-Host "$currentStatus…" -foreground green -nonewline
$lastStatus = $currentStatus
Write-Host "." -foreground green -nonewline
Write-Host " " $Solution.LastOperationDetails -foreground green
…the above can be used as the equivalent to the old stsadm –o execadmsvcjobs command.
I hope this helps…