WIX create user and use him to give permissions to folder - wix
I need to create installer which creates new local user, new folder and gives full permissions to this user.
I created small test below using new wix project via Visual Studio 2010 and Wix 3.10:
<?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="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="DG" UpgradeCode="85e3204f-c872-4229-bb75-fa5231863a75">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Feature Id='TestUserProductFeature' Title='Test User Product Feature' Level='1'>
<ComponentRef Id='TestUserProductComponent' />
</Feature>
<InstallExecuteSequence>
<Custom Action='ConfigureUsers' Before='CreateFolders'/>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id='TestUserProductComponent' Guid='652C2BE1-9DE7-47AD-A686-55ABAAF68B6F'>
<util:User Id='TEST_USER1' Name='testName1' Password='pa$$$$word' CreateUser='yes' FailIfExists='yes'/>
</Component>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject1" >
<Directory Id="d_TestDirectory" Name="TestDirectory">
<Component Id="CreateTestDirectory" Guid="8B7EB548-5767-7017-A56C-4EEBDDF7B621">
<CreateFolder Directory="d_TestDirectory">
<Permission User="testName1" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<ComponentRef Id="CreateTestDirectory"/>
</ComponentGroup>
</Fragment>
</Wix>
Please note I added
<Custom Action='ConfigureUsers' Before='CreateFolders'/>
To create user before creating of new folder.
Also please note I added
FailIfExists='yes'
for util:User so it will fail if user exists.
When I run my msi with logging, I get this message first:
An error occured while applying security settings. testName1 is not a vaild user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install.
This means that my user was not created.
Then I create local user myself manually and press Retry.
Then I get this error:
Failed to create user (-2147022672 testName1 )
It means that installer cannot create user because it's already created(FailIfExists='yes')
This is my InstallExecuteSequence from Orca:
FindRelatedProducts 25
LaunchConditions 100
ValidateProductID 700
CostInitialize 800
FileCost 900
CostFinalize 1000
MigrateFeatureStates 1200
InstallValidate 1400
RemoveExistingProducts 1401
InstallInitialize 1500
ProcessComponents 1600
UnpublishFeatures 1800
RemoveFolders 3600
ConfigureUsers 3699
CreateFolders 3700
RegisterUser 6000
RegisterProduct 6100
PublishFeatures 6300
PublishProduct 6400
InstallFinalize 6600
This is a part of my log file with actions logging:
Action start 0:02:47: RemoveFolders.
Action ended 0:02:47: RemoveFolders. Return value 1.
MSI (s) (D8:88) [00:02:47:389]: Doing action: ConfigureUsers
MSI (s) (D8:88) [00:02:47:389]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: ConfigureUsers.
MSI (s) (D8:28) [00:02:47:391]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIDFFA.tmp, Entrypoint: ConfigureUsers
MSI (s) (D8:48) [00:02:47:391]: Generating random cookie.
MSI (s) (D8:48) [00:02:47:392]: Created Custom Action Server with PID 1440 (0x5A0).
MSI (s) (D8:E4) [00:02:47:409]: Running as a service.
MSI (s) (D8:E4) [00:02:47:410]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (D8!30) [00:02:47:475]: PROPERTY CHANGE: Adding CreateUserRollback property. Its value is '**********'.
MSI (s) (D8!30) [00:02:47:476]: Doing action: CreateUserRollback
MSI (s) (D8!30) [00:02:47:476]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateUserRollback.
Action ended 0:02:47: CreateUserRollback. Return value 1.
MSI (s) (D8!30) [00:02:47:477]: PROPERTY CHANGE: Adding CreateUser property. Its value is '**********'.
MSI (s) (D8!30) [00:02:47:478]: Doing action: CreateUser
MSI (s) (D8!30) [00:02:47:478]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateUser.
Action ended 0:02:47: CreateUser. Return value 1.
Action ended 0:02:47: ConfigureUsers. Return value 1.
MSI (s) (D8:88) [00:02:47:481]: Doing action: CreateFolders
MSI (s) (D8:88) [00:02:47:481]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateFolders.
MSI (s) (D8:88) [00:02:47:481]: Note: 1: 1609 2: testName1 3: 1332
MSI (c) (B4:B8) [00:02:47:483]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1609. An error occurred while applying security settings. testName1 is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. Unable to locate the user's SID, system error 1332
MSI (s) (D8:88) [00:03:14:513]:
MSI (s) (D8:88) [00:03:14:513]: Note: 1: 1609 2: testName1 3: 1332
MSI (c) (B4:B8) [00:03:14:515]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1609. An error occurred while applying security settings. testName1 is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. Unable to locate the user's SID, system error 1332
MSI (s) (D8:88) [00:03:31:485]:
MSI (s) (D8:88) [00:03:31:486]: Finished allocating new user SID
MSI (s) (D8:88) [00:03:31:486]: Using well known SID for System
MSI (s) (D8:88) [00:03:31:486]: Finished allocating new user SID
Action ended 0:03:31: CreateFolders. Return value 1.
MSI (s) (D8:88) [00:03:31:486]: Doing action: RegisterUser
MSI (s) (D8:88) [00:03:31:486]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: RegisterUser.
Action ended 0:03:31: RegisterUser. Return value 1.
MSI (s) (D8:88) [00:03:31:487]: Doing action: RegisterProduct
MSI (s) (D8:88) [00:03:31:487]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: RegisterProduct.
MSI (s) (D8:88) [00:03:31:487]: Note: 1: 2262 2: Media 3: -2147287038
MSI (s) (D8:88) [00:03:31:488]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'.
Action ended 0:03:31: RegisterProduct. Return value 1.
MSI (s) (D8:88) [00:03:31:488]: Doing action: PublishFeatures
MSI (s) (D8:88) [00:03:31:488]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: PublishFeatures.
Action ended 0:03:31: PublishFeatures. Return value 1.
MSI (s) (D8:88) [00:03:31:489]: Doing action: PublishProduct
MSI (s) (D8:88) [00:03:31:489]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: PublishProduct.
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2205 2: 3: Icon
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2228 2: 3: Icon 4: SELECT `Name`, `Data` FROM `Icon`
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2262 2: Media 3: -2147287038
Action ended 0:03:31: PublishProduct. Return value 1.
MSI (s) (D8:88) [00:03:31:490]: Doing action: InstallFinalize
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: InstallFinalize.
MSI (s) (D8:88) [00:03:31:491]: Running Script: C:\Windows\Installer\MSIDFE9.tmp
MSI (s) (D8:88) [00:03:31:491]: PROPERTY CHANGE: Adding UpdateStarted property. Its value is '1'.
MSI (s) (D8:88) [00:03:31:491]: Machine policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:03:31:493]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (D8:88) [00:03:31:494]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1216610392,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (D8:88) [00:03:31:494]: Executing op: ProductInfo(ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},ProductName=SetupProject1,PackageName=SetupProject1.msi,Language=1033,Version=16777216,Assignment=1,ObsoleteArg=0,,,PackageCode={413012CF-A56C-4342-9DE3-50774CA5DD67},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=2)
MSI (s) (D8:88) [00:03:31:494]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (D8:88) [00:03:31:494]: Executing op: DialogInfo(Type=1,Argument=SetupProject1)
MSI (s) (D8:88) [00:03:31:495]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (D8:88) [00:03:31:495]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ProgressTotal(Total=2,Type=1,ByteEquivalent=24000)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ComponentRegister(ComponentId={652C2BE1-9DE7-47AD-A686-55ABAAF68B6F},KeyPath=C:\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
MSI (s) (D8:88) [00:03:31:496]: Executing op: ComponentRegister(ComponentId={8B7EB548-5767-7017-A56C-4EEBDDF7B621},KeyPath=C:\Program Files (x86)\SetupProject1\TestDirectory\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
MSI (s) (D8:88) [00:03:31:496]: Executing op: ActionStart(Name=CreateUserRollback,,)
MSI (s) (D8:88) [00:03:31:496]: Executing op: CustomActionSchedule(Action=CreateUserRollback,ActionType=11521,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:88) [00:03:31:497]: Executing op: ActionStart(Name=CreateUser,,)
MSI (s) (D8:88) [00:03:31:497]: Executing op: CustomActionSchedule(Action=CreateUser,ActionType=11265,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:64) [00:03:31:498]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI8C49.tmp, Entrypoint: CreateUser
MSI (s) (D8:48) [00:03:31:498]: Generating random cookie.
MSI (s) (D8:48) [00:03:31:499]: Created Custom Action Server with PID 2476 (0x9AC).
MSI (s) (D8:E4) [00:03:31:517]: Running as a service.
MSI (s) (D8:E4) [00:03:31:517]: Hello, I'm your 32bit Elevated custom action server.
CreateUser: Error 0x800708b0: failed to create user: testName1
MSI (c) (B4:B8) [00:03:31:600]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 26401. Failed to create user. (-2147022672 testName1 )
MSI (s) (D8!58) [00:04:07:562]: Product: SetupProject1 -- Error 26401. Failed to create user. (-2147022672 testName1 )
CustomAction CreateUser returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 0:04:07: InstallFinalize. Return value 3.
MSI (s) (D8:88) [00:04:07:566]: User policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:04:07:566]: Machine policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:04:07:567]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1216610416,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (D8:88) [00:04:07:567]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (D8:88) [00:04:07:567]: Executing op: DialogInfo(Type=1,Argument=SetupProject1)
MSI (s) (D8:88) [00:04:07:568]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (D8:88) [00:04:07:569]: Executing op: ActionStart(Name=CreateUser,,)
MSI (s) (D8:88) [00:04:07:569]: Executing op: ProductInfo(ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},ProductName=SetupProject1,PackageName=SetupProject1.msi,Language=1033,Version=16777216,Assignment=1,ObsoleteArg=0,,,PackageCode={413012CF-A56C-4342-9DE3-50774CA5DD67},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=2)
MSI (s) (D8:88) [00:04:07:569]: Executing op: ActionStart(Name=CreateUserRollback,,)
MSI (s) (D8:88) [00:04:07:569]: Executing op: CustomActionRollback(Action=CreateUserRollback,ActionType=11521,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:C8) [00:04:07:571]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI1929.tmp, Entrypoint: RemoveUser
MSI (s) (D8:88) [00:04:07:950]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: ComponentUnregister(ComponentId={8B7EB548-5767-7017-A56C-4EEBDDF7B621},ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},BinaryType=0,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: ComponentUnregister(ComponentId={652C2BE1-9DE7-47AD-A686-55ABAAF68B6F},ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},BinaryType=0,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (D8:88) [00:04:07:950]: Error in rollback skipped. Return: 5
MSI (s) (D8:88) [00:04:07:953]: Note: 1: 2318 2:
MSI (s) (D8:88) [00:04:07:953]: Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 38, szDescription: "".
MSI (s) (D8:88) [00:04:07:954]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (D8:88) [00:04:07:954]: Unlocking Server
MSI (s) (D8:88) [00:04:08:135]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 0:04:08: INSTALL. Return value 3.
So, it seems like CreateUser is actually run as elevated (deffered) custom action from another temp dll during InstallFinalize action.
Even if ConfigureUsers is said to run before CreateFolders, it just plans elevated custom action.
Is my scenario possible to be achieved? What is wrong?
It's not clear what you're doing with immediate custom actions - they are never supposed to alter the system because there is no way to undo them. All custom actions that alter the system need to be deferred so that they a) Roll back with a rollback CA and b) run elevated because immediate CAs are not elevated. If some CAs depend on others just order them appropriately.
That CreateUser error 0x8007089a means "The specified username is invalid.". If that trace code that shows "vmtest\user" is correct, maybe that's incorrect. Why the backslash? Is the "user" part a password? Also I don't believe that the trace would reveal a password, so maybe the user name is "vmtest\user" and that backslash is invalid as part of a user name.
Related
Wix Toolset major upgrade does not completely remove previous version
I've added MajorUpgrade element to msi. Increased version, changed UpgradeCode, ProductId is the same. Here what it looks like <?define Config = "Release" ?> <?define ProductId = "{87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6}" ?> <?define UpgradeCode = "{B414C827-8D81-4B4A-B3B6-338C06DE3A11}" ?> <?define ProductName = "Some Product" ?> <?define Version = "2.0.0.0" ?> <?define Company = "Some Inc." ?> <?define Description = "Installs Some Product" ?> In version 1.0.0.0 ProductId is different. MajorUpgrade is set like this <MajorUpgrade Schedule="afterInstallValidate" DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" /> During the upgrade it successfully identifies previous version on FindRelatedProducts stage Action start 22:31:06: FindRelatedProducts. MSI (s) (38:78) [22:31:06:557]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'. MSI (s) (38:78) [22:31:06:557]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'. MSI (s) (38:78) [22:31:06:557]: Doing action: AppSearch MSI (s) (38:78) [22:31:06:557]: Note: 1: 2205 2: 3: ActionText Action ended 22:31:06: FindRelatedProducts. Return value 1. RemoveExistingProducts starts the uninstallation RemoveFolderEx removes some folders and RemoveExistingProducts stage returns code 1 (success right?). But it doesn't remove entries in registry. Product is still there. Components not remove. Here is the log. Action start 22:35:25: RemoveExistingProducts. MSI (s) (38:78) [22:35:25:190]: Note: 1: 2205 2: 3: Error MSI (s) (38:78) [22:35:25:190]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 23 MSI (s) (38:AC) [22:35:25:190]: Resetting cached policy values MSI (s) (38:AC) [22:35:25:190]: Machine policy value 'Debug' is 0 MSI (s) (38:AC) [22:35:25:190]: ******* RunEngine: ******* Product: {3E786878-358D-43AD-82D1-1435ADF9F6EA} ******* Action: ******* CommandLine: ********** MSI (s) (38:AC) [22:35:25:205]: Note: 1: 2265 2: 3: -2147287035 MSI (s) (38:AC) [22:35:25:205]: End dialog not enabled MSI (s) (38:AC) [22:35:25:205]: Original package ==> C:\Windows\Installer\bd684.msi MSI (s) (38:AC) [22:35:25:205]: Package we're running from ==> C:\Windows\Installer\bd684.msi MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall Flags override found. MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall VersionNT override found. MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall ServicePackLevel override found. MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: looking for appcompat database entry with ProductCode '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'. MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: no matching ProductCode found in database. MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisablePatch' is 0 MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'AllowLockdownPatch' is 0 MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisableLUAPatching' is 0 MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisableFlyWeightPatching' is 0 MSI (s) (38:AC) [22:35:25:237]: APPCOMPAT: looking for appcompat database entry with ProductCode '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'. MSI (s) (38:AC) [22:35:25:237]: APPCOMPAT: no matching ProductCode found in database. MSI (s) (38:AC) [22:35:25:237]: Transforms are not secure. MSI (s) (38:AC) [22:35:25:237]: Command Line: UPGRADINGPRODUCTCODE={87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6} CLIENTPROCESSID=2520 CLIENTUILEVEL=3 MSICLIENTUSESEXTERNALUI=1 REMOVE=ALL MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{0C30C985-B880-4BEF-90B5-52ED8736B108}'. MSI (s) (38:AC) [22:35:25:237]: Product Code passed to Engine.Initialize: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}' MSI (s) (38:AC) [22:35:25:237]: Product Code from property table before transforms: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}' MSI (s) (38:AC) [22:35:25:237]: Product Code from property table after transforms: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}' MSI (s) (38:AC) [22:35:25:237]: Product registered: entering maintenance mode MSI (s) (38:AC) [22:35:25:237]: Determined that existing product (either this product or the product being upgraded with a patch) is installed per-machine. MSI (s) (38:AC) [22:35:25:237]: MSI_LUA: Nested installation UAC elevation tracks that of parent (is not elevated) MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is admin assigned: LocalSystem owns the publish key. MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is managed. MSI (s) (38:AC) [22:35:25:237]: MSI_LUA: Credential prompt not required, user is an admin MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'. MSI (s) (38:AC) [22:35:25:237]: Package name retrieved from configuration data: 'aep_monolith.msi' MSI (s) (38:AC) [22:35:25:237]: Note: 1: 2205 2: 3: Error MSI (s) (38:AC) [22:35:25:237]: Note: 1: 2262 2: AdminProperties 3: -2147287038 MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'DisableMsi' is 1 MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'AlwaysInstallElevated' is 0 MSI (s) (38:AC) [22:35:25:237]: User policy value 'AlwaysInstallElevated' is 0 MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is admin assigned: LocalSystem owns the publish key. MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is managed. MSI (s) (38:AC) [22:35:25:237]: Running product '{3E786878-358D-43AD-82D1-1435ADF9F6EA}' with elevated privileges: Product is assigned. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding UPGRADINGPRODUCTCODE property. Its value is '{87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6}'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding CLIENTPROCESSID property. Its value is '2520'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding CLIENTUILEVEL property. Its value is '3'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MSICLIENTUSESEXTERNALUI property. Its value is '1'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding REMOVE property. Its value is 'ALL'. MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'DisableAutomaticApplicationShutdown' is 0 MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MsiRestartManagerSessionKey property. Its value is '7dad24bc7ce3134db335b2318702e12c'. MSI (s) (38:AC) [22:35:25:237]: RESTART MANAGER: Session opened. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MsiSystemRebootPending property. Its value is '1'. MSI (s) (38:AC) [22:35:25:237]: TRANSFORMS property is now: MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding PRODUCTLANGUAGE property. Its value is '1033'. MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding VersionDatabase property. Its value is '301'. Here is the ending of it MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: Error MSI (s) (38:78) [22:39:08:694]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 16 MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: Error MSI (s) (38:78) [22:39:08:694]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 21 MSI (s) (38:78) [22:39:08:694]: Doing action: ProcessComponents MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: ActionText Action ended 22:39:08: RemoveExistingProducts. Return value 1. And at the very end I get MSI (s) (38:78) [22:42:18:570]: Windows Installer installed the product. Product Name: Some Product. Product Version: 2.0.0.0. Product Language: 1033. Manufacturer: Some Inc.. Installation success or error status: 0. Could you help me please? I ran out of any ideas.
The easiest way to author a major upgrade is to not author as many GUIDs as possible. See this example. Don't even author component GUIDs if you don't have to, i.e. if they contain more than one resource - but try to avoid that. For example, this makes an easy major upgrade: <?xml version="1.0" encoding="utf-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" Name="Sample Product" Language="1033" Version="1.0.0.0" Manufacturer="Heath Stewart" UpgradeCode="f10d913e-7669-4962-aa3f-963425ecf10b"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <MediaTemplate /> <Feature Id="ProductFeature" Title="SampleProduct" Level="1"> <ComponentGroupRef Id="ProductComponents" /> </Feature> </Product> <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="SampleProduct" /> </Directory> </Directory> </Fragment> <Fragment> <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <Component> <File Source="$(var.SampleApp.TargetPath)" /> </Component> <Component> <RegistryKey Root="HKLM" Key="Software\[Manufacturer]\[ProductName]"> <RegistryValue Name="InstallDir" Type="string" Value="[INSTALLFOLDER]" /> <RegistryValue Name="Version" Type="string" Value="[ProductVersion]" KeyPath="yes" /> </RegistryKey> </Component> </ComponentGroup> </Fragment> </Wix> Notice that Product/#Id="*" is authored, and there's no package ID. There are really no good reasons to hardcode them, nor should you. Only the Product/#UpgradeCode should be hardcoded, and only if the root install folder is the same. You don't want to change the folder when the component GUIDs remain the same, of vice versa. It creates all sorts of shared component issues, which I've blogged a lot about in the past: https://devblogs.microsoft.com/setup/tag/shared-components/
WiX Installer wrong about newer version already installed
I have used WiX Install tools in Visual Studio to create create an installer for my C# Windows Forms application. The Installer works when invoked independently (command line or double-click); it uninstalls the existing version (1.0.1.2) and installs the new version (1.0.2.1) but the objective is to have SCCM push the application out to our 50+ workstations. Answers to questions that have been asked: It is configured in SCCM as an Application. This is only my third experience with SCCM, I am not familiar with Packages. The Detection Method is 2 Rules: Product Code {81748469-6B08-4C6C-99B5-BFCE7202FE06} must exist. File %ProgramFiles%\PHSRP\PHSRP_Dashboard.exe with Modified Date >= 7/2/2019 12:00:00 AM must be present. The installation is failing when SCCM is pushing it out. The installation log indicates that the installer believes that a newer version already exists, but this is not true. <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="81748469-6b08-4c6c-99b5-bfce7202fe06" Name="PHSRP Dashboard" Language="1033" Version="1.0.2.1" Manufacturer="CSUS Public Health Survey Research Program" UpgradeCode="8420CB2B-6692-4BB9-A15A-023C7E69FB26"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" IgnoreRemoveFailure="yes" /> <MediaTemplate /> <!-- UIRef Id="WixUI_Minimal" Adds License dialog --> <!-- UIRef Id="WixUI_Advanced" Adds multiple dialog option popups --> <Feature Id="MainProduct" Title="PHSRP Dashboard" Level="1" Absent="disallow"> <ComponentGroupRef Id="ProductComponents" /> <ComponentRef Id="CMP_StartMenu_Dashboard"/> <ComponentRef Id="CMP_DashboardAutoStart"/> </Feature> </Product> <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFiles64Folder"> <Directory Id="PHSRP" Name="PHSRP" /> </Directory> <Directory Id="ProgramMenuFolder"> <Directory Id="PHSRP_Menu" Name="PHSRP"/> </Directory> <Directory Id="StartupFolder"/> </Directory> </Fragment> <Fragment> <ComponentGroup Id="ProductComponents" Directory="PHSRP"> <Component Id="CMP_Dashboard.EXE" Guid="939EC7DE-E6BD-4364-BFC7-7B03C03B7CBB"> <File Id="FILE_Dashboard.EXE" Source="$(var.PHSRP_Dashboard.TargetDir)PHSRP_Dashboard.exe" KeyPath ="yes"/> </Component> <Component Id="CMP_DasboardConfig" Guid="4081EC5F-EAD0-4003-8B43-DFF1EF6B4348"> <File Id="FILE_DashboardConfig" Source="$(var.PHSRP_Dashboard.TargetDir)\PHSRP_Dashboard.exe.config" KeyPath ="yes"/> </Component> <Component Id="CMP_EntityFramework" Guid="D685B056-E64C-4C9A-B0B0-C74DC5EF085E"> <File Id="FILE_EntityFramework" Source="$(var.PHSRP_Dashboard.TargetDir)\EntityFramework.dll" KeyPath="yes"/> </Component> <Component Id="CMP_EntityFrameworkSqlServer" Guid="E017DCC8-1439-4CB6-BFDB-A8C86BF99D74"> <File Id="FILE_EntityFrameworkSqlServer" Source="$(var.PHSRP_Dashboard.TargetDir)\EntityFramework.SqlServer.dll" KeyPath="yes"/> </Component> <Component Id="CMP_ReportViewerCommon" Guid="972220E8-5DD4-451D-847D-32DAC050D639"> <File Id="FILE_ReportViewerCommon" Source="C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\12.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.Common.dll" KeyPath="yes"/> </Component> <Component Id="CMP_ReportViewerDataVisualization" Guid="B0AF7500-5743-4B48-85FA-9BA12E3B554A"> <File Id="FILE_ReportViewerDataVisualization" Source="C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.DataVisualization\12.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.DataVisualization.dll" KeyPath="yes"/> </Component> <Component Id="CMP_ReportViewerProcessingObjectModel" Guid="75E5E7AD-E1AF-41BC-BC95-464272966629"> <File Id="FILE_ReportViewerProcessingObjectModel" Source="C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\12.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.ProcessingObjectModel.dll" KeyPath="yes"/> </Component> <Component Id="CMP_ReportViewerWinForms" Guid="831D08B1-047B-46E0-AA89-C1D47B0B4EBE"> <File Id="FILE_ReportViewerWinForms" Source="C:\Program Files (x86)\Microsoft Visual Studio 14.0\ReportViewer\Microsoft.ReportViewer.WinForms.dll" KeyPath="yes"/> </Component> <Component Id="CMP_SQLServerTypes" Guid="EE385FEE-A4C9-4F9A-800E-F2B9C573DCA7"> <File Id="FILE_SQLServerTypes" Source="C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.Types\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Types.dll" KeyPath="yes"/> </Component> <Component Id="CMP_SystemNetHttp" Guid="F56581DD-D9D0-4140-BB66-9DEF7FF66D7B"> <File Id="FILE_SystemNetHttp" Source="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll" KeyPath="yes"/> </Component> </ComponentGroup> <DirectoryRef Id="PHSRP_Menu"> <Component Id="CMP_StartMenu_Dashboard" Guid="B8C6D5CE-26BD-45E1-904D-97FC3EEADAE8"> <Shortcut Id="SCUT_RunDashboard" Name="PHSRP Dashboard" Description="Start Dashboard" Target="[#FILE_Dashboard.EXE]" WorkingDirectory="PHSRP" /> <RemoveFolder Id="UI_RemoveShortcut" Directory="PHSRP_Menu" On="uninstall"/> <RegistryKey Root="HKCU" Key="Software\PHSRP\PHSRP_Dashboard"> <RegistryValue Name="sm_shortcut" Type="integer" Value="1" KeyPath="yes"/> </RegistryKey> </Component> </DirectoryRef> <DirectoryRef Id="StartupFolder"> <Component Id="CMP_DashboardAutoStart" Guid="E10E004B-8A38-43F9-8365-4C44267565F2"> <Shortcut Id="SCUT_DashboardAutoStart" Name="PHSRP Dashboard" Description="AutoStart Dashboard" Target="[#FILE_Dashboard.EXE]" WorkingDirectory="PHSRP" /> <RegistryKey Root="HKCU" Key="Software\PHSRP\PHSRP_Dashboard"> <RegistryValue Name="su_shortcut" Type="integer" Value="1" KeyPath="yes"/> </RegistryKey> </Component> </DirectoryRef> </Fragment> </Wix> The existing version of the software is 1.0.1.1 Existing application file properties The installation command used by SCCM msiexec /i "WixInstaller.msi" /qn /norestart /L*V "C:\sys\logs\db_install.log" The installation log file: === Verbose logging started: 7/11/2019 9:29:29 Build type: SHIP UNICODE 5.00.10011.00 Calling process: C:\WINDOWS\system32\msiexec.exe === MSI (c) (48:5C) [09:29:29:302]: Resetting cached policy values MSI (c) (48:5C) [09:29:29:302]: Machine policy value 'Debug' is 0 MSI (c) (48:5C) [09:29:29:302]: ******* RunEngine: ******* Product: WixInstaller.msi ******* Action: ******* CommandLine: ********** MSI (c) (48:5C) [09:29:29:302]: Client-side and UI is none or basic: Running entire install on the server. MSI (c) (48:5C) [09:29:29:302]: Grabbed execution mutex. MSI (c) (48:5C) [09:29:29:317]: Cloaking enabled. MSI (c) (48:5C) [09:29:29:317]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (48:5C) [09:29:29:317]: Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (20:B8) [09:29:29:317]: Running installation inside multi-package transaction C:\WINDOWS\ccmcache\5q\WixInstaller.msi MSI (s) (20:B8) [09:29:29:317]: Grabbed execution mutex. MSI (s) (20:6C) [09:29:29:317]: Resetting cached policy values MSI (s) (20:6C) [09:29:29:317]: Machine policy value 'Debug' is 0 MSI (s) (20:6C) [09:29:29:317]: ******* RunEngine: ******* Product: C:\WINDOWS\ccmcache\5q\WixInstaller.msi ******* Action: ******* CommandLine: ********** MSI (s) (20:6C) [09:29:29:317]: Machine policy value 'DisableUserInstalls' is 0 MSI (s) (20:6C) [09:29:29:317]: User policy value 'SearchOrder' is 'nmu' MSI (s) (20:6C) [09:29:29:317]: User policy value 'DisableMedia' is 0 MSI (s) (20:6C) [09:29:29:317]: Machine policy value 'AllowLockdownMedia' is 0 MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Media enabled only if package is safe. MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Looking for sourcelist for product {81748469-6B08-4C6C-99B5-BFCE7202FE06} MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Adding {81748469-6B08-4C6C-99B5-BFCE7202FE06}; to potential sourcelist list (pcode;disk;relpath). MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Now checking product {81748469-6B08-4C6C-99B5-BFCE7202FE06} MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Media is enabled for product. MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Attempting to use LastUsedSource from source list. MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Processing net source list. MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Trying source C:\WINDOWS\ccmcache\5q\. MSI (s) (20:6C) [09:29:29:317]: Note: 1: 1402 2: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 3: 2 MSI (s) (20:6C) [09:29:29:317]: Entering CMsiConfigurationManager::SetLastUsedSource. MSI (s) (20:6C) [09:29:29:317]: Specifed source is already in a list. MSI (s) (20:6C) [09:29:29:317]: User policy value 'SearchOrder' is 'nmu' MSI (s) (20:6C) [09:29:29:317]: Machine policy value 'DisableBrowse' is 0 MSI (s) (20:6C) [09:29:29:317]: Machine policy value 'AllowLockdownBrowse' is 0 MSI (s) (20:6C) [09:29:29:317]: Adding new sources is allowed. MSI (s) (20:6C) [09:29:29:317]: Set LastUsedSource to: C:\WINDOWS\ccmcache\5q\. MSI (s) (20:6C) [09:29:29:317]: Set LastUsedType to: n. MSI (s) (20:6C) [09:29:29:317]: Set LastUsedIndex to: 1. MSI (s) (20:6C) [09:29:29:317]: SOURCEMGMT: Resolved source to: 'C:\WINDOWS\ccmcache\5q\' MSI (s) (20:6C) [09:29:29:317]: Note: 1: 2203 2: C:\WINDOWS\Installer\inprogressinstallinfo.ipi 3: -2147287038 MSI (s) (20:6C) [09:29:29:317]: SRSetRestorePoint skipped for this transaction. MSI (s) (20:6C) [09:29:29:317]: File will have security applied from OpCode. MSI (s) (20:6C) [09:29:29:333]: SOFTWARE RESTRICTION POLICY: Verifying package --> 'C:\WINDOWS\ccmcache\5q\WixInstaller.msi' against software restriction policy MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2262 2: DigitalSignature 3: -2147287038 MSI (s) (20:6C) [09:29:29:333]: SOFTWARE RESTRICTION POLICY: C:\WINDOWS\ccmcache\5q\WixInstaller.msi is not digitally signed MSI (s) (20:6C) [09:29:29:333]: SOFTWARE RESTRICTION POLICY: C:\WINDOWS\ccmcache\5q\WixInstaller.msi is permitted to run because the user token authorizes execution (system or service token). MSI (s) (20:6C) [09:29:29:333]: MSCOREE not loaded loading copy from system32 MSI (s) (20:6C) [09:29:29:333]: End dialog not enabled MSI (s) (20:6C) [09:29:29:333]: Original package ==> C:\WINDOWS\ccmcache\5q\WixInstaller.msi MSI (s) (20:6C) [09:29:29:333]: Package we're running from ==> C:\WINDOWS\Installer\30cf3.msi MSI (s) (20:6C) [09:29:29:333]: APPCOMPAT: looking for appcompat database entry with ProductCode '{81748469-6B08-4C6C-99B5-BFCE7202FE06}'. MSI (s) (20:6C) [09:29:29:333]: APPCOMPAT: no matching ProductCode found in database. MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisablePatch' is 0 MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'AllowLockdownPatch' is 0 MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisableLUAPatching' is 0 MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisableFlyWeightPatching' is 0 MSI (s) (20:6C) [09:29:29:333]: APPCOMPAT: looking for appcompat database entry with ProductCode '{81748469-6B08-4C6C-99B5-BFCE7202FE06}'. MSI (s) (20:6C) [09:29:29:333]: APPCOMPAT: no matching ProductCode found in database. MSI (s) (20:6C) [09:29:29:333]: Transforms are not secure. MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2205 2: 3: Control MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding MsiLogFileLocation property. Its value is 'C:\sys\logs\db_install.log'. MSI (s) (20:6C) [09:29:29:333]: Command Line: REBOOT=ReallySuppress CURRENTDIRECTORY=C:\WINDOWS\ccmcache\5q CLIENTUILEVEL=3 CLIENTPROCESSID=6472 MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{B44E8FB7-8E4E-48D4-8D07-CB34010243AB}'. MSI (s) (20:6C) [09:29:29:333]: Product Code passed to Engine.Initialize: '{81748469-6B08-4C6C-99B5-BFCE7202FE06}' MSI (s) (20:6C) [09:29:29:333]: Product Code from property table before transforms: '{81748469-6B08-4C6C-99B5-BFCE7202FE06}' MSI (s) (20:6C) [09:29:29:333]: Product Code from property table after transforms: '{81748469-6B08-4C6C-99B5-BFCE7202FE06}' MSI (s) (20:6C) [09:29:29:333]: Product not registered: beginning first-time install MSI (s) (20:6C) [09:29:29:333]: Determined that existing product (either this product or the product being upgraded with a patch) is installed per-machine. MSI (s) (20:6C) [09:29:29:333]: Product {81748469-6B08-4C6C-99B5-BFCE7202FE06} is admin assigned: LocalSystem owns the publish key. MSI (s) (20:6C) [09:29:29:333]: Product {81748469-6B08-4C6C-99B5-BFCE7202FE06} is managed. MSI (s) (20:6C) [09:29:29:333]: MSI_LUA: Credential prompt not required, user is an admin MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding ProductState property. Its value is '1'. MSI (s) (20:6C) [09:29:29:333]: Entering CMsiConfigurationManager::SetLastUsedSource. MSI (s) (20:6C) [09:29:29:333]: Specifed source is already in a list. MSI (s) (20:6C) [09:29:29:333]: User policy value 'SearchOrder' is 'nmu' MSI (s) (20:6C) [09:29:29:333]: Adding new sources is allowed. MSI (s) (20:6C) [09:29:29:333]: Package name retrieved from configuration data: 'WixInstaller.msi' MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2205 2: 3: Error MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2262 2: AdminProperties 3: -2147287038 MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisableMsi' is 0 MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'AlwaysInstallElevated' is 0 MSI (s) (20:6C) [09:29:29:333]: User policy value 'AlwaysInstallElevated' is 0 MSI (s) (20:6C) [09:29:29:333]: Product {81748469-6B08-4C6C-99B5-BFCE7202FE06} is admin assigned: LocalSystem owns the publish key. MSI (s) (20:6C) [09:29:29:333]: Product {81748469-6B08-4C6C-99B5-BFCE7202FE06} is managed. MSI (s) (20:6C) [09:29:29:333]: Running product '{81748469-6B08-4C6C-99B5-BFCE7202FE06}' with elevated privileges: Product is assigned. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding REBOOT property. Its value is 'ReallySuppress'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding CURRENTDIRECTORY property. Its value is 'C:\WINDOWS\ccmcache\5q'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding CLIENTUILEVEL property. Its value is '3'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding CLIENTPROCESSID property. Its value is '6472'. MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisableAutomaticApplicationShutdown' is 0 MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding MsiRestartManagerSessionKey property. Its value is '32643088af72814b9d60a08f9f058ba9'. MSI (s) (20:6C) [09:29:29:333]: RESTART MANAGER: Session opened. MSI (s) (20:6C) [09:29:29:333]: TRANSFORMS property is now: MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding PRODUCTLANGUAGE property. Its value is '1033'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding VersionDatabase property. Its value is '200'. MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\Favorites MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Network Shortcuts MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\Documents MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Printer Shortcuts MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Recent MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\SendTo MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Templates MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Local MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\Pictures MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Start Menu\Programs MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Start Menu MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\Users\Public\Desktop MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\system32\config\systemprofile\Desktop MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\ProgramData\Microsoft\Windows\Templates MSI (s) (20:6C) [09:29:29:333]: SHELL32::SHGetFolderPath returned: C:\WINDOWS\Fonts MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2898 2: MS Sans Serif 3: MS Sans Serif 4: 0 5: 16 MSI (s) (20:6C) [09:29:29:333]: MSI_LUA: Setting MsiRunningElevated property to 1 because the install is already running elevated. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding MsiRunningElevated property. Its value is '1'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding Privileged property. Its value is '1'. MSI (s) (20:6C) [09:29:29:333]: Note: 1: 1402 2: HKEY_CURRENT_USER\Software\Microsoft\MS Setup (ACME)\User Info 3: 2 MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding USERNAME property. Its value is 'CSUS User'. MSI (s) (20:6C) [09:29:29:333]: Note: 1: 1402 2: HKEY_CURRENT_USER\Software\Microsoft\MS Setup (ACME)\User Info 3: 2 MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding COMPANYNAME property. Its value is 'CSU Sacramento'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding DATABASE property. Its value is 'C:\WINDOWS\Installer\30cf3.msi'. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding OriginalDatabase property. Its value is 'C:\WINDOWS\ccmcache\5q\WixInstaller.msi'. MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'MsiDisableEmbeddedUI' is 0 MSI (s) (20:6C) [09:29:29:333]: EEUI - Disabling MsiEmbeddedUI for service because it's not a quiet/basic install MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2205 2: 3: PatchPackage MSI (s) (20:6C) [09:29:29:333]: Machine policy value 'DisableRollback' is 0 MSI (s) (20:6C) [09:29:29:333]: User policy value 'DisableRollback' is 0 MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding UILevel property. Its value is '2'. === Logging started: 7/11/2019 9:29:29 === MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2203 2: C:\WINDOWS\Installer\inprogressinstallinfo.ipi 3: -2147287038 MSI (s) (20:6C) [09:29:29:333]: APPCOMPAT: [DetectVersionLaunchCondition] Launch condition already passes. MSI (s) (20:6C) [09:29:29:333]: PROPERTY CHANGE: Adding ACTION property. Its value is 'INSTALL'. MSI (s) (20:6C) [09:29:29:333]: Doing action: INSTALL MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2205 2: 3: ActionText Action start 9:29:29: INSTALL. MSI (s) (20:6C) [09:29:29:333]: Running ExecuteSequence MSI (s) (20:6C) [09:29:29:333]: Doing action: FindRelatedProducts MSI (s) (20:6C) [09:29:29:333]: Note: 1: 2205 2: 3: ActionText Action start 9:29:29: FindRelatedProducts. MSI (s) (20:6C) [09:29:29:348]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{61C1C89E-DC8D-42BC-953C-913E8CE3DD08}'. MSI (s) (20:6C) [09:29:29:348]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{61C1C89E-DC8D-42BC-953C-913E8CE3DD08}'. MSI (s) (20:6C) [09:29:29:348]: PROPERTY CHANGE: Adding WIX_DOWNGRADE_DETECTED property. Its value is '{8BC4D6BF-C0CF-48EB-A229-FC692208DFF0}'. MSI (s) (20:6C) [09:29:29:348]: Doing action: LaunchConditions MSI (s) (20:6C) [09:29:29:348]: Note: 1: 2205 2: 3: ActionText Action ended 9:29:29: FindRelatedProducts. Return value 1. Action start 9:29:29: LaunchConditions. MSI (s) (20:6C) [09:29:29:348]: Note: 1: 2205 2: 3: Error MSI (s) (20:6C) [09:29:29:348]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 MSI (s) (20:6C) [09:29:29:348]: Product: PHSRP Dashboard -- A newer version of PHSRP Dashboard is already installed. A newer version of PHSRP Dashboard is already installed. Action ended 9:29:29: LaunchConditions. Return value 3. Action ended 9:29:29: INSTALL. Return value 3. Property(S): UpgradeCode = {8420CB2B-6692-4BB9-A15A-023C7E69FB26} Property(S): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\ Property(S): ProgramFiles64Folder = C:\Program Files\ Property(S): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ Property(S): ALLUSERS = 1 Property(S): Manufacturer = CSUS Public Health Survey Research Program Property(S): ProductCode = {81748469-6B08-4C6C-99B5-BFCE7202FE06} Property(S): ProductLanguage = 1033 Property(S): ProductName = PHSRP Dashboard Property(S): ProductVersion = 1.0.2.1 Property(S): SecureCustomProperties = WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED Property(S): WIX_UPGRADE_DETECTED = {61C1C89E-DC8D-42BC-953C-913E8CE3DD08} Property(S): WIX_DOWNGRADE_DETECTED = {8BC4D6BF-C0CF-48EB-A229-FC692208DFF0} Property(S): MsiLogFileLocation = C:\sys\logs\db_install.log Property(S): PackageCode = {B44E8FB7-8E4E-48D4-8D07-CB34010243AB} Property(S): ProductState = 1 Property(S): REBOOT = ReallySuppress Property(S): CURRENTDIRECTORY = C:\WINDOWS\ccmcache\5q Property(S): CLIENTUILEVEL = 3 Property(S): CLIENTPROCESSID = 6472 Property(S): MsiRestartManagerSessionKey = 32643088af72814b9d60a08f9f058ba9 Property(S): PRODUCTLANGUAGE = 1033 Property(S): VersionDatabase = 200 Property(S): VersionMsi = 5.00 Property(S): VersionNT = 603 Property(S): VersionNT64 = 603 Property(S): WindowsBuild = 9600 Property(S): ServicePackLevel = 0 Property(S): ServicePackLevelMinor = 0 Property(S): MsiNTProductType = 1 Property(S): WindowsFolder = C:\WINDOWS\ Property(S): WindowsVolume = C:\ Property(S): System64Folder = C:\WINDOWS\system32\ Property(S): SystemFolder = C:\WINDOWS\SysWOW64\ Property(S): RemoteAdminTS = 1 Property(S): TempFolder = C:\WINDOWS\TEMP\ Property(S): ProgramFilesFolder = C:\Program Files (x86)\ Property(S): CommonFilesFolder = C:\Program Files (x86)\Common Files\ Property(S): CommonFiles64Folder = C:\Program Files\Common Files\ Property(S): AppDataFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\ Property(S): FavoritesFolder = C:\WINDOWS\system32\config\systemprofile\Favorites\ Property(S): NetHoodFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Network Shortcuts\ Property(S): PersonalFolder = C:\WINDOWS\system32\config\systemprofile\Documents\ Property(S): PrintHoodFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\ Property(S): RecentFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Recent\ Property(S): SendToFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\SendTo\ Property(S): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\ Property(S): CommonAppDataFolder = C:\ProgramData\ Property(S): LocalAppDataFolder = C:\WINDOWS\system32\config\systemprofile\AppData\Local\ Property(S): MyPicturesFolder = C:\WINDOWS\system32\config\systemprofile\Pictures\ Property(S): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\ Property(S): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\ Property(S): DesktopFolder = C:\Users\Public\Desktop\ Property(S): FontsFolder = C:\WINDOWS\Fonts\ Property(S): GPTSupport = 1 Property(S): OLEAdvtSupport = 1 Property(S): ShellAdvtSupport = 1 Property(S): MsiAMD64 = 6 Property(S): Msix64 = 6 Property(S): Intel = 6 Property(S): PhysicalMemory = 8076 Property(S): VirtualMemory = 7770 Property(S): AdminUser = 1 Property(S): MsiTrueAdminUser = 1 Property(S): LogonUser = SYSTEM Property(S): UserSID = S-1-5-18 Property(S): UserLanguageID = 1033 Property(S): ComputerName = AA-PH-6L4HKH2 Property(S): SystemLanguageID = 1033 Property(S): ScreenX = 1024 Property(S): ScreenY = 768 Property(S): CaptionHeight = 19 Property(S): BorderTop = 1 Property(S): BorderSide = 1 Property(S): TextHeight = 16 Property(S): TextInternalLeading = 3 Property(S): ColorBits = 32 Property(S): TTCSupport = 1 Property(S): Time = 9:29:29 Property(S): Date = 7/11/2019 Property(S): MsiNetAssemblySupport = 4.7.3190.0 Property(S): MsiWin32AssemblySupport = 6.3.17763.1 Property(S): RedirectedDllSupport = 2 Property(S): MsiRunningElevated = 1 Property(S): Privileged = 1 Property(S): USERNAME = CSUS User Property(S): COMPANYNAME = CSU Sacramento Property(S): DATABASE = C:\WINDOWS\Installer\30cf3.msi Property(S): OriginalDatabase = C:\WINDOWS\ccmcache\5q\WixInstaller.msi Property(S): UILevel = 2 Property(S): ACTION = INSTALL Property(S): MIGRATE = {61C1C89E-DC8D-42BC-953C-913E8CE3DD08} MSI (s) (20:6C) [09:29:29:348]: Deferring clean up of packages/files, if any exist MSI (s) (20:6C) [09:29:29:348]: MainEngineThread is returning 1603 MSI (s) (20:B8) [09:29:29:348]: RESTART MANAGER: Session closed. MSI (s) (20:B8) [09:29:29:348]: No System Restore sequence number for this installation. === Logging stopped: 7/11/2019 9:29:29 === MSI (s) (20:B8) [09:29:29:348]: User policy value 'DisableRollback' is 0 MSI (s) (20:B8) [09:29:29:348]: Machine policy value 'DisableRollback' is 0 MSI (s) (20:B8) [09:29:29:348]: Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (20:B8) [09:29:29:348]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (20:B8) [09:29:29:348]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (20:B8) [09:29:29:348]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (48:5C) [09:29:29:364]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (48:5C) [09:29:29:364]: MainEngineThread is returning 1603 === Verbose logging stopped: 7/11/2019 9:29:29 === So, why does SCCM/WiX think that 1 is greater than 2?
From Log: What product does this product code from the log file belong to? Property(S): WIX_DOWNGRADE_DETECTED = {8BC4D6BF-C0CF-48EB-A229-FC692208DFF0} Product Code & Product Name: Maybe try to run this script to figure out what product that really is: 1) copy & paste the script below into notepad, 2) save as ANSI file: "Product Code Lookup.vbs" on desktop, 3) double click script file to run: On Error Resume Next ' we ignore all errors Set installer = CreateObject("WindowsInstaller.Installer") search = Trim(InputBox("Please paste or type in the product code you want to look up details for:", _ "Find Product Details (test GUID provided):", "{8BC4D6BF-C0CF-48EB-A229-FC692208DFF0}")) If search = vbCancel Or Trim(search) = "" Then WScript.Quit(0) End If For Each product In installer.ProductsEx("", "", 7) If (product.ProductCode = search) Then MsgBox "Product Code: " & product.ProductCode & vbNewLine & _ "Product Name: " & product.InstallProperty("ProductName") & vbNewLine & _ "Product Version: " & product.InstallProperty("VersionString"), vbOKOnly, "Match Found:" Exit For End If Next MsgBox "Completed product scan.", vbOKOnly, "Scan Complete" Full List: If you want a text file with all products listed, please check the VBScript here (towards bottom). AllowSameVersionUpgrades: Just answered another major upgrade question. Maybe skim it too: WIX does not uninstall older version. Remember that only the first 3 digits of the ProductVersion affect major upgrades. I am also not too keen on the "AllowSameVersionUpgrades" approach, I prefer the plain and simple major upgrade variant - like this (just my 2 cents, business requirements are always hard): <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> Upgrade Table: It would help to see the actual upgrade table. Is there anything funky in there? Multiple entries? Maybe you have re-used the same upgrade code for separate products? Upgrade code should remain the same for a product line or family of products that share upgrade handing. It should not be the same for different products that you want to upgrade separately. Generally speaking. Links: Determine msiexec exit code when msi file already installed
Is it deployed as an Application or Package in SCCM? If it is an application, what's the detection method? If it is using the same product code as the detection method, it may think that it has already been installed on the machine. Best Regards, Ray
Installation should be executed twice to install the major upgrade for the application
Major upgrade does not work correctly for following installation. If the previous version of the application is installed on the current PC, then during major upgrade old version will be automatically uninstalled, but new version is not installed by some reason. I need to run this new installation twice in order to uninstall the old version and then install new one. But if I comment out the custom action LaunchApplication in the old version of installation, then there will not be any problems and old version will be uninstalled and new version will be installed during the one run of the new installation. <?xml version='1.0' encoding='windows-1252'?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Name='Foobar 2.0.0' Id='GUID' UpgradeCode='GUID' Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='Acme Ltd.'> <Package Id='*' Keywords='Installer' Description="Acme's Foobar 2.0.0 Installer" Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> <Property Id="ALLUSERS" Secure="yes" Value="2" /> <Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" /> <Property Id='ApplicationFolderName' Value="Acme" /> <Property Id='WixAppFolder' Value="WixPerUserFolder" /> <Upgrade Id='GUID'> <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND' Minimum='0.0.1' IncludeMinimum='yes' Maximum='2.0.0' IncludeMaximum='no' /> <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum='2.0.0' IncludeMinimum='no' /> </Upgrade> <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" /> <Property Id='DiskPrompt' Value="Acme's Foobar 2.0.0 Installation [1]" /> <Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='ProgramFilesFolder' Name='PFiles'> <Directory Id='Acme' Name='Acme'> <Directory Id='INSTALLDIR' Name='Foobar 2.0.0'> </Directory> </Directory> </Directory> </Directory> <DirectoryRef Id="INSTALLDIR"> <Component Id='start.vbs' Guid='GUID'> <File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' > </File> </Component> </DirectoryRef> <Feature Id='Complete' Title='Foobar 2.0.0' Description='The complete package.' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'> <Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'> <ComponentRef Id='start.vbs' /> </Feature> </Feature> <CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' /> <CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' /> <Property Id="WixShellExecTarget" Value="[#start.vbs]" /> <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Impersonate="yes" /> <InstallExecuteSequence> <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom> <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom> <RemoveExistingProducts Before="InstallInitialize" /> <Custom Action="LaunchApplication" After="InstallFinalize"/> </InstallExecuteSequence> </Product> </Wix> What could be wrong with this installation or with custom action? VBS procedure is empty. start.vbs: Private Function startServerSub() End Function startServerSub What should be changed to have ability to uninstall previous version and install new one during one run of new application? UPDATE: I changed my installation a little. 1. RemoveExistingProducts will be executed after InstallInitialize. 2. Added SELFFOUND to Upgrade element. <?xml version='1.0' encoding='windows-1252'?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Name='TestApp 2.0.0' Id='GUID' UpgradeCode='GUID' Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='TestManufacturer Ltd.'> <Package Id='*' Keywords='Installer' Description="TestManufacturer's TestApp 2.0.0 Installer" Comments='TestAppis a registered trademark of TestManufacturer Ltd.' Manufacturer='TestManufacturer Ltd.' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> <Property Id="ALLUSERS" Secure="yes" Value="2" /> <Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" /> <Property Id='ApplicationFolderName' Value="TestManufacturer" /> <Property Id='WixAppFolder' Value="WixPerUserFolder" /> <Upgrade Id='GUID'> <UpgradeVersion OnlyDetect='yes' Property='SELFFOUND' Minimum='2.0.0' IncludeMinimum='yes' Maximum='2.0.0' IncludeMaximum='yes' /> <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND' Minimum='0.0.1' IncludeMinimum='yes' Maximum='2.0.0' IncludeMaximum='no' /> <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum='2.0.0' IncludeMinimum='no' /> </Upgrade> <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" /> <Property Id='DiskPrompt' Value="TestManufacturer's TestApp 2.0.0 Installation [1]" /> <Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='ProgramFilesFolder' Name='PFiles'> <Directory Id='TestManufacturer' Name='TestManufacturer'> <Directory Id='INSTALLDIR' Name='TestApp 2.0.0'> </Directory> </Directory> </Directory> </Directory> <DirectoryRef Id="INSTALLDIR"> <Component Id='start.vbs' Guid='GUID'> <File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' > </File> </Component> </DirectoryRef> <Feature Id='Complete' Title='TestApp 2.0.0' Description='The complete package.' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'> <Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'> <ComponentRef Id='start.vbs' /> </Feature> </Feature> <CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' /> <CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' /> <Property Id="WixShellExecTarget" Value="[#start.vbs]" /> <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Impersonate="yes" /> <InstallExecuteSequence> <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom> <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom> <RemoveExistingProducts After="InstallInitialize" /> <Custom Action="LaunchApplication" After="InstallFinalize"/> </InstallExecuteSequence> </Product> </Wix> Then I created 4 installation packages: 1. Version 1.0.0 with custom action LaunchApplication after InstallFinalize. 2. Version 1.0.0 without custom action LaunchApplication. 3. Version 2.0.0 with custom action LaunchApplication after InstallFinalize. 4. Version 2.0.0 without custom action LaunchApplication. It is impossible to install any type of version 2.0.0, if version 1.0.0 with custom action was installed. I tried to install version 2.0.0(without custom action) after version 1.0.0(with custom action): === Verbose logging started: 7/22/2015 18:37:48 Build type: SHIP UNICODE 5.00.7601.00 Calling process: C:\Windows\system32\msiexec.EXE === ... Action 18:37:48: FindRelatedProducts. Searching for related applications Action start 18:37:48: FindRelatedProducts. FindRelatedProducts: Found application: {GUID of 1.0.0} MSI (c) (A8:A4) [18:37:48:221]: PROPERTY CHANGE: Adding PREVIOUSFOUND property. Its value is '{GUID of 1.0.0}'. ... Action start 18:37:48: InstallInitialize. MSI (s) (F4:0C) [18:37:48:299]: Machine policy value 'AlwaysInstallElevated' is 0 MSI (s) (F4:0C) [18:37:48:299]: User policy value 'AlwaysInstallElevated' is 0 MSI (s) (F4:0C) [18:37:48:299]: BeginTransaction: Locking Server MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 1715 2: TestApp 2.0.0 MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (F4:0C) [18:37:48:299]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 102, llSequenceNumber: 0, szDescription: "Installed TestApp 2.0.0". MSI (s) (F4:0C) [18:37:48:299]: The System Restore service is disabled. Returned status: 1058. GetLastError() returned: 1058 MSI (s) (F4:0C) [18:37:48:299]: Server not locked: locking for product {GUID of 2.0.0} Action ended 18:37:48: InstallInitialize. Return value 1. MSI (s) (F4:0C) [18:37:48:845]: Doing action: RemoveExistingProducts MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2205 2: 3: ActionText Action start 18:37:48: RemoveExistingProducts. MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038 ... Action start 18:37:48: InstallFinalize. ... MSI (s) (F4:AC) [18:37:48:939]: Verifying accessibility of file: start.vbs MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2: MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2: ... Action ended 18:37:48: InstallFinalize. Return value 1. MSI (s) (F4:AC) [18:37:48:939]: Doing action: LaunchApplication MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2205 2: 3: ActionText Action start 18:37:48: LaunchApplication. MSI (s) (F4:AC) [18:37:48:939]: Creating MSIHANDLE (9) of type 790542 for thread 8108 MSI (s) (F4:B0) [18:37:48:939]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIECB.tmp, Entrypoint: WixShellExec MSI (s) (F4:24) [18:37:48:939]: Generating random cookie. MSI (s) (F4:24) [18:37:48:939]: Created Custom Action Server with PID 8596 (0x2194). MSI (s) (F4:48) [18:37:48:970]: Running as a service. MSI (s) (F4:48) [18:37:48:970]: Hello, I'm your 32bit Impersonated custom action server. MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (10) of type 790541 for thread 1140 MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (11) of type 790531 for thread 1140 MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (11) of type 790531 for thread 1140 MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (12) of type 790531 for thread 1140 WixShellExec: Error 0x80070002: ShellExec failed with return code 2 MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (12) of type 790531 for thread 1140 MSI (s) (F4!74) [18:37:49:017]: Creating MSIHANDLE (13) of type 790531 for thread 1140 WixShellExec: Error 0x80070002: failed to launch target MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (13) of type 790531 for thread 1140 MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (10) of type 790541 for thread 1140 CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) MSI (s) (F4:B0) [18:37:49:017]: Closing MSIHANDLE (9) of type 790542 for thread 8108 Action ended 18:37:49: LaunchApplication. Return value 3. Action ended 18:37:49: INSTALL. Return value 3. ... Property(N): WixShellExecTarget = [#start.vbs] ... CustomAction returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038 Action ended 18:37:49: RemoveExistingProducts. Return value 3. MSI (s) (F4:0C) [18:37:49:017]: User policy value 'DisableRollback' is 0 MSI (s) (F4:0C) [18:37:49:017]: Machine policy value 'DisableRollback' is 0 MSI (s) (F4:0C) [18:37:49:017]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1190565049,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0) MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=0,Argument=1033) MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=1,Argument=TestApp 1.0.0) MSI (s) (F4:0C) [18:37:49:017]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1]) MSI (s) (F4:0C) [18:37:49:017]: Executing op: SetTargetFolder(Folder=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\) MSI (s) (F4:0C) [18:37:49:017]: Executing op: FileCopy(SourceName=C:\Config.Msi\1bc1cc05.rbf,,DestName=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs,Attributes=40992,FileSize=331,PerTick=0,,VerifyMedia=0,ElevateFlags=1,,,,,,,InstallMode=4194308,,,,,,,) MSI (s) (F4:0C) [18:37:49:017]: File: C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs; To be installed; Won't patch; No existing file ... MSI (s) (F4:0C) [18:37:49:126]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0) MSI (s) (F4:0C) [18:37:49:126]: Error in rollback skipped. Return: 5 MSI (s) (F4:0C) [18:37:49:126]: No System Restore sequence number for this installation. MSI (s) (F4:0C) [18:37:49:126]: Unlocking Server MSI (s) (F4:0C) [18:37:49:173]: Note: 1: 2205 2: 3: Control Action ended 18:37:49: INSTALL. Return value 3. ... MSI (s) (F4:0C) [18:37:49:173]: MainEngineThread is returning 1603 MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed. MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed. MSI (s) (F4:78) [18:37:49:173]: No System Restore sequence number for this installation. MSI (s) (F4:78) [18:37:49:173]: User policy value 'DisableRollback' is 0 MSI (s) (F4:78) [18:37:49:173]: Machine policy value 'DisableRollback' is 0 MSI (s) (F4:78) [18:37:49:173]: Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F4:78) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (s) (F4:78) [18:37:49:189]: Restoring environment variables MSI (s) (F4:78) [18:37:49:189]: Destroying RemoteAPI object. MSI (s) (F4:24) [18:37:49:189]: Custom Action Manager thread ending. MSI (c) (A8:A4) [18:37:49:189]: Back from server. Return value: 1603 MSI (c) (A8:A4) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (A8:A4) [18:37:49:189]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'. Action ended 18:37:49: ExecuteAction. Return value 3. Action ended 18:37:49: INSTALL. Return value 3. ... === Logging stopped: 7/22/2015 18:37:49 === MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 1708 MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038 MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038 MSI (c) (A8:A4) [18:37:49:189]: Product: TestApp 2.0.0 -- Installation failed. As I understand the root cause problem is that I do not use "NOT Installed AND NOT UPGRADINGPRODUCTCODE" condition in custom action LaunchApplication. <Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom> In this case installer during installation of new version removes the old version, and then tries to run custom action LaunchApplication from the old version, but all files are already removed. That's why installation fails. I added condition "NOT Installed AND NOT UPGRADINGPRODUCTCODE" to LaunchApplication and now it is possible to perform major upgrade of my application. But I am not sure which condition should I use - "NOT Installed AND NOT UPGRADINGPRODUCTCODE" or "NOT Installed". I need to run custom action LaunchApplication during first installation and during all major upgrades.
Not sure this is an answer but there's too much for a comment. First, do the upgrades with verbose logging, msiexec.exe command with a /L*vx to see what's going on because there are a number of things that don't make sense. Your custom action is after InstallFinalize, which means it is after the install has completed and committed so it cannot cause the the upgrade to fail. Your RemoveExistingProducts is before InstallInitialize. This means that it is outside the install transaction that starts at InstallInitialize. It really needs to be just after InstallInitialize to be included in the transation because currently it is independent of your new product install, and so you can get any combination of the remove failing or working and your install failing or working and you can end up with an indeterminate set of products on your system. None, noth or one of them. What's SELFFOUND? I'd expect an Upgrade element to refer to it but there isn't one. In general you should look at the MajorUpgrade element and set attributes such as AllowSameVersionUpgrades to No if you want to prevent installing a major upgrade with the same version. If SELFFOUND is intended to prevent installing the same MSI file twice, then don't bother because Windows won't let you do that anyway. So there's not really enough info to see what's going on, but that CA can't be responsible. The most likely explanation is that the first upgrade fails - it removes the older product, then your new install fails, and because the remove is outside the transaction all you see is the remove working and your install failing. When you install again it's a fresh system, that's the main difference. Check the logs!
Issue installing Windows Service
I'm trying to create an installer for a Windows Service, and I have no idea why it's failing. Here's the fragment where I define the service-related pieces: <ComponentGroup Id="ServiceComponents" Directory="InstallDirectory"> <Component Id="ThingService" Guid="1F4D7F24-BC66-4E7A-AC33-A7E2133FC5B8" KeyPath="yes"> <ServiceInstall Id="ThingServiceInstaller" Type="ownProcess" Name="ThingService" DisplayName="Thing" Description="Does Thing." Start="auto" ErrorControl="normal" Vital="yes" /> <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ThingService" Wait="yes" /> </Component> </ComponentGroup> This is the last part that runs - the files are all deployed earlier, and I can see that they get where they're supposed to. When it gets to starting the service, I get the following error: Service 'ThingService' (ThingService) failed to start. Verify that you have sufficient priveleges to start system services. However, I don't see the service in the service list at all, so I don't know what it's even trying to start. I feel like I'm missing some sort of pointer to Thing.exe, but the examples I see around don't seem to have it either. Here are the pieces from the verbose log that seem to be relevant: 1: MSI (s) (50:F8) [16:14:38:880]: Component: ThingService; Installed: Absent; Request: Local; Action: Local 2: MSI (s) (50:F8) [16:14:40:736]: Doing action: StopServices MSI (s) (50:F8) [16:14:40:736]: Note: 1: 2205 2: 3: ActionText Action 16:14:40: StopServices. Stopping services Action start 16:14:40: StopServices. StopServices: Service: Stopping services Action ended 16:14:40: StopServices. Return value 1. MSI (s) (50:F8) [16:14:40:740]: Doing action: DeleteServices MSI (s) (50:F8) [16:14:40:740]: Note: 1: 2205 2: 3: ActionText Action 16:14:40: DeleteServices. Deleting services Action start 16:14:40: DeleteServices. Action ended 16:14:40: DeleteServices. Return value 1. MSI (s) (50:F8) [16:14:40:747]: Doing action: RemoveRegistryValues MSI (s) (50:F8) [16:14:40:747]: Note: 1: 2205 2: 3: ActionText Action 16:14:40: RemoveRegistryValues. Removing system registry values Action start 16:14:40: RemoveRegistryValues. Action ended 16:14:40: RemoveRegistryValues. Return value 1. 3: MSI (s) (50:F8) [16:14:40:944]: Doing action: InstallServices MSI (s) (50:F8) [16:14:40:944]: Note: 1: 2205 2: 3: ActionText Action 16:14:40: InstallServices. Installing new services Action start 16:14:40: InstallServices. Action ended 16:14:40: InstallServices. Return value 1. MSI (s) (50:F8) [16:14:40:945]: Doing action: StartServices MSI (s) (50:F8) [16:14:40:945]: Note: 1: 2205 2: 3: ActionText Action 16:14:40: StartServices. Starting services Action start 16:14:40: StartServices. StartServices: Service: Starting services Action ended 16:14:40: StartServices. Return value 1. 4: MSI (s) (50:F8) [16:14:40:994]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1]) Action 16:14:40: StopServices. Stopping services MSI (s) (50:F8) [16:14:40:996]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000) MSI (s) (50:F8) [16:14:40:996]: Executing op: ServiceControl(,Name=ThingService,Action=2,Wait=1,) MSI (s) (50:F8) [16:14:40:996]: Executing op: ActionStart(Name=CreateFolders,Description=Creating folders,Template=Folder: [1]) 5: MSI (s) (50:F8) [16:14:41:817]: Executing op: ActionStart(Name=StartServices,Description=Starting services,Template=Service: [1]) Action 16:14:41: StartServices. Starting services MSI (s) (50:F8) [16:14:41:817]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000) MSI (s) (50:F8) [16:14:41:817]: Executing op: ServiceControl(,Name=ThingService,Action=1,Wait=1,) StartServices: Service: ThingService Error 1920. Service 'ThingService' (ThingService) failed to start. Verify that you have sufficient privileges to start system services. EDIT1: It looks like the issue is with splitting the ServiceInstall/ServiceControl out into their own component, because it works if I put them into the same component as where the Files are defined.
The ServiceInstall must be in the same Component as the service executable, because Windows Installer defines the ServiceInstall table with a foreign key to the Component table and not a path to the executable (see http://msdn.microsoft.com/en-us/library/aa371637(VS.85).aspx). Reference here.
WiX: Can't stop service despite being able to install and start it as LocalSystem
This is my .wxs file Particularly I managed to install a service as a LocalSystem user, and started it: <!-- Directory where [prey]/versions/[version] will be --> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLLOCATION" Name="Prey"> <Directory Id="VersionsDir" Name="versions"> <Directory Id="VersionDir" Name="$(var.ProductVersion)"> <Directory Id="BinDir" Name="bin"> <Directory Id="BinWindowsDir" Name="windows"> <Component Id="CronServiceExe" Guid="ECC25B2A-FB2E-425A-92AD-DCF1D34204FF"> <File Id="file_8FF048AD40124B9F9C07126F2C14A765" Checksum="yes" KeyPath="yes" Source="source-msi\versions\0.10.0\bin\windows\cronsvc.exe" /> <ServiceInstall Id="CronServiceInstaller" Type="ownProcess" Vital="yes" Name="CronService" DisplayName="Cron Service" Start="auto" Account="LocalSystem" ErrorControl="normal" Interactive="no"> </ServiceInstall> <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="CronService" Wait="yes" /> </Component> <Component Id="CronServiceDll" Guid="75C4129B-C28A-45A8-9F06-CB496259FE7F"> <File Id="file_11D016207EA34826A20A52524A3A82BC" Checksum="yes" KeyPath="yes" Source="source-msi\versions\0.10.0\bin\windows\Cronsvclib.dll" /> </Component> </Directory> </Directory> </Directory> </Directory> </Directory> </Directory> And it runs fine. Everything is OK, except when I get to uninstall the product. Because despite being asked in an UAC dialog I get (Screenshot), the installer insist that I don't have permissions to stop the service. Here is the screenshot of the Error, which says: Service 'Cron Service' (CronService) could not be stopped. Verify that you have sufficient privileges to stop system services. And, here is the specific logs (I'm uninstalling with /L*v option to get verbose logs). You can get the full file in this gist. Lines 2220 - 2226 MSI (s) (90:80) [19:11:54:953]: Note: 1: 2205 2: 3: Icon MSI (s) (90:80) [19:11:54:953]: Note: 1: 2205 2: 3: TypeLib MSI (s) (90:80) [19:11:54:953]: Note: 1: 2727 2: MSI (s) (90:80) [19:11:54:973]: RESTART MANAGER: Detected that the service CronService will be stopped due to a service control action authored in the package before the files are updated. So, we will not attempt to stop this service using Restart Manager MSI (s) (90:80) [19:11:54:973]: Note: 1: 2727 2: MSI (s) (90:80) [19:11:54:973]: Doing action: InstallInitialize MSI (s) (90:80) [19:11:54:973]: Note: 1: 2205 2: 3: ActionText Action ended 19:11:54: InstallValidate. Return value 1. Lines 4624 - 4635 MSI (s) (90:80) [19:11:57:196]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1]) MSI (s) (90:80) [19:11:57:196]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000) MSI (s) (90:80) [19:11:57:196]: Executing op: ServiceControl(,Name=CronService,Action=2,Wait=1,) MSI (s) (90:80) [19:12:27:239]: Note: 1: 2205 2: 3: Error MSI (s) (90:80) [19:12:27:239]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1921 MSI (s) (90:80) [19:16:38:940]: Note: 1: 2205 2: 3: Error MSI (s) (90:80) [19:16:38:940]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 MSI (s) (90:80) [19:16:38:940]: Product: Prey Anti-theft -- Error 1921. Service 'Cron Service' (CronService) could not be stopped. Verify that you have sufficient privileges to stop system services. MSI (s) (90:80) [19:17:08:983]: Note: 1: 2205 2: 3: Error MSI (s) (90:80) [19:17:08:983]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1921 MSI (c) (48:84) [19:12:27:239]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg Given all that information. I infere that somewhere I have to manage to start my MSI as an administrator. Or not? That's my problem: Is there a way to set up my .msi installer as an "admin only" one? (If that choice does exist). The weird thing is that all posts and google results I'm getting are about problems INSTALLING and STARTING the service, rather than STOPPING it. So I'm in a dead end. Please, all help will be very useful and appreciated.
The error message includes the suggestion that it's a permissions problem. That's rarely the case, since installing services requires elevated permissions to begin with. Failure to stop a service is usually as simple as the service not responding to the stop request quickly enough. Does CronService implement the service interface to respond to stop requests? Neither MSI nor Windows will kill a service process to stop it.