Two things stand out.  

 

1)      You custom action sequencing is wrong.  Review the WiX tutorial and the 
MSI docs on execution sequencing.  The files you’re trying to use ARE NOT 
installed until after a great number of actions already take place.

2)      I’ve never tried to execute msiexec from a script inside of an MSI 
package.  There may be some other caveats with this.  Perhaps others on the 
list know more.

 

Try reviewing the log file to see what is going on; 

msiexec /l*vx install.log /I [your.msi]

 

The log will tell you what is failing and when and usually why it failed.

 

-Robert.

 

From: Nathan Lane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 24, 2007 4:58 PM
To: Robert Randall
Cc: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] How to use CustomAction with a VBScript

 

So here's what I have, and my installer errors out when I try to run it, saying 
that something was wrong with the script.

WXS File:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns=' http://schemas.microsoft.com/wix/2003/01/wi'>
    <Product Name=".com Applications" Id="53164a64-f286-11db-8314-0800200c9a66" 
Language="1031" Codepage="1252" Version=" 1.0.0" Manufacturer=".com">
        <Package Id="53164a65-f286-11db-8314-0800200c9a66" Compressed="yes" 
Description="This installer will install all of the portals and services 
necessary to run the .com web site." InstallerVersion="100" Languages="1031" 
Manufacturer=".com" ShortNames="no" /> 
        <Media Id="1" Cabinet="App.cab" EmbedCab="yes" />
        <Property Id="ROOTDRIVE" Value="C:\" />
        <Directory Id="ApplicationInstallers" Name="SourceDir"> 
            <Directory Id="Setup" Name="Setup">
                <Component Id="InstallationMSIs" Guid= 
"53164a67-f286-11db-8314-0800200c9a66">
                    <File Id=" ASPAAJAXExtSetup.msi" 
LongName="ASPAJAXExtSetup.msi" Name="AJAXSET.MSI" 
Source="setup\ASPAJAXExtSetup.msi" DiskId="1" />
                    <File Id="dotnetfx3.exe " LongName="dotnetfx3.exe" 
Name="DOTNET3.MSI" Source="setup\dotnetfx3.exe" DiskId="1" />
                    <File Id="AdministrativePortal.msi" LongName=" 
Administrative Portal.msi" Name="VAP.MSI" Source="setup\ Administrative 
Portal.msi" DiskId="1" />
                    <File Id="CablePortal.msi" LongName=" Cable Portal.msi" 
Name=" VCABP.MSI" Source="setup\ Cable Portal.msi" DiskId="1" />
                    <File Id="ConsumerPortal.msi" LongName=" Consumer 
Portal.msi" Name="VCP.MSI" Source="setup\ Consumer Portal.msi" DiskId="1" />
                    <File Id="DealerPortal.msi" LongName=" Dealer Portal.msi" 
Name="VDP.MSI" Source="setup\ Dealer Portal.msi" DiskId="1" /> 
                    <File Id="GlobalScripts.msi" LongName=" Global Scripts.msi" 
Name="GSCRIPTS.MSI" Source="setup\ Global Scripts.msi" DiskId="1" />
                    <File Id=" ServiceHost.msi" LongName=" Service Host.msi" 
Name="VSH.MSI" Source="setup\ Service Host.msi" DiskId="1" />
                    <File Id="ServicesPortal.msi" LongName=" Services 
Portal.msi" Name="VSP.MSI" Source="setup\ Services Portal.msi" DiskId="1" />
                    <File Id="StatisticsCollector.msi" LongName=" Statistics 
Collector.msi " Name="VSC.MSI" Source="setup\ Statistics Collector.msi" 
DiskId="1" />
                </Component>
            </Directory>
        </Directory>
        <Feature Id="Complete" Title=".com Complete Installation" 
Description=".com Complete Application Installation" Display="expand" 
Level="1"> 
            <Feature Id="MainProgram" Title=".com Web Application" 
Description=".com Web Application" Level="1">
                <ComponentRef Id="InstallationMSIs" /> 
            </Feature>
        </Feature>
        <Binary Id="GlobalInstallerVBScript" 
SourceFile="GlobalApplicationInstaller.vbs" />
        <CustomAction Id="Stop_IIS" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="ShutdownIIS" Return="check" /> 
        <CustomAction Id="Uninstall_VCP" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallConsumerPortal" Return="check" />
        <CustomAction Id="Uninstall_CCP" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallCConsumerPortal" Return="check" /> 
        <CustomAction Id="Uninstall_VDP" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallDealerPortal" Return="check" />
        <CustomAction Id="Uninstall_VAP" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallAdminPortal" Return="check" /> 
        <CustomAction Id="Uninstall_VSP" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallServicePortal" Return="check" />
        <CustomAction Id="Uninstall_VSL" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="UninstallServiceLayer" Return="check" /> 
        <CustomAction Id="Install_VSL" BinaryKey="GlobalInstallerVBScript" 
