Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IISReset from MSI

42 views
Skip to first unread message

pie...@mentalis.org

unread,
Mar 12, 2007, 11:18:19 AM3/12/07
to
Hi everyone,

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

Christopher Painter

unread,
Mar 12, 2007, 2:12:57 PM3/12/07
to
First, how do you know the CSIDL_WINDOWS folder will always be C:
\Windows\ on all of your machine? You should really use the
WindowsFolder property. Also, why call a script custom action ( which
are known to be problematic ) when you could define a DOS EXE custom
action to do the same thing? For that matter, why have a custom
action when you could possibly use the ServiceControl table to have
Windows Installer shut the W3SVC service down at the beginning of your
installation transaction and start it back up at the end of your
transaction?

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.

Kalle Olavi Niemitalo

unread,
Mar 12, 2007, 4:33:12 PM3/12/07
to
pie...@mentalis.org writes:

> 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

pie...@mentalis.org

unread,
Mar 13, 2007, 9:16:51 AM3/13/07
to
> 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.

Thanks, that fixed it!

Christopher Painter

unread,
Mar 13, 2007, 2:24:48 PM3/13/07
to
I still wonder why the Custom Action is needed at all. One row in
your ServiceControl table should be enough to shut IIS down, do your
install and start it back up at the end.

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.

0 new messages