Last active
April 1, 2016 15:23
-
-
Save jhorsman/6931759 to your computer and use it in GitHub Desktop.
SDL Tridion CM services restart, start and stop with PowerShell
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
Write-Host "Restarting all Tridion Services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Tridion") -or $svc.displayname.StartsWith("SDL Web") -or $svc.displayname.StartsWith("SDL Delivery")) | |
{ | |
if($svc.Status -eq "Running") | |
{ | |
Write-Host " restarting"$svc.DisplayName | |
Restart-Service $svc.name -Force | |
} else { | |
Write-Host " ignoring"$svc.DisplayName", it is"$svc.Status | |
} | |
} | |
} | |
Write-Host "Stopping Tridion Component Service" | |
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog | |
$apps = $comAdmin.GetCollection("Applications") | |
$apps.Populate(); | |
$apps = $apps | Where-Object {$_.Name.StartsWith("SDL")} | |
foreach ($app in $apps) | |
{ | |
$comAdmin.ShutdownApplication($app.Name) | |
Write-Host " " $app.Name | |
} | |
Write-Host "Restarting IIS" | |
iisreset | |
Write-Host "Restarting Apache Services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Apache Tomcat")) | |
{ | |
if($svc.Status -eq "Running") | |
{ | |
Write-Host " restarting"$svc.DisplayName | |
Restart-Service $svc.name -Force | |
} else { | |
Write-Host " ignoring"$svc.DisplayName", it is"$svc.Status | |
} | |
} | |
} | |
pause |
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
Write-Host "Starting all Tridion services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Tridion") -or $svc.displayname.StartsWith("SDL Web") -or $svc.displayname.StartsWith("SDL Delivery")) | |
{ | |
Write-Host " starting"$svc.DisplayName | |
Start-Service $svc.name | |
} | |
} | |
Write-Host "(Re)starting IIS" | |
iisreset | |
Write-Host "Starting Apache Services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Apache Tomcat")) | |
{ | |
Write-Host " starting"$svc.DisplayName | |
Start-Service $svc.name -Force | |
} | |
} | |
pause |
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
Write-Host "Stopping all Tridion services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Tridion") -or $svc.displayname.StartsWith("SDL Web") -or $svc.displayname.StartsWith("SDL Delivery")) | |
{ | |
Write-Host " stopping"$svc.DisplayName | |
Stop-Service $svc.name -Force | |
} | |
} | |
Write-Host "Stopping Tridion Component Service" | |
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog | |
$apps = $comAdmin.GetCollection("Applications") | |
$apps.Populate(); | |
$apps = $apps | Where-Object {$_.Name.StartsWith("SDL")} | |
foreach ($app in $apps) | |
{ | |
$comAdmin.ShutdownApplication($app.Name) | |
Write-Host " " $app.Name | |
} | |
Write-Host "Stopping IIS" | |
iisreset -stop | |
Write-Host "Stopping Apache Services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("Apache Tomcat")) | |
{ | |
Write-Host " stopping"$svc.DisplayName | |
Stop-Service $svc.name -Force | |
} | |
} | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment