Sunday, February 10, 2013

PowerShell : Waiting for a deployment job to finish

This function pasuses further script until a deployment job is finished
Function WaitForInsallation([string] $Name){
 Write-Host -NoNewline "Waiting for deployment job to complete" $Name "."
 $wspSol = get-SpSolution $Name
 while($wspSol.JobExists)
 {
  sleep 2
  Write-Host -NoNewline "."
  $wspSol = get-SpSolution $Name
 }
 Write-Host ""
 Write-Host -ForegroundColor Green "Deployment job is finished" 
}

No comments:

Post a Comment