cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gigolojoe
Level 4

stopping services

Hi,
How do you stop various services and processes so you can update files using installscript or msi?
For example, I want to shutdown web services so I can update the assemblies.
Anybody know how to do stuff like that?

Thanks
GJ
Labels (1)
0 Kudos
(1) Reply
CHANDINATHREDDY
Level 7

'you can create an vbscript and call through an custom action

'you need to change the "NAME_OF_THE_SERVICE" to the internal service name not the service display name

'Stop Service
strServiceName = "NAME_OF_THE_SERVICE"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StopService()
Next
0 Kudos