當我運行下面的命令:設置服務:因爲它是依賴於其他服務無法停止服務
Set-Service -ComputerName appserver -Name MyService -Status Stopped
我得到一個錯誤信息:
Set-Service : Cannot stop service 'My Service (MyService)' because it is dependent on other services. At line:1 char:12 + Set-Service <<<< -ComputerName appserver -Name MyService -Status Stopped + CategoryInfo : InvalidOperation: (System.ServiceProcess.ServiceController:ServiceController) [Set-Service], ServiceCommandException + FullyQualifiedErrorId : ServiceIsDependentOnNoForce,Microsoft.PowerShell.Commands.SetServiceCommand
我可以從停止服務services.msc
圖形用戶界面,我可以開始與Set-Service
服務,但我不能再阻止它。
這是事實,該服務依賴於一些其他的服務,但我不明白爲什麼會阻止我停止它—沒有別的取決於它。
如果你先停止服務不同? – Kage
'sc停止MyService'工作嗎? –
@Kage:'MyService'沒有依賴服務。它依賴於'AnotherService',但不能被停止,因爲'MyService'依賴於它。 – Wolfgang