Stopping a Service
I am required to send out a package that will stop a service before installing the new app...I have tried to stop it with the Services page but it results in an error 1306. Another application has exclusive rights to this file...as this is an antivirus package, it is imperative that I stop the service just before installing the new one...any help will be appreciated...thanx...
0 Comments
[ + ] Show comments
Answers (8)
Please log in to answer
Posted by:
bkelly
20 years ago
Assuming the vendor does not provide any command-line means of stopping it, I would say you are looking at a reboot. Set the service to disabled (or manual) in the registry and reboot- when Windows starts back up it should not start and you can do as you wish.
Before going down this path, try the upgrade and make sure the vendor has not accounted for this situation for you.
Best of luck,
Bob
Before going down this path, try the upgrade and make sure the vendor has not accounted for this situation for you.
Best of luck,
Bob
Posted by:
robco
20 years ago
thanx Bob...the antivirus software has to be sent out to > 1500 PC's and the service must not be off much longer than it takes to install the msi with the new app...I was hoping I could stop the service at the beginning of the execution of the msi...this way we are not open to attacks...I am trying to use launch command from path using taskkill.exe...
Posted by:
bkelly
20 years ago
Killing the service is not a bad idea, and this is certianly one way to do it- but if it won't let you- you are forced to seek alternatives. What AntiVirus software is it? I would be suprised if there was not a scripted installation option that would handle the previous/running instance of itself on the target systems. This sounds like a situation that lends itself to a command-line installation instead of repacking. If you must have a MSI, you could always use the MSI to call the command line installation. Take a look at the Package Knowledge Base for tips.
Posted by:
robco
20 years ago
we are switching from Inoculan to McAfee...I was hoping to handle all of the tasks from 1 msi for ease and efficiency but it looks like we may have to run a command in Tivoli to handle the service followed by the new msi...I will continue to work on this problem with-in the msi just in case...thanx for your prompt response and ideas...
Posted by:
thales
20 years ago
can you make a batch like that:
net stop ure_service
sc \\%computername% config ure_service start= disabled
msiexec /I uremsi.msi
net start ure_service
sc \\%computername% config ure_service start= auto
---------------
sc query - Queries the status for a service, or enumerates the status for types of services
net stop ure_service
sc \\%computername% config ure_service start= disabled
msiexec /I uremsi.msi
net start ure_service
sc \\%computername% config ure_service start= auto
---------------
sc query - Queries the status for a service, or enumerates the status for types of services
Posted by:
robco
20 years ago
Posted by:
Robo Scripter
20 years ago
From the Window 2000 Scripting Guide
Stoping a service and it's dependencies
'---------------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='NetDDE'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For each objService in colServiceList
objService.StopService()
Next
Wscript.Sleep 20000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='NetDDE'")
For each objService in colServiceList
errReturn = objService.StopService()
Next
'---------------------------------------------------------------------------------------------
Stoping a service under a specific account
'---------------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServices = objWMIService.ExecQuery _
("Select * from win32_Service")
For each objService in colServices
If objService.StartName = ".\netsvc" Then
errReturnCode = objService.StopService()
End If
Next
'---------------------------------------------------------------------------------------------
Hope this helps
Regards,
Stoping a service and it's dependencies
'---------------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='NetDDE'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For each objService in colServiceList
objService.StopService()
Next
Wscript.Sleep 20000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='NetDDE'")
For each objService in colServiceList
errReturn = objService.StopService()
Next
'---------------------------------------------------------------------------------------------
Stoping a service under a specific account
'---------------------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServices = objWMIService.ExecQuery _
("Select * from win32_Service")
For each objService in colServices
If objService.StartName = ".\netsvc" Then
errReturnCode = objService.StopService()
End If
Next
'---------------------------------------------------------------------------------------------
Hope this helps
Regards,
Posted by:
robco
20 years ago
thanx for your suggestion Robo Scripter...I have suggested we test another way to stop this service should time permit...our Desktop admins have elected to use
c:\windows\system32\taskkill /f /t /im "progname".exe etc to stop the service...it does work when sent out with tivoli before the install of the new package...
c:\windows\system32\taskkill /f /t /im "progname".exe etc to stop the service...it does work when sent out with tivoli before the install of the new package...
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.