This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Wait till spooler is Started/Stopped
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 14, 2015
05:51 AM
Wait till spooler is Started/Stopped
Hi,
I'm creating a Basic MSI project, on uninstall I need to delete some installed dll's, however to do this I need to start/stop the spooler, I can do this in install script using;
ServiceStopService("Spooler");
ServiceStartService("Spooler", "");
At present I have added a Delay(5); after each command before attempting to remove the files, however it can take longer or even be faster for the spooler to start on stop dependent on each users system, is there a way for me to check that the spooler has in fact been stopped or started before continuing execution of the script?
Many thanks in advance
I'm creating a Basic MSI project, on uninstall I need to delete some installed dll's, however to do this I need to start/stop the spooler, I can do this in install script using;
ServiceStopService("Spooler");
ServiceStartService("Spooler", "");
At present I have added a Delay(5); after each command before attempting to remove the files, however it can take longer or even be faster for the spooler to start on stop dependent on each users system, is there a way for me to check that the spooler has in fact been stopped or started before continuing execution of the script?
Many thanks in advance
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 15, 2015
07:07 PM
Out of curiosity, why don't you use MSI built-in functionality ServiceControl Table to stop and start service?
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 16, 2015
07:24 AM
I agree with TsungH. However if for some reason you can't do that you could use ServiceGetServiceState in a loop which delays say for 1 sec between iterations. After the delay check for the service stopped state. When its stopped you know its safe to proceed.
You might want to put an overall timeout on this though in case the service refuses to shutdown for some reason.
You might want to put an overall timeout on this though in case the service refuses to shutdown for some reason.