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 Knowledge Base
- :
- HOW TO: Stop a Windows Service using a Custom Action
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
HOW TO: Stop a Windows Service using a Custom Action
HOW TO: Stop a Windows Service using a Custom Action
Summary
This article will discuss one possible method of manually closing a Windows Service using a custom action.Synopsis
This article will discuss one possible method of manually closing a Windows Service using a custom action.
Discussion
To manually stop a windows service create the following Custom Action:
Type: New EXE , Path referencing a directory
Working Directory: SystemFolder
File Name and Command Line: cmd.exe /c "[WindowsFolder]system32\sc.exe stop NAME_OF_SERVICE"
Return Processing: Synchronous (Check Exit code)
In-Script Execution: Immediate Execution
Note: Closing Windows Services will require elevated privileges, the MSI will not elevate itself until after the InstallValidate action. Therefore care should be taken to place this custom action after InstallValidate if using a single MSI release.
If this custom action must be placed before InstallValidate we can force the MSI to run with elevated priviledges from the outset by using a Setup Launcher.
If this custom action must be placed before InstallValidate we can force the MSI to run with elevated priviledges from the outset by using a Setup Launcher.
Within the setup.exe tab of your release make sure that the "Required Execution Level" is "Administrator".
This will force the setup.exe to request Admin priviledges which are then carried over to the MSI allowing the custom action to run earlier than InstallValidate.
Additional Information
Further information regarding the SC tool including its parameters can be found in the following Microsoft article:
http://support.microsoft.com/kb/251192
No ratings