Last active
August 29, 2015 14:19
-
-
Save Dalmirog-zz/c47a178cd2a4654f4fec to your computer and use it in GitHub Desktop.
Script For Harbinder
This file contains hidden or 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
$webSiteName = $OctopusParameters['Octopus.Action[Deploy Workware Legacy].IISWebSite.WebSiteName'] | |
$appPoolName = $OctopusParameters['Octopus.Action[Deploy Workware Legacy].IISWebSite.WebSiteName'] | |
Write-Output "Web Site: $webSiteName" | |
Write-Output "App Pool: $appPoolName" | |
Import-Module WebAdministration -Force | |
$webSite = Get-Website -Name $webSiteName | |
$appPool = Get-Item "IIS:\AppPools\$appPoolName" -ErrorAction SilentlyContinue | |
if ($webSite) | |
{ | |
Write-Output "Stopping Website: $($WebSite.name)" | |
Stop-Website $webSite.name | |
} | |
else | |
{ | |
Write-Output "Website not found on $($env:computername): $webSiteName" | |
} | |
If($appPool) | |
{ | |
If ($appPool.state -ne "Stopped") | |
{ | |
Write-Output "Stopping AppPool: $($AppPool.name)" | |
Stop-WebAppPool $appPool.Name | |
} | |
else | |
{ | |
Write-Output "AppPool was already stopped: $($appPool.name)" | |
} | |
} | |
else{ | |
Write-Output "AppPool not found on $($env:computername): $appPoolName" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment