Alte Version ohne Matrix42 deinstallieren

Post Reply
9Made
Posts: 39
Joined: 19. Sep 2022, 08:24
Contact:

Alte Version ohne Matrix42 deinstallieren

Post by 9Made » 04. May 2023, 16:46

Ich möchte eine neue Software mit der Version 3.0.0 verteilen, das Problem ist, dass bei vielen Geräten die 2.0.0 ohne Matrix42 installiert wurde, und beide Versionen den gleichen Registry Key verwenden. Wie kann ich dieses Problem am besten beheben?

Es ist wichtig, dass die alte Version vorher deinstalliert wird.

Code: Select all

[SetupInfo]
Author                  = 
CreationDate            = 
InventoryID             = 
Description             = 3.0.0
Method                  = MSI
Tested on               = Win10 (x64)
Dependencies            = Visual C++ 2008 (x86)
Command line options    = /S0
Last Change             = 
Build                   = 0

[VarDefInfo]
; <Variable>, <Type: 0=Computer 1=User>, <Allow NULL values: 0=No 1=Yes>

[Setup]
Version=14.2
ShowCaption=1
BlockInput=0
Platform=x64

[Requirements]

[Application]
ProductName=Software
DeveloperName=Hersteller
Version=3.0.0
Revision=0
SetupName=%ProductName% %Version% %SetupWizard%
Text1="%ProductName% %Version%",         Arial,           30, , 2170F3, 4,    , LEFT BOLD ITALIC
Text2="%DeveloperName%",                 Arial,           24, , 2170F3, 4,    , LEFT BOLD ITALIC
Text8="%Company%",                       Arial,           18, , 2170F3, 4,  10, RIGHT BOLD ITALIC
Text9="%InstallationFor% %WindowsUser%", Arial,           16, , 2170F3, 4, -18, BOTTOM ITALIC LEFT
BackgroundColor=EFEFEF,000000
CopyDialogRect=0%, 77%, 100%, 100%, HCENTER

; Register all installations in common registry key
UserKeyName=$Matrix42Packages$\%DeveloperName%\%ProductName%
MachineKeyName=$Matrix42Packages$\%DeveloperName%\%ProductName%\%Version%
UninstallKeyName=Matrix42 - %DeveloperName% %ProductName% %Version%
UninstallDisplayName=Matrix42 - %DeveloperName% %ProductName% %Version%
UninstallString=%ReinstallString% /U
ReinstallString="%CommonSetupDir%\Setup.exe" "%App%\%SetupInfDir%\Setup.inf"
;UninstallDisplayIcon="%ApplicationDir%\%SetupInfDir%\Setup.ico",0
UninstallOptions=NOREMOVE NOREPAIR NOMODIFY
ReinstallMode=1
SrcDir=..

; Matrix42 Scripts are copied in a common scripts directory
ApplicationDir=%CommonAppData%\$Matrix42Scripts$\%DeveloperName%\%ProductName%\%Version%

SetupInfDir=Install
DataDir=%Personal%
AskUninstallOld=1
ShellLinks=1
CommonShellLinks=1
CreateUnresolvableShellLinks=1
UseStringSection=Strings:09
UseSysStringSection=SysStrings:09
DateWarning=1
SizeWarning=0
Reboot=0
PreventExternalReboot=1
StartServicesOnReboot=0
CallTimeOut=3600
AbortAfterCallTimeOut=1
DisableCancelButton=1
ShowEndMessage=1
EndMessage=%EndMessageDesc%

[Strings:07]
Disk1=Installationsmedium 1
EndMessageDesc=Die Installation wurde erfolgreich abgeschlossen!
ErrorLogMessage=Die Installation/Deinstallation wurde mit einer Fehlermeldung abgebrochen!
InstallationFor=Installation für:
InstallerDesc=Dienstprogramm zum Installieren einzelner Komponenten.
InstallerName=Installationsprogramm
SetupWizard=Installations-Assistent
Uninstallation=deinstallieren

[Strings:09]
Disk1=Installation media 1
EndMessageDesc=Installation was completed successfully!
ErrorLogMessage=The installation/uninstallation aborted with an error message!
InstallationFor=Installation for:
InstallerDesc=Service program to install single components.
InstallerName=Setup program
SetupWizard=Installation Wizard
Uninstallation=Uninstallation

[SysStrings:07]
Users=Benutzer

[SysStrings:09]
Users=Users

[Environment]
; Directory-Definitions
VM_SourceDir=Files
VM_CustomDir=Custom
VM_ToolsDir=Tools
VM_ManualDir=Manual
VM_PatchDir=Patches

