Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PreDeploy.ps1
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