无法理解为什么我无法使用powershell'stop-service'来停止服务,因为我可以使用'net stop'命令来阻止它。
该服务有一个停止的相关服务(不是同步问题,我已经在停止相关服务后10分钟进行了测试)。
对不起法语版的输出......
PS C:\> stop-service pgsql-8.3
Stop-Service : Impossible d'arrêter le service « PostgreSQL Database Server 8.3 (pgsql-8.3) », car d'autres services en dépendent. Il peut être arrêté uniquement si l'indicateur Force est défini.
Au niveau de ligne : 1 Caractère : 13
+ stop-service <<<< pgsql-8.3
+ CategoryInfo : InvalidOperation: (System.ServiceProcess.Service
Controller:ServiceController) [Stop-Service], ServiceCommandException
+ FullyQualifiedErrorId : ServiceHasDependentServices,Microsoft.PowerShell
.Commands.StopServiceCommand
PS C:\> net stop pgsql-8.3
Le service PostgreSQL Database Server 8.3 s'arrête.
Le service PostgreSQL Database Server 8.3 a été arrêté.
powershell建议的唯一方法是强行停止。有没有办法避免这种行为?
提前致谢。
丹尼斯
答案 0 :(得分:0)
Stop-Service 'pgsql-8.3' -Force
Get-Service 'pgsql-8.3' -DependentServices |停止服务 - 详细
Get-Service 'pgsql-8.3' -DependentServices
Stop-Service 'pgsql-8.3' -Verbose
Start-Service 'pgsql-8.3' -Verbose