TFS Release Application Pool Start-Stop

Team Service Erweiterung – Application Pool Start / Stop

Mit dem Tool Application Pool Start / Stop können Sie IIS Pools auf den lokalen Zielsystemen, auf dem die Build Agent installiert sind, starten bzw stoppen..

Über den folgenden Link bekommen Sie das komplette Paket als ZIP bereitgestellt. Das Skript ist kostenfrei und kann nach Ihren wünschen angepasst werden. Download Team Service Erweiterung Application Start / Stop

fe8c55a26b92a22edad8e61b03554283
  • Als Vorraussetzung ist wie beschrieben, dass der Build Agent auf dem Zielsystem installiert ist. Eine Anleitung für die Konfiguration finden Sie hier: Deploy an agent on Windows
  • Entpacken Sie das Zip und Importieren den PowerShell Task. Eine Beschreibung für den Import finden Sie hier:  Eigene TFS Build / Release Aufgaben bereitstellen
  • Erstellen Sie eine neue Release definition. Infos finden Sie hier: Define your CD release process
  • Fügen Sie jetzt Ihre Aufgaben wie SPS Deploy hinzu.
  • Geben Sie nun alle notwendigen Werte ein und führen die Bereitstellung aus.

Folgende Parameter können Sie mitgeben:

  • Application Pool name : Name des Pools
  • Application Pool STOP/START. Start, Stop, Restart
Team Service Erweiterung Application Start / Stop
Team Service Erweiterung Application Start / Stop
param (
    [string]$ApppoolName,
    [string]$stopstart      
)

Write-Output "Impeo Pool Name - $ApppoolName"
Write-Output "Action selected - $stopstart"
     
if ($stopstart -eq "stop")
{
    Write-Output "Stopping the Application Pool - ($AppPoolName)......."
    import-module WebAdministration
    if((Get-WebAppPoolState $AppPoolName).Value -ne 'Stopped')
    {
		Write-Output "Run: Stop-WebAppPool -Name $AppPoolName"
        Stop-WebAppPool -Name $AppPoolName
        Write-Output "Application Pool - ($AppPoolName) stopped successfully!" 
    }
     else
    {
        Write-Output "Application Pool - ($AppPoolName) already in stop state!"
    }
}

if ($stopstart -eq "start")
{
    Write-Output "Starting the Application Pool - ($AppPoolName)......."
    import-module WebAdministration
    if((Get-WebAppPoolState $AppPoolName).Value -ne 'Started')
    {
		Write-Output "Run: Start-WebAppPool -Name $AppPoolName"
        Start-WebAppPool -Name $AppPoolName
        Write-Output "Application Pool - ($AppPoolName) started successfully!"
    }
    else
    {
        Write-Output "Application Pool - ($AppPoolName) already in start state!"
    }
}

if ($stopstart -eq "restart")
{
    Write-Output "Restarting the Application Pool - ($AppPoolName)......."
    import-module WebAdministration
    if((Get-WebAppPoolState $AppPoolName).Value -ne 'Stopped')
    {
		Write-Output "Run: Restart-WebAppPool -Name $AppPoolName"
        Restart-WebAppPool -Name $AppPoolName
        Write-Output "Application Pool - ($AppPoolName) restarted successfully!"
    }
    else
    {
        Write-Output "Application Pool - ($AppPoolName) can not be restarted as it is in stop state. Please start it first!"
    }
}

Weitere Infos:

Release Management