V_MSIInstallerID=
ReInstSuccessMessage1031=Die Konfiguration wurde erfolgreich abgeschlossen.
ReInstSuccessMessage1031_1=Die Konfiguration wurde abgeschlossen.
ReInstSuccessMessage1033=Configuration completed successfully.
ReInstSuccessMessage1033_1=Configuration completed.
MSILogFile=%Temp%\MSI_%ProductName%.%Version%.%Revision%.log
CommonSetupDir=%CommonFilesDir%\Setup%SetupBits%
V_MachineValuesPath=\\%EmpirumServer%\Values$\MachineValues\%DomainName%
V_UserValuesPath=%HKLM,"Software\matrix42\Software Depot","HomeServer"%\Values$\UserValues\%UserDomain%

; Maschinenabhängige Variablen
; machine dependent variables
;VM_<Variable>=%%%V_MachineValuesPath%\%ComputerName%.ini,%ComputerName%,<Variable>%%

; Userabhängige Variablen
; user dependent variables
;VU_<Variable>=%%%V_UserValuesPath%\%WindowsUser%.ini,%WindowsUser%,<Variable>%%

; !!! Setzen der entsprechenden ReplaceEnv Befehle für die Variablen im Abschnitt [Product] nicht vergessen!!!
; !!! Don't forget to set the appropriate ReplaceEnv instructions for the variables in the section [Product]!!!

[Encryption]

[Processes]
Hersteller=Software.exe, Hersteller, KillProcess

[Disks]
1=%Disk1%

[Options]
Installer = %InstallerName%, COPYALWAYS, Installer, "%InstallerDesc%"
Product   = %ProductName%,   COPYALWAYS, Product,   "%ProductDesc%"

[Installer]
1:..\..\..\..\User\Setup.exe,          %CommonSetupDir%, OPTIONAL USEFILENAME DIRECTORY NOSIZEWARNING SETUP, 0
1:..\..\..\..\User\SetupDeu.chm,       %CommonSetupDir%, OPTIONAL USEFILENAME DIRECTORY NOSIZEWARNING SETUP, 0
1:..\..\..\..\User\SetupEnu.chm,       %CommonSetupDir%, OPTIONAL USEFILENAME DIRECTORY NOSIZEWARNING SETUP, 0
1:%Temp%\Setup64.exe,                  %CommonSetupDir%\Setup.exe, OPTIONAL ALWAYS NOSIZEWARNING SETUP WINDOWS64,     0
1:..\..\..\..\User\Setup64.exe,        %CommonSetupDir%\Setup.exe, OPTIONAL ALWAYS NOSIZEWARNING SETUP WINDOWS64,     0
1:%SetupInfDir%\Setup.inf,                             , ALWAYS,                                             0
1:%SetupInfDir%\Setup.ico,                             , NORMAL,                                           0
; 1:%SetupInfDir%\Logo.bmp,                              , NORMAL,                                           0

[Product]
; ReplaceEnv <Variable>

#Set:Product, DONTDELETE
#Set:VCRedist, DONTDELETE
#Set:Uninstall, DELETE
#Set:ChangeMSISourcelist, DONTDELETE
#Shell:Product

[Set:Product]
AddMeter -1
Del "%MSILogFile%"
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" | DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "RepairMSI" Else "InstallMSI" EndIf

[Set:VCRedist]
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E503B4BF-F7BB-3D5F-8BC8-F694B1CFF942},UnInstallString") == "1" | DoesRegKeyExist ("HKLM,SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{E503B4BF-F7BB-3D5F-8BC8-F694B1CFF942},UnInstallString") == "1" Then "SuccessVC" Else "InstallVCRedistx86" EndIf

[InstallVCRedistx86]
CallHidden "%Src%\%VM_SourceDir%\VCRedist\vcredist_x86.exe" /q /norestart
If "%ErrorLevel%" == "1638" Then "SuccessVC" Else "CheckVCRedistGUIDx86" EndIf

[CheckVCRedistGUIDx86]
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E503B4BF-F7BB-3D5F-8BC8-F694B1CFF942},UnInstallString") == "1" | DoesRegKeyExist ("HKLM,SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{E503B4BF-F7BB-3D5F-8BC8-F694B1CFF942},UnInstallString") == "1" Then "SuccessVC" Else "ErrorVC" EndIf

