powershell SDL Quatron服务使用PowerShell重新启动,启动和停止

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell SDL Quatron服务使用PowerShell重新启动,启动和停止相关的知识,希望对你有一定的参考价值。

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
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
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

以上是关于powershell SDL Quatron服务使用PowerShell重新启动,启动和停止的主要内容,如果未能解决你的问题,请参考以下文章

powershell 管理SDL Web 8服务

powershell 管理SDL Web 8服务

powershell 使用SDL Web核心服务编辑组件

powershell 使用SDL Web核心服务编辑组件

powershell 脚本启动SDL Web 8.5微服务

powershell 使用Windows服务依赖性安装SDL Web Content Delivery mico服务