Created
October 22, 2013 14:10
-
-
Save jhorsman/7101439 to your computer and use it in GitHub Desktop.
SDL Quatron 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 running SDL Quatron Services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron")) | |
{ | |
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 | |
} | |
} | |
} | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron")) | |
{ | |
Get-Service $svc.name | |
} | |
} | |
Write-Host | |
Write-Host "Restarting IIS" | |
iisreset | |
Write-Host | |
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 SDL Quatron services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron") -and ($svc.Status -ne "Running")) | |
{ | |
Write-Host " "$svc.DisplayName | |
Start-Service $svc.name | |
} | |
} | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron")) | |
{ | |
Get-Service $svc.name | |
} | |
} | |
Write-Host | |
Write-Host "Restarting IIS" | |
iisreset | |
Write-Host | |
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 SQL Quatron services" | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron") -and ($svc.Status -ne "Stopped")) | |
{ | |
Write-Host " "$svc.DisplayName | |
Stop-Service $svc.name -Force | |
} | |
} | |
foreach ($svc in Get-Service) | |
{ | |
if($svc.displayname.StartsWith("SDL Quatron")) | |
{ | |
Get-Service $svc.name | |
} | |
} | |
Write-Host | |
Write-Host "Stopping IIS" | |
iisreset -stop | |
Write-Host | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment