2013-09-26 40 views

回答

0

試試這個:

Set objWSH = CreateObject("WScript.Shell") 
strServiceName = "MyService" 
strOnServer = "\\ServerName" 
intReturn = objwsh.Run("SC " & strOnServer & " Stop " & strServiceName, 0, True) 
If (intReturn <> 0) Then MsgBox ("DID NOT successful stop " & strServiceName) Else MsgBox "Sucessfully stopped " & strServiceName 

你必須在SERVICES.MSC屬性得到服務名稱。

+0

如果我需要在遠程系統中停止服務,如何更改上面的腳本? – Pinky

+0

我剛更新了代碼。 –

+0

如果我需要在多個系統中停止服務,如何更改上面的腳本? – Pinky