[RepairMSI]
AddMeter -1
AskKillProcesses 20, Software
Sleep 2000
Call MsiExec /Fvomus "%Src%\%VM_SourceDir%\Software.msi" ALLUSERS="1"   REBOOT=REALLYSUPPRESS ARPSYSTEMCOMPONENT=1 /qn /Li "%MSILogFile%"
Sleep 2000
If %ErrorLevel% == "3010" Then "RebootRequired" EndIf
Sleep 5000
If DoesTextInFileExist ("%ReInstSuccessMessage1031%", "%MSILogFile%") == "0" & DoesTextInFileExist ("%ReInstSuccessMessage1031_1%", "%MSILogFile%") == "0" & DoesTextInFileExist ("%ReInstSuccessMessage1033%", "%MSILogFile%") == "0" & DoesTextInFileExist ("%ReInstSuccessMessage1033_1%", "%MSILogFile%") == "0" Then "AbortMSIInst" EndIf
Del "%MSILogFile%"

[InstallMSI]
AddMeter -1
AskKillProcesses 20, Software
Sleep 2000
Call MsiExec /I "%Src%\%VM_SourceDir%\Software.msi" ALLUSERS="1"   REBOOT=REALLYSUPPRESS ARPSYSTEMCOMPONENT=1 /qn /Li "%MSILogFile%"
Sleep 2000
If %ErrorLevel% == "3010" Then "RebootRequired" EndIf
Sleep 5000
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "0" & DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "0" Then "AbortMSIInst" EndIf
Del "%MSILogFile%"

[Set:Uninstall]
-Del "%MSILogFile%"
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" | DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "AbortMSIUnInst" EndIf
-Sleep 5000
If %ErrorLevel% == "3010" Then "RebootRequired" EndIf
-Call MsiExec /X {5AD75CA5-2577} REBOOT=REALLYSUPPRESS /qn /Li "%MSILogFile%"
-Sleep 5000
-AskKillProcesses 20, Software
-AddMeter -1

[RebootRequired]
SetReboot 1
-SetReboot 1

[SuccessVC]
;ErrorLogMsg Die Installation wurde erfolgreich abgeschlossen. Exit!
;Exit Die Installation wurde erfolgreich abgeschlossen.

[ErrorVC]
Echo %ErrorMessageVC% %ErrorLevel%
ErrorLogMsg %ErrorMessageVC% %ErrorLevel%
Abort %ErrorMessageVC% %ErrorLevel%

[AbortMSIInst]
Set ErrorOutput=%ErrorLogMessage% ErrorLevel: %ErrorLevel%
ErrorLogMsg %ErrorOutput%
Abort %ErrorOutput%

[AbortMSIUnInst]
Set ErrorOutput=%ErrorLogMessage% ErrorLevel: %ErrorLevel%
ErrorLogMsg %ErrorOutput%
Abort %ErrorOutput%
-Abort %ErrorOutput%
-ErrorLogMsg %ErrorOutput%
-Set ErrorOutput=%ErrorLogMessage% ErrorLevel: %ErrorLevel%

[SET:ChangeMSISourcelist]
ReplaceRegValue (HKCR,"Installer\Products\%V_MSIInstallerID%\Sourcelist","LastUsedSource","\\%EmpirumServer%","\\%%EmpirumServer%%", 1)
ReplaceRegValue (HKCR,"Installer\Products\%V_MSIInstallerID%\Sourcelist\Net","1","\\%EmpirumServer%","\\%%EmpirumServer%%", 1)

[Shell:Product]
%CommonDesktop%\Software, "Software.exe

User avatar
r.wiegel
Posts: 896
Joined: 05. Feb 2010, 13:45
Location: Regensburg
Contact:

Re: Alte Version ohne Matrix42 deinstallieren

Post by r.wiegel » 05. May 2023, 09:03

ich würde den Aufruf zum Deinstallieren vor der Installation ins Script eintragen:

Code: Select all

[Product]
#Set:Cleanup, DONTDELETE
#Set:Product, DONTDELETE
...

[Set:Cleanup]
Call MsiExec /X {5AD75CA5-2577} REBOOT=REALLYSUPPRESS /qn /Li "%MSILogFile%"

[Set:Product]
Zusätzlich kann man den Wert "DisplayVersion" auswerten und nur bei der Version 2.0 deinstallieren.
Viele Grüße
Roman Wiegel
IT-Consultant

MR Datentechnik - Vertriebs- und Service GmbH

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7969
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Alte Version ohne Matrix42 deinstallieren

Post by Hendrik_Ambrosius » 05. May 2023, 09:08

Dann würde ich in das 3er Paket eine IF-Abprüfung auf Datei oder RegKey einbauen ob die alte Version schon drauf ist und dann die Deinstallation in das 3er Paket einbauen, also in diesem Fall per CALL MSIEXEC /X. Nur drauf achten, dass es in diesem Fall nicht mit einem Minuszeichen startet ("-CALL MSIEXEC") weil es sonst nur bei der Deinstallation ausgeführt wird.
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

