Reputation: 3952
I have a .NET project that will change the responsibility of the PC's timekeeping from the Windows inbuilt W32Time service to the open-source NTP service.
So I need to disable the W32Time service during install. Can this be done using the ServiceControl
element, or is this just of use for ones own services? (The 'Remove' attribute suggests that it cant be used on other services).
If the latter I guess the next option is to use CustomAction
to run the sc stop
command?
(BTW, there are lots of similar questions, but As far as I can see they are all about services installed by the WIX installer).
Upvotes: 2
Views: 215
Reputation: 20780
ServiceControl will stop the service - the action isn't restricted to services that you install. However, what will you do if the service is configured to start at a reboot? There's no Windows Installer functionality to reconfigure a service you're not installing. You'd need code to change that setting.
I don't know exactly how you're doing this, or how far you've got with it all, but it's possible that if you're using the Time Provider functions then Windows will just stop the service for you (and mark it to not start a reboot) and there's no need to do anything about stopping it.
Upvotes: 3