VBScriptCall="InstallServiceLayer" Return="check" />
        <InstallExecuteSequence>
            <Custom Action="Stop_IIS" Sequence="1" />
            <Custom Action="Uninstall_VCP" Sequence="2" />
            <Custom Action="Uninstall_CCP" Sequence="3" /> 
            <Custom Action="Uninstall_VDP" Sequence="4" />
            <Custom Action="Uninstall_VAP" Sequence="5" />
            <Custom Action="Uninstall_VSP" Sequence="6" /> 
            <Custom Action="Uninstall_VSL" Sequence="7" />
            <Custom Action="Install_VSL" Sequence="8" />
        </InstallExecuteSequence>
    </Product>
</Wix>

VBScript File:
' VBScript for use with .com WiX Global Installer

Public Function ShutdownIIS()
    Set WshShell = WScript.CreateObject("WScript.Shell") 
    WshShell.Run "iisreset -stop"
    WshShell.Run "net stop ServiceHost"
    
    Return 0
End Function

Public Function UninstallConsumerPortal()
    Set WshShell = WScript.CreateObject ("WScript.Shell")
    WshShell.Run "msiexec /X{8FD4634C-4849-4EC4-8582-500406D36F2C} /PASSIVE"
    
    Return 0
End Function

Public Function UninstallCConsumerPortal()
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "DEL \"D:\\Services\\IIS\\C Consumer Portal\\*.*\" /F /S /Q"
    
    Return 0
End Function

Public Function UninstallDealerPortal() 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "msiexec /X{45542887-0778-4F9F-8ABD-F2D4D9B7395C} /PASSIVE"
    
    Return 0
End Function

Public Function UninstallAdminPortal() 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "msiexec /X{75EF7830-B762-4F14-ADCF-29618E52D976} /PASSIVE"
    
    Return 0
End Function

Public Function UninstallServicePortal() 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "msiexec /X{9F000CEC-E910-47E9-A339-6D36F6261760} /PASSIVE"
    
    Return 0
End Function

Public Function UninstallServiceLayer() 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "msiexec /X{721A2FBE-2B75-48F9-B6A0-AF94707CAF19} /PASSIVE"
    
    Return 0
End Function

Public Function InstallServiceLayer() 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "msiexec /package \"C:\\Setup\\Service Host.msi\" /PASSIVE /lv 
logfiles\VSL.log SERVICEUSERNAME=\"\SLadmin\" SERVICEPASSWORD=\"v3h1x\"" 
    
    Return 0
End Function

Can anybody help more?

Thanks,

Nathan

On 4/24/07, Robert Randall < <mailto:[EMAIL PROTECTED]>  [EMAIL PROTECTED]> 
wrote:

 

Nathan, here are a couple of snippets that might help.  You need to use the 
Binary to get the script into the MSI database and then you reference it in a 
custom action.  The custom action calls a specific funtion in the script 
source.  Then you need to reference the custom action your 
InstallExecuteSequence.  This example checks for the existance a WMI class.

 

 

<Binary Id='InstallerScripts' SourceFile ='InstallerScripts.vbs' />

<CustomAction Id='CustomAction_VerifyHbaApiSupport' 
BinaryKey='InstallerScripts' VBScriptCall= 'IsHbaApiInstalled' Return='check' />

 

<InstallExecuteSequence>

…

<Custom Action="CustomAction_VerifyHbaApiSupport" 
After="LaunchConditions">$Component_Dsm>2</ Custom>

…

</InstallExecuteSequence>

 

My VBScript looks like

 

'

public function IsHbaApiInstalled()

 

      on error resume next

 

      '

      ' required error code for a failure see MSI docs

      '

      IsHbaApiInstalled = 1603

      '

      ' get an instance of SWbemWebServices thru a moniker handling

      ' security and and the CIM namespace we need

      '

      Set sWbemService = 
GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi")

      

      '

      ' query a class def - arbitrary choice...

      '

      Set sWbemObjs = sWbemService.ExecQuery("select * from meta_class where 
__this isa 'MSFC_FCAdapterHBAAttributes'", "WQL", 0)

      

      '

      ' if we got here the class is in the repository and

      ' all is good...

      '

      if Err.Number = 0 then

            IsHbaApiInstalled = 0 ' see MSI docs

      else

            '

            ' TODO:  should use Session.Message eventually and pull the

            '        message from the database to allow for localization

            '

            MsgBox "Microsoft support for the HBA API is not installed.  This 
package requires Microsoft support for the HBA API.  Support is included in the 
Fibre Channel Information Tool (fcinfo).  See Microsoft's web site for more 
information and to download the tool.  After installing the Fibre Channel 
Information Tool try installing Seagate ISE MPIO." & vbCrLf & vbCrLf &  "The 
installation process cannot continue.", vbOKOnly, ""

      end if

      

      exit function

 

end function

 

 

Regards,

Robert.

 

From: [EMAIL PROTECTED] [mailto: <mailto:[EMAIL PROTECTED]>  [EMAIL PROTECTED] 
On Behalf Of Nathan Lane
Sent: Tuesday, April 24, 2007 1:40 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How to use CustomAction with a VBScript

 

Hello all,

I am in need of using some VBScripts in my installation and have learned that 
one can use a CustomAction to reference and eventually execute the VBScript.  
But I'm not understanding how that actually works.  Looking at the Manual > 
Schema reference, I am very confused about what attributes to set and how to 
set them.  Could somebody help me out? 

Thanks,

-- 
Nathan Lane 




-- 
Nathan Lane 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to