Created
October 7, 2015 17:32
-
-
Save kimgunnarsson/0de34ef829a41707759a to your computer and use it in GitHub Desktop.
PreDeploy.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module WebAdministration | |
if($SiteNamesForDeploy) { | |
$sitesForDeploy = $SiteNamesForDeploy.Split(',') | |
for ($i=0; $i -lt $sitesForDeploy.length; $i++) { | |
$currentSite = $sitesForDeploy[$i].Trim() | |
Write-Output "Stop-Website $currentSite" | |
try { | |
Start-Website $currentSite | |
} catch { | |
Write-Output "Could not run command Start-Website $currentSite" | |
Exit 1 | |
} | |
} | |
Exit 0 | |
} else { | |
Write-Output "Variable 'SiteNamesForDeploy' is not set - failing action Start-Website" | |
Exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment