Deinstallation Microsoft Store App

Post Reply
a.oliveira
Posts: 37
Joined: 01. Jun 2021, 14:25
Contact:

Deinstallation Microsoft Store App

Post by a.oliveira » 05. May 2022, 19:15

Guten Tag,

ich möchte auch eine Deinstallation für eine Microsoft Store-App festlegen.

Paket:

Code: Select all

[CopyApp]
[SetupInfo]
Author                  = a.oliveira
CreationDate            = 26.04.2022
InventoryID             =
Description             = Installiert Warehouse Management 2.0.20.0 (Sideloaded App) UWP
Method                  = Scripted
Tested on               = Win10 (x86/x64)
Dependencies            = .net 2.2, VCLibs 14.00
Command line options    = /S0 /AW
Last Change             = 
Build                   = 1

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

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

[Requirements]

[Application]
ProductName=Warehouse Management UWP
DeveloperName=Microsoft Corporation
Version=2.0.20.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
BackgroundPicture=Logo.bmp, -10#, -10#, 0, 0, 000000, NORMAL
CopyDialogRect=0%, 0%, 100%, 100%, HCENTER VCENTER

; 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=0
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

CommonSetupDir=%CommonFilesDir%\Setup%SetupBits%
V_MachineValuesPath=\\%EmpirumServer%\Values$\MachineValues\%DomainName%
V_UserValuesPath=%HKLM,"Software\matrix42\Software Depot","HomeServer"%\Values$\UserValues\%UserDomain%

[Encryption]

[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]
#Reg:Policy
#CopyApp
#Install, CLIENT
 
[Reg:Policy]
HKLM,"SOFTWARE\Policies\Microsoft\Windows\Appx","AllowAllTrustedApps",0x00010001,1
HKLM,"SOFTWARE\Policies\Microsoft\Windows\Appx","AllowDevelopmentWithoutDevLicense",0x00010001,1

[CopyApp]
1:%VM_SourceDir%\Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe.appx,, NORMAL, 1000
1:%VM_SourceDir%\Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe.appx,, NORMAL, 1000
1:%VM_SourceDir%\Microsoft.UI.Xaml.2.4_2.42007.9001.0_x64__8wekyb3d8bbwe.appx,, NORMAL, 1000
1:%VM_SourceDir%\Microsoft.WarehouseManagement_2.0.20.0_neutral___8wekyb3d8bbwe.Msixbundle,, NORMAL, 1000


[Install]
AddMeter -1
Callhidden "Powershell.exe" -ExecutionPolicy Bypass -Command "Add-Appxpackage '%Src%\%VM_SourceDir%\\Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe.appx'"
Callhidden "Powershell.exe" -ExecutionPolicy Bypass -Command "Add-Appxpackage '%Src%\%VM_SourceDir%\Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe.appx'"
Callhidden "Powershell.exe" -ExecutionPolicy Bypass -Command "Add-Appxpackage '%Src%\%VM_SourceDir%\Microsoft.UI.Xaml.2.4_2.42007.9001.0_x64__8wekyb3d8bbwe.appx'"
Callhidden "Powershell.exe" -ExecutionPolicy Bypass -Command "Add-Appxpackage '%Src%\%VM_SourceDir%\Microsoft.WarehouseManagement_2.0.20.0_neutral___8wekyb3d8bbwe.msixbundle'"
If "%Errorlevel%" <> "0" Then "Set:Error" EndIf

[UninstallApp]
Callhidden "Powershell.exe" -ExecutionPolicy Bypass -Command "Add- Remove-AppxPackage '%Src%\%VM_SourceDir%\Microsoft.WarehouseManagement_2.0.20.0_neutral___8wekyb3d8bbwe.msixbundle'"
;If "%Errorlevel%" <> "0" Then "Set:Error" EndIf
;-AddMeter -1 

[Set:Error]
ErrorLogMsg %ErrorLogMessage% ErrorLevel: %ErrorLevel%
Abort %ErrorLogMessage% ErrorLevel: %ErrorLevel%
-Abort %ErrorLogMessage% ErrorLevel: %ErrorLevel%
-ErrorLogMsg %ErrorLogMessage% ErrorLevel: %ErrorLevel%
Ich habe schon mehrere Kommandos zur Deinstallation versucht, aber leider ohne Erfolg.

Name des Microsoft Pakets:

Microsoft.WarehouseManagement

Gladop
Posts: 15
Joined: 27. Apr 2022, 16:49
Contact:

Re: Deinstallation Microsoft Store App

Post by Gladop » 08. Dec 2023, 13:41

Stand in den letzten Tage vor dem gleichen Problem.
Hat bei mir so funktioniert:

Code: Select all

[Set:Deinstallation]
-CallHidden cmd.exe /c schtasks /create /sc ONSTART /delay 0000:40 /ru System /f /tn "Uninstall_%ProductName%_Part_5" /tr "powershell.exe Unregister-ScheduledTask -TaskName """Uninstall_%ProductName%_Part_*""" -Confirm:$false"
-CallHidden cmd.exe /c schtasks /create /sc ONSTART /delay 0000:30 /ru System /f /tn "Uninstall_%ProductName%_Part_4" /tr "dism.exe /online /Remove-ProvisionedAppxPackage /PackageName:%PackageName%"
-CallHidden cmd.exe /c schtasks /create /sc ONSTART /delay 0000:20 /ru System /f /tn "Uninstall_%ProductName%_Part_3" /tr "dism.exe /online /Get-ProvisionedAppxPackages"
-CallHidden cmd.exe /c schtasks /create /sc ONSTART /delay 0000:10 /ru System /f /tn "Uninstall_%ProductName%_Part_2" /tr "dism.exe /online /Remove-ProvisionedAppxPackage /PackageName:%PackageName%"
-CallHidden cmd.exe /c schtasks /create /sc ONSTART /ru System /f /tn "Uninstall_%ProductName%_Part_1" /tr "powershell.exe Remove-AppxPackage -AllUsers -PackageName %PackageName%"

-CallHidden powershell.exe -command Remove-AppxProvisionedPackage -online -allusers -PackageName %PackageName%
-CallHidden powershell.exe -command Remove-AppxPackage -AllUsers -Package %PackageName%
-Del %Windows%\temp\%ProductName%_%DeveloperName%_%Version%_powershell_output.txt
Set PackageName = ReadTextFile ("%Windows%\temp\%ProductName%_%DeveloperName%_%Version%_powershell_output.txt")
-CallHidden cmd.exe /c powershell.exe -command "Get-AppxProvisionedPackage -online | Where-Object {$_.PackageName -like """GraphisoftSE.21795B871412D*"""} | foreach {$_.PackageName}" > "%Windows%\temp\%ProductName%_%DeveloperName%_%Version%_powershell_output.txt"
Im unteren Teil muss nur das "GraphisoftSE.21795B871412D*" gegen "Microsoft.WarehouseManagement*" ausgetauscht werden.
Den oberen Teil, in dem die ganzen Tasks erstellt werden, könnte man theoretisch auch weg lassen.
Bei mir hatte ich aber immer wider das Problem, dass die App nur in den Status "Staged" gesetzt und nicht deinstalliert wurde.
Mit den Tasks, hat sich bei uns als zuverlässig erwiesen.

(Und nicht wundern, warum ich mit der cmd.exe die powershell.exe aufrufe. "Out-File" hat einfach nichts gemacht, wenn ich das im Paket ausgeführt habe.)

Grüße
Gladop

Post Reply

Return to “Paketierung”

Who is online

Users browsing this forum: No registered users and 15 guests