如何使用vbscript在本地和远程系统中停止服务?如何在这些脚本中提供系统名称?如何使用单个vb脚本在多个系统中停止服务?
答案 0 :(得分: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中的属性获取服务名称。