Steve said:
What is the command syntax to stop a service on a remote
computer?
Hi
Sysinternals has a command line utility PsService that can do this:
http://www.sysinternals.com/ntw2k/freeware/pstools.shtml
ADSI can also be used for this (local and remote), here is a vbscript:
sComputer = "." ' use "." for local machine
sService = "messenger"
If StopService(sService, sComputer) Then
WScript.Echo sService & " stopped"
Else
WScript.Echo "Failed to connect to the service " & sService
End If
Function StopService(sService, sNode)
Const ADS_SERVICE_STOPPED = 1
Dim oComputer, oService
Set oComputer = GetObject("WinNT://" & sNode & ",computer")
On Error Resume Next
Set oService = oComputer.GetObject("Service", sService)
If Err.Number <> 0 Then
StopService = False
Exit Function
End If
If oService.Status <> ADS_SERVICE_STOPPED Then
oService.Stop
WScript.Sleep 1000
End If
StopService = True
End Function