Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SDL Tridion CM services restart, start and stop with PowerShell
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
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
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