Currently I have failed to pass parameters from CAQuiteExec to cmd.exe batch.
(Inspired by wix, install files and run bat file)
In deferred sequence, the installer can call commandline command "copy" and "echo" but parameter %1 is always blank...
I want to pass a Value="HAHIHUHEHO" of Property "BATCHPARAMETER" to the configure.bat. But ECHO returns its own status "ON" (same as only ECHO without any input parameter....)
Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="MY-UID" Name="my_name" Language="1033" Version="1.11.5164" Manufacturer="company" UpgradeCode="MY-UID">
<Package Description="Test file in a Product" Comments="Simple test" InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="my_folder" Id="MY_FOLDER">
<Component Id="CONFIGURE.BAT" DiskId="1" Guid="MY-UID">
<File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="Main Feature" Level="1">
<ComponentRef Id="CONFIGURE.BAT" />
</Feature>
<UI />
<UIRef Id="WixUI_Minimal" />
<Property Id="BATCHPARAMETER" Value="HAHIHUHEHO" Secure="yes" />
<CustomAction Id="SetCustomActionData" Return="check" Property="BatchCmd" Value="[BATCHPARAMETER]" />
<CustomAction Id="BatchCmd" Property="BatchRun" Value=""[#file_configure.bat]"" Execute="immediate">
</CustomAction>
<CustomAction Id="BatchRun" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="yes">
</CustomAction>
<InstallExecuteSequence>
<Custom Action="SetCustomActionData" Before="BatchCmd"></Custom>
<Custom Action="BatchCmd" Before="BatchRun">NOT Installed</Custom>
<Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
configure.bat content is below:
It copies the hoge.txt to a hoge{%date% without slash}.txt and writes %1 parameter inside.
setlocal
echo on
copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
echo %1 > C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt 2>&1
echo off
endlocal
exit /B 0
You're using the incorrect 'Value' for the custom action data. (I think you also meant to use Property="BatchRun" as this is the deferred custom action??)
<CustomAction
Id="SetCustomActionData"
Return="check"
Property="BatchRun"
Value="BATCHPARAMETER=[BATCHPARAMETER]" />
Take a look at this answer for a more in-depth example of custom action data. You can also do multiple property values in one custom action by separating properties with a ;.
If you are going to use a deferred custom action, don't just run a bat file inside your custom action, rewrite the behaviour of the bat file in the custom action itself so there's no need for a bat file in the first place.
This is self reply and not exact answer,
but I finally get output "HAHIHUHEHO" in C:\temp\hoge\hoge{%date%}.txt (Not Quiet Exec, thank you #Brian Sutherland!):
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="my-uid" Name="my_name" Language="1033" Version="1.11.5164" Manufacturer="company" UpgradeCode="my-uid">
<Package Description="Test file in a Product" Comments="Simple test" InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="my_folder" Id="MY_FOLDER">
<Component Id="CONFIGURE.BAT" DiskId="1" Guid="my-uid">
<File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="Main Feature" Level="1">
<ComponentRef Id="CONFIGURE.BAT" />
</Feature>
<UI />
<UIRef Id="WixUI_Minimal" />
<Property Id="CMD">
<DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
<FileSearch Id="CmdExe" Name="cmd.exe" />
</DirectorySearch>
</Property>
<Property Id="BATCHPARAMETER" Value="HAHIHUHEHO" Secure="yes" />
<CustomAction Id="SetCustomActionData" Return="check" Property="BatchRun" Value="BATCHPARAMETER=[BATCHPARAMETER]" />
<CustomAction Id="BatchRun" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c ""[#file_configure.bat]" "[BATCHPARAMETER]""" />
<InstallExecuteSequence>
<Custom Action="SetCustomActionData" Before="BatchRun"></Custom>
<Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
configure.bat
I cannot find the way directly to the batch file in QuietExec by embedded syntax...(like ExeCommand="/c ""[#file_configure.bat]" "[BATCHPARAMETER]""" />)
setlocal
echo on
copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
echo %1 > C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt 2>&1
echo off
endlocal
exit /B 0
I had a very similar issue, ran a BAT file from WIX, as an EXE Package.
On some computers the whole procedure failed error being
Error 0x80070001: Process returned error: 0x1
Error 0x80070001: Failed to execute EXE package.
Error 0x80070001: Failed to configure per-machine EXE package.
The fix was to remove the /b from the exit command, at the end of the BAT file.
After this, everything suddenly worked!
Related
I want add some extension after installation, so tried to add custom action for adding extension in using Wix but now I want remove the folder when performing uninstall action extension folder is not getting removed.
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="TargetProgram" Guid="f757ff43-0266-483a-8749-ec796cba4b25" >
<File Id="EXE" Source="C:\Windows\System32\cmd.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="SetTARGETDIR"
Directory="TARGETDIR"
Value="Pathtoextensionadd"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetTARGETDIR" Before="InstallFinalize">Installed </Custom>
</InstallExecuteSequence>
<CustomAction Id='EXECUTE_AFTER_FINALIZE'
Directory='TARGETDIR'
Impersonate='yes'
Execute='deferred'
ExeCommand='command line argument that install extension in "Pathtoextensionadd"' Return='check' />
<InstallExecuteSequence>
<Custom Action="EXECUTE_AFTER_FINALIZE" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
Installation is done correctly.
How can I remove that "Pathtoextensionadd" folder?
<?define AppCacheFolder ="Pathtoextensionadd" ?>
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Component Id="CacheCleanup" Guid="">
<RegistryValue Root="HKCU"
Key="$(var.AppRegKey)"
Name="CachePath"
Type="string"
Value="$(var.AppCacheFolder)"
KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="CACHEFOLDER" />
</Component>
</DirectoryRef>
</Fragment>
below code added under Product Tag
<?define AppRegKey ="RegPath" ?>
<Property Id="CACHEFOLDER">
<RegistrySearch Key="$(var.AppRegKey)"
Root="HKCU"
Type="raw"
Id="CacheFolderRegSearch"
Name="CachePath" />
</Property>
under feature tag
<ComponentRef Id="CacheCleanup" />
We have an install script in Wix, which contains Fragments, components and some custom actions:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util='http://schemas.microsoft.com/wix/UtilExtension' >
<Product Id="*" Name="Installation" Language="1033" Version="1.0.0.0">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine">
</Package>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Feature Id="ProductFeature" Title="MyInstallation" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="MyComponents" />
</Feature>
<util:Group Id="Users" Name="Users"/>
<CustomAction Id="InstallMyService"
Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]bin\my-service.bat install"
Execute="deferred"
Impersonate="no"
Return="check"/>
<CustomAction Id="SetEnvironmentVariable" BinaryKey="ActionLib" DllEntry="SetEnvironmentVariableForNewUser" />
<Binary Id='ActionLib' SourceFile='..\InstallerActionLibrary\bin\Release\InstallerActionLibrary.CA.dll' />
<CustomAction Id="StartMyService"
Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]bin\my-service.bat start"
Execute="deferred"
Impersonate="no"
Return="asyncWait"/>
<InstallExecuteSequence>
<Custom Action="InstallMyService" After="InstallFiles"/>
<Custom Action="SetEnvironmentVariable" After="InstallMyService"/>
<Custom Action="StartMyService" After="SetEnvironmentVariable"/>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="Company" Name="Company">
<Directory Id="App" Name="Product">
<Directory Id="INSTALLFOLDER" Name="Service" />
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="NewUser" Guid="{12345678-ABCD-1234-ABCD-987654321FED}">
<CreateFolder />
<util:User Id="CIUSER" CreateUser="yes" UpdateIfExists="no" Name="SERVICEUSER" PasswordNeverExpires="yes" Password="********">
<util:GroupRef Id="Users" />
</util:User>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
However, one of the Custom Actions, SetEnvironmentVariable, needs to be run after the user has been set up, in the fragment at the bottom of the file. And this does not happen. SetEnvironmentVariable fails because it cannot find the user.
The sequence, given in InstallExecuteSequence begins after InstallFiles has occurred. I have tried to find a more appropriate place to start the sequence, using the list given here. I have tried PublishProduct and the result is the same.
Is there any way to get the user added before the custom action runs?
The suggestion from #zett42 was a good one. However, it still did not solve the problem.
The solution was the incorrect use of Execute="deferred". The execution of all the custom actions should have been set as:
Execute="commit"
From the Wix Documentation:
commit
Indicates that the custom action will run after successful completion of the installation script (at the end of the installation).
Changed the Execute type to commit and it worked.
I have no direct answer, but one that should help you to figure it out by yourself:
Open the MSI package using a tool like Orca (included in Win SDK) or InstEd (my personal preference).
Navigate to the InstallExecuteSequence table.
Lookup the record of the WiX custom action that creates the user and copy the Action identifier of that record.
Use that identifier for the After attribute of the element <Custom Action="SetEnvironmentVariable"/>.
I agree with #zett42.
There are some wix standard actions which should be checked in msi editor,
if you need to know when exactly they are being called. We normally don`t get much documentation for such actions.
Check if your msi has SchedSecureObjects_x64 or SchedSecureObjects custom action in msi. Schedule SetEnvironmentVariable custom action after that action.
I was following the below code which is product.wxs files.But I am facing an error as below:
Error 5 Unresolved reference to symbol 'WixComponentGroup:MyWebWebComponents' in section 'Product:{}'
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Product Id="702881b5-9a64-4ab8-ab47-f3babcd950a2"
Name="WixApplication" Language="1033"
Version="1.0.0.0"
Manufacturer="HexWireless"
UpgradeCode="42b7872b-78c8-4a0b-abcd-28a30c9804ab">
<Package InstallerVersion="200" Compressed="yes" Platform="x64" InstallScope="perMachine"/>
<!--<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />-->
<!--Find the Path to the sqlcmd.exe by performing a registry search. This is hardcoded for SQL 2012.
Change 110 to 100 for 2008. Might need to change the script too.-->
<Property Id="SQLBINDIR">
<RegistrySearch Id="SqlBinDir"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\110\Tools\ClientSetup"
Name="Path"
Type="raw"
Win64="yes"/>
</Property>
<Condition Message="Microsoft SQL Server 2012 needs to be installed before this installer can run">
<![CDATA[SQLBINDIR]]>
</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="Database">
<Component Id="Database" Guid="a8dc2Fcd-087d-e393-b059-c67877e51b8a">
<File Id="DatabaseScript" Source="SQLScripts\HexWireless.sql"/>
<RemoveFile Id ="RemoveInstall.log" Name="Install.log" On="uninstall" />
</Component>
</Directory>
<Directory Id="INSTALLDIR" Name="PFiles">
<Directory Id="WixService" Name="Service">
<Component Id="WixWindowsServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="WixService.exe" Name="WixService.exe" Source="$(var.WixService.TargetDir)\WixService.exe"/>
<ServiceInstall Id="InstallWixService" DisplayName="WixService" Name="WixService.exe" Description="WixService" Account="NT Authority\Network Service" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlWixService" Name="WixService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</Directory>
</Directory>
<Directory Id="INSTALLFOLDER" Name="Publish">
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WebApplication" Level="1">
<Feature Id="Database" Title="Database" Description="DatabaseScript" Level="1" Display="expand"
AllowAdvertise="no" ConfigurableDirectory="INSTALLLOCATION" Absent="allow">
<Feature Id="WixWindowsServiceComponent" Title="Service" Description="WixService" Level="1" Display="expand"
AllowAdvertise="no" ConfigurableDirectory="INSTALLDIR" Absent="allow">
<ComponentGroupRef Id="WixWebsiteIssConfiguration" />
<ComponentRef Id="Database"/>
<ComponentRef Id="WixWindowsServiceComponent"/>
<ComponentGroupRef Id="MyWebWebComponents"/>
</Feature>
</Feature>
</Feature>
<Property Id="INSTALLDIR" Value="D:" />
<Media Id="1" Cabinet="WixWindowsServiceComponent.cab" EmbedCab="yes" />
<InstallExecuteSequence>
<!--If the database feature is selected these actions will run to install the DB-->
<Custom Action="Database.cmd" After="InstallFiles" >
<![CDATA[NOT Installed]]>
</Custom>
<!--Ensure this runs after the custom action to set up the properties for its cmd line-->
<Custom Action="Database" After="Database.cmd">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
<UI>
<UIRef Id="GUI"/>
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
<!--This is the sequence script. Best way to understand this is by running sqlcmd -?
Use "property" Custom action to get variable substitution working-->
<CustomAction Id="Database.cmd" Property="Database"
Value=""[SQLBINDIR]sqlcmd.exe" -E -S "[SQLSERVER]" -i "[#DatabaseScript]" -o "[INSTALLLOCATION]HexWireless.log""/>
<!-- Note that the cmd line and args will come from a property with the same name as the custom action, this has been set by the custom action above -->
<CustomAction Id="Database" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" />
</Product>
</Wix>
Thanks In Advance.
I am not sure if your issue is sorted or not, I just faced the same issue even though i have created a few of these msi files with Wix.
In my case, it wasn't finding the "HeatedComponents" that I am generating automatically within the project. I had to load this file into the project, (these files or folders may be inside your project folder but in most cases VS does not load them automatically).
You have to Right Click on the project -> Add -> Existing Item; and select the file/item that is required.
I'm attempting to use a custom action to run a program with a command-line option during installation (after files copied). The action requires admin permission (it sets up and installs a windows service). For some reason, the custom action keeps failing.
My wix code:
<?xml version='1.0' encoding='Windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Name='WHS 2011 Media Collector'
Id='28656223-C2E0-4E74-8503-B9D668056C4E'
UpgradeCode='84F31832-4E09-4149-A3F7-56A8DF63086F'
Language='1033'
Codepage='1252'
Version='3.0.0'
Manufacturer='Nick Radtke'>
<Package
Id='*'
Keywords='Installer'
Platform="x64"
Description="WHS 2011 Media Collector" Comments='Deployment Package for WHS 2011 Media Collector'
Manufacturer='Nick Radtke'
InstallerVersion='300'
Languages='1033'
Compressed='yes'
SummaryCodepage='1252'
InstallPrivileges='elevated'
InstallScope='perMachine'/>
<Media
Id='1'
Cabinet='WSSSampleAddins.cab'
EmbedCab='yes'
DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Addins Installation [1]" />
<Property Id="LaunchApplication" Value=""MediaCollectorServerService.exe" -install"/>
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
<InstallExecuteSequence>
<Custom Action='LaunchApplication' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
Impersonate="no"
DllEntry="CAQuietExec64"
Execute="deferred"
Return="check"
/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFiles64Folder' Name='PFiles'>
<Directory Id="ParentAddinBinaryDir" Name="Nick Radtke">
<Directory Id="AddinBinaryDir" Name="WHS 2011 Media Collector">
<Component
Id='WHS2011MCBinaryComponent'
Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD481'
Win64='yes'>
<RemoveFolder Id='AddinBinaryDir' On='uninstall' />
<File
Id='WHS2011MediaCollector.ListViewSubTab'
Name='WHS2011MediaCollector.ListViewSubTab.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.ListViewSubTab.dll'
ProcessorArchitecture='x64'
KeyPath='yes'>
</File>
<File
Id='WHS2011MediaCollector.TopLevelTab'
Name='WHS2011MediaCollector.TopLevelTab.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.TopLevelTab.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='WHS2011MediaCollector.PicturesSubTab'
Name='WHS2011MediaCollector.PicturesSubTab.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.PicturesSubTab.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='WHS2011MediaCollector.VideosSubTab'
Name='WHS2011MediaCollector.VideosSubTab.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.VideosSubTab.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='WHS2011MediaCollector.SettingsSubTab'
Name='WHS2011MediaCollector.SettingsSubTab.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.SettingsSubTab.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='NetLibrary'
Name='NetLibrary.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\NetLibrary.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='Icon.png'
Name='Icon.png'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\Icon.png'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='taglib_sharp'
Name='taglib-sharp.dll'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\taglib-sharp.dll'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
<File
Id='MediaCollectorServerService.exe'
Name='MediaCollectorServerService.exe'
DiskId='1'
Source='..\..\MediaCollectorServerService\x64\Release\MediaCollectorServerService.exe'
ProcessorArchitecture='x64'
KeyPath='no'>
</File>
</Component>
</Directory>
</Directory>
<Directory Id="WindowsServerDir" Name="Windows Server">
<Directory Id="WindowsServerBinDir" Name="Bin">
<Directory Id="WindowsServerAddinsDir" Name="Addins">
<Directory Id="WindowsServerPrimaryDir" Name="Primary">
<Component
Id='WHS2011MCXMLComponent'
Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD491'
Win64='yes'>
<File Id='WHS2011MCTopLevelTabXML'
Name='WHS2011MediaCollector.addin'
DiskId='1'
Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.addin'
ProcessorArchitecture='x64'
KeyPath='yes'>
</File>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='WHS2011MCBinaryComponent' />
<ComponentRef Id='WHS2011MCXMLComponent' />
</Feature>
</Product>
</Wix>
This is the error I'm getting in the msi log:
MSI (s) (40:30) [22:58:07:647]: Created Custom Action Server with PID 11672 (0x2D98).
MSI (s) (40:40) [22:58:07:663]: Running as a service.
MSI (s) (40:40) [22:58:07:663]: Hello, I'm your 32bit Elevated custom action server.
CAQuietExec64: Error 0x80070002: Command failed to execute.
CAQuietExec64: Error 0x80070002: CAQuietExec64 Failed
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 22:58:07: InstallFinalize. Return value 3.
MSI (s) (40:D0) [22:58:07:694]: Note: 1: 2265 2: 3: -2147287035
If I run the command line as a normal user, it fails, but if I run it as an admin user (or the system user), it works. I'm fairly certain the problem is the permissions on the action. I've set it to deferred and Impersonate='no', but it's still not working. Anyone have any tips?
Edit: So, I've found that apparently shortcuts in launchapplication aren't working for the path of the executable. Does anyone know the syntax that allows for this?
Ended up figuring it out myself.
Changed the
<Property Id="LaunchApplication" Value=""MediaCollectorServerService.exe" -install"/>
line to
<SetProperty Id="LaunchApplication" Before="InstallInitialize" Sequence="execute" Value=""[#MediaCollectorServerService.exe]%quot; -install"><![CDATA[NOT Installed AND LaunchApplication=""]]</SetProperty>
Hoping this proves useful for others in the future.
I am currently working on a tool for system administrators that can be used to update all clients of a Windows AD. It needs to work with Group Policy and SMS for the purpose of doing mass-updating. Therefore I need the tool to result in a MSI file.
Is it possible to create a MSI file that does not install anything but instead only does a custom action (ie. run a script or exe-file).
Best Regards Jakob Simon-Gaarde
Yes, it is possible. Shameful, but, possible.
You can make a square peg fit in a round hole but you lose all of the intended benefits.
FWIW, SMS is now called SCCM and it can call EXE commands.
Found a hackish way to solve my problem:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Name='MVLicense Updater' Id='f8fc0a30-c138-1fe2-838b-0845200c9a66'
UpgradeCode='00ca86a0-c889-12e2-8f8b-0800200c9a66'
Language='1033' Version='1.0.0.0' Manufacturer='My Company'>
<Package Id='*' InstallerVersion='200' Compressed='yes' />
<Media Id='1' Cabinet='my.cab' EmbedCab='yes' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder'>
<Directory Id='INSTALLDIR' Name='My-Updater'>
<Component Id='Readme' Guid='68fef080-c87b-34e2-8889-0824200c9a66'>
<File Id='ReadmeTXT' Name='readme.txt' Source='readme.txt' Vital='no' />
<RemoveFolder Id="INSTALLDIR" On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Level="1">
<ComponentRef Id='Readme' />
</Feature>
<CustomAction Id="ForceError" Error="1602"/>
<CustomAction Id="RunMyUpdater" BinaryKey="MyUpdaterExe" ExeCommand="dummy" Return="check"/>
<InstallExecuteSequence>
<Custom Action='RunMyUpdater' After='InstallInitialize'></Custom>
<Custom Action="ForceError" After="RunMvlupdate"></Custom>
</InstallExecuteSequence>
<AdminExecuteSequence>
<Custom Action='RunMyUpdater' After='InstallInitialize'></Custom>
<Custom Action="ForceError" After="RunMyUpdate"></Custom>
</AdminExecuteSequence>
<Binary Id="MyUpdaterExe" SourceFile="dist\myupdater.exe" />
<UI>
<Error Id="1602">We have a problem</Error>
</UI>
</Product>
</Wix>
This does the job of running my executable that does some configuration stuff based on calling an internet service and then rolls back the installation because I force an error to occure.