Hello Danny
Thanks for your reply here is the code which I have tried with , Plesae find the code which I got from Scripting guide at the bottom
**************firt set of code
sComputer = "." ' use "." for local machine
sService = "ACI SNMP DCNServer EMGEN"
If StopService(sService, sComputer) Then
WScript.Echo sService & " stopped and Changed Startup mode"
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
Exit Function
End If
If oService.Status <> ADS_SERVICE_STOPPED Then
oService.Stop
WScript.Sleep 1000
Set err = oService.Change( , , , , "demand")
WScript.Echo err
End If
StopService = True
End Function
******************second set of statements tried from windiws scripting guide, which gives error number 2*****
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name = 'ACI SNMP DCNServer EMGEN'")
For Each objService in colServiceList
errReturnCode = objService.Change( , , , , "Disabled")
WScript.Echo errReturnCode
Next