Skip to content

Commit

Permalink
Updated deployment scripts to delete any existing aborted jobs before…
Browse files Browse the repository at this point in the history
… running
  • Loading branch information
ccoulson committed Apr 26, 2011
1 parent c2bf54c commit 29a0a59
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@
}
}

function DeleteTimerJob([string]$SolutionFileName)
{
$JobName = "*solution-deployment*$SolutionFileName*"
$job = Get-SPTimerJob | ?{ $_.Name -like $JobName }
if ($job -ne $null)
{
Write-Host 'Existing Timer job found. Deleting'
$job.Delete()
}
}



$url=$args[0]
$solutionName="Visigo.Sharepoint.FormsBasedAuthentication.wsp"
$featureName="FBAManagement"
Expand All @@ -31,14 +41,16 @@ $solutionPath=$pwd.ToString() + "\" + $solutionName

Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

DeleteTimerJob($SolutionName)

Write-Host 'Going to add solution'
Add-SPSolution $solutionPath

Write-Host 'Going to install solution to all web applications'
Install-SPSolution –identity $solutionName –allwebapplications –GACDeployment

Write-Host 'Waiting for job to finish'
WaitForJobToFinish
WaitForJobToFinish($SolutionName)

Write-Host 'Going to enable Feature'
Enable-spfeature -identity $featureName -confirm:$false -url $url
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
}
}

function DeleteTimerJob([string]$SolutionFileName)
{
$JobName = "*solution-deployment*$SolutionFileName*"
$job = Get-SPTimerJob | ?{ $_.Name -like $JobName }
if ($job -ne $null)
{
Write-Host 'Existing Timer job found. Deleting'
$job.Delete()
}
}

Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$url=$args[0]
Expand All @@ -31,6 +42,8 @@ $featureExists = Get-SPSolution $solutionName -ErrorAction SilentlyContinue
if ($featureExists)
{

DeleteTimerJob($solutionName)

Write-Host 'Going to disable feature'
disable-spfeature -identity $featureName -confirm:$false -url $url

Expand All @@ -41,7 +54,7 @@ if ($featureExists)
Uninstall-SPSolution -identity $solutionName -allwebapplications -confirm:$false

Write-Host 'Waiting for job to finish'
WaitForJobToFinish
WaitForJobToFinish($solutionName)

Write-Host 'Going to remove solution'
Remove-SPSolution –identity $solutionName -confirm:$false
Expand Down

0 comments on commit 29a0a59

Please sign in to comment.