1. Create a VBScript Custom Action (RestartIIS) Stored in Binary Table (MSI Type Number: 6)
2. Write the following code in the VBScript file
Function RestartIIS()3. Set the following properties for the Custom Action (RestartIIS)
Set wsShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
winPath = WsShell.ExpandEnvironmentStrings( "%windir%" )
netPath = fso.BuildPath( winPath, "system32" )
toolPath = fso.BuildPath( netPath, "iisreset.exe" )
WsShell.Run toolPath, 0, true
set fso=nothing
set WsShell=nothing
End Function
Script Function -> RestartIIS[Note: This code snippet is tested with InstallShield 2012 Basic MSI Project. Should be compatible with earlier versions of InstallShield as well.]
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate Execution
Install Exec Sequence -> After InstallFinalize
Install Exec Condition -> &FeatureA=3 and Installed
This condition means that FeatureA is selected for installation and the FeatureA is installed (Installed state will be true as the CA is scheduled to execute after InstallFinalize).
No comments:
Post a Comment