User avatar
r.wiegel
Posts: 896
Joined: 05. Feb 2010, 13:45
Location: Regensburg
Contact:

Re: Alte Version ohne Matrix42 deinstallieren

Post by r.wiegel » 05. May 2023, 09:57

Code: Select all

[Product]
#Set:Cleanup, DONTDELETE
#Set:Product, DONTDELETE
...

[Set:Cleanup]
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "GetVersion" EndIf

[GetVersion]
Set V_Version = %HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577}","DisplayVersion"%
;Echo %V_Version%
If %V_Version%<"3.0.0" Then "Set:UninstallOldVersion"  EndIf

[Set:UninstallOldVersion]
Call MsiExec /X {5AD75CA5-2577} REBOOT=REALLYSUPPRESS /qn /Li "%MSILogFile%"

[Set:Product]
...
Viele Grüße
Roman Wiegel
IT-Consultant

MR Datentechnik - Vertriebs- und Service GmbH

9Made
Posts: 39
Joined: 19. Sep 2022, 08:24
Contact:

Re: Alte Version ohne Matrix42 deinstallieren

Post by 9Made » 05. May 2023, 12:15

Vielen Dank euch beiden schon mal für die Hilfe.

Ich habe es getestet und es funktioniert, aber die Software löscht den Registry-Schlüssel bei der Deinstallation nicht.

Wie kann ich die Löschung des Registry-Keys hinzufügen?
Last edited by 9Made on 05. May 2023, 12:37, edited 1 time in total.

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7969
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Alte Version ohne Matrix42 deinstallieren

Post by Hendrik_Ambrosius » 05. May 2023, 12:18

In der REG-Sektion mit einem "-", z.B. so:

[Reg:Product]
-HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","OldKey123"
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

9Made
Posts: 39
Joined: 19. Sep 2022, 08:24
Contact:

Re: Alte Version ohne Matrix42 deinstallieren

Post by 9Made » 05. May 2023, 13:13

Hendrik_Ambrosius wrote: 05. May 2023, 12:18 In der REG-Sektion mit einem "-", z.B. so:

[Reg:Product]
-HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","OldKey123"
Ich habe eine IF-Prüfung in Set:UninstallOldVersion und Set:Uninstall eine IF-Prüfung eingefügt, die Reg:Product zuweist, aber die Registry wird nicht gelöscht. Habe ich den Registry-Befehl falsch eingegeben?

Code: Select all

#Set:Cleanup, DONTDELETE
#Set:Product, DONTDELETE
#Set:VCRedist, DONTDELETE
#Set:Uninstall, DELETE
#Set:ChangeMSISourcelist, DONTDELETE
#Shell:Product

[Set:UninstallOldVersion]
Call MsiExec /X {5AD75CA5-2577} REBOOT=REALLYSUPPRESS /qn /Li "%MSILogFile%"
If DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "Reg:Product" EndIf

[Set:Uninstall]
-Del "%MSILogFile%"
If DoesRegKeyExist ("HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" | DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "AbortMSIUnInst" EndIf
If DoesRegKeyExist ("HKLM,SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5AD75CA5-2577},UnInstallString") == "1" Then "Reg:Product" EndIf
If DoesPathExist ("%HOMEDRIVE%\Hersteller\Software") == "1" Then "AbortMSIUnInst" EndIf
-Sleep 5000
If %ErrorLevel% == "3010" Then "RebootRequired" EndIf
-Call MsiExec /X {5AD75CA5-2577} REBOOT=REALLYSUPPRESS /qn /Li "%MSILogFile%"
-Sleep 5000
-AskKillProcesses 20, Software
-AddMeter -1

[Reg:Product]
-HKLM,"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\","{5AD75CA5-2577}"

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7969
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Alte Version ohne Matrix42 deinstallieren

Post by Hendrik_Ambrosius » 05. May 2023, 13:27

Anscheinend wird die Sektion Set:UninstallOldVersion gar nicht aufgerufen?
Man könnte auf das IF auch verzichten und es generell löschen um eine Fehlerquelle auszuschalten.
Also per #Reg:... anspringen
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7969
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Alte Version ohne Matrix42 deinstallieren

Post by Hendrik_Ambrosius » 05. May 2023, 13:30

Und vielleicht auch mal dies probieren - hängt ja vom PLATFORM Switch ab wie er es gern hätte:

[Reg:Product]
-HKLM,"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\","{5AD75CA5-2577}"
-HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\","{5AD75CA5-2577}"
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

Post Reply

Return to “Paketierung”

Who is online

Users browsing this forum: No registered users and 2 guests