I have a setup package that installs some IIS components. During the
uninstall, an iisreset is done, to force IIS to release certain files
(that can then be deleted). I've written a little VBScript file that
calls iisreset, but for some reason the files didn't 'unlock' (even
though the lock was removed when I performed an iisreset from the
command line).
Upon further investigation, it seemed that the call to iisreset isn't
working from within the installer. The code in the VBScript file looks
like this:
Sub ResetIIS()
MsgBox "Before reset"
Set wshShell = WScript.CreateObject ("WScript.Shell")
wshshell.run "c:\Windows\System32\iisreset.exe", 0, true
MsgBox "After reset"
End Sub
When I call this code from the command line (with 'cscript'),
everything work's perfectly -- there's a pause of several seconds
between the two message boxes. When the same code is run in the
installer, the message boxes appear with no delay between them (and
the reset is not performed).
Does anyone know why this is happening, and how I can reset IIS?
Thanks!
Pieter
As for your actual problem of the CA not invoking, I'd have to see how
you defined the CA and what the logfile says is happening. It could
be a variety of reasons.
> Set wshShell = WScript.CreateObject ("WScript.Shell")
Windows Installer does not provide a WScript object to VBScript
custom actions. So you should perhaps use the built-in
CreateObject instead of WScript.CreateObject.
http://msdn2.microsoft.com/en-us/library/aa371538.aspx - script custom actions
http://msdn2.microsoft.com/en-us/library/xzysf6hc.aspx - WScript.CreateObject
http://msdn2.microsoft.com/en-us/library/dcw63t7z.aspx - CreateObject function
Thanks, that fixed it!
INSTALL W3SVC 51 NULL NULL YourComponent
Let StopServices and StartServices do the work for you during the
install and the uninstall of the associated component instead of a
potentially problematic ActiveScript based Custom Action.