@@ -95,8 +95,10 @@ Source: "*"; Excludes: "\CodeSignSummary*.md,\tools,\tools\*,\appx,\appx\*,\reso
95
95
Source : " tools\*" ; DestDir : " {app} \tools" ; Flags : ignoreversion
96
96
Source : " {#ProductJsonPath}" ; DestDir : " {code:GetDestDir}\resources\app" ; Flags : ignoreversion
97
97
#ifdef AppxPackageName
98
+ #if " user" == InstallTarget
98
99
Source : " appx\*" ; DestDir : " {app} \appx" ; BeforeInstall : RemoveAppxPackage; AfterInstall : AddAppxPackage; Flags : ignoreversion ; Check : IsWindows11OrLater
99
100
#endif
101
+ #endif
100
102
101
103
[Icons]
102
104
Name : " {group} \{#NameLong}" ; Filename : " {app} \{#ExeBasename}.exe" ; AppUserModelID: " {#AppUserId}"
@@ -1481,7 +1483,7 @@ function AppxPackageInstalled(var ResultCode: Integer): Boolean;
1481
1483
begin
1482
1484
AppxPackageFullname := ' ' ;
1483
1485
try
1484
- ExecAndLogOutput(' powershell.exe' , ' -Command ' + AddQuotes(' Get-AppxPackage -Name '' {#AppxPackageName}'' | Select-Object -ExpandProperty PackageFullName' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, @ExecAndGetFirstLineLog);
1486
+ ExecAndLogOutput(' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass - Command ' + AddQuotes(' Get-AppxPackage -Name '' {#AppxPackageName}'' | Select-Object -ExpandProperty PackageFullName' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, @ExecAndGetFirstLineLog);
1485
1487
except
1486
1488
Log(GetExceptionMessage);
1487
1489
end ;
@@ -1496,7 +1498,7 @@ var
1496
1498
AddAppxPackageResultCode: Integer;
1497
1499
begin
1498
1500
if not AppxPackageInstalled(AddAppxPackageResultCode) then begin
1499
- ShellExec(' ' , ' powershell.exe' , ' -Command ' + AddQuotes(' Add-AppxPackage -Path '' ' + ExpandConstant(' {app}\appx\{#AppxPackage}' ) + ' '' -ExternalLocation '' ' + ExpandConstant(' {app}\appx' ) + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, AddAppxPackageResultCode);
1501
+ ShellExec(' ' , ' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass - Command ' + AddQuotes(' Add-AppxPackage -Path '' ' + ExpandConstant(' {app}\appx\{#AppxPackage}' ) + ' '' -ExternalLocation '' ' + ExpandConstant(' {app}\appx' ) + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, AddAppxPackageResultCode);
1500
1502
end ;
1501
1503
end ;
1502
1504
@@ -1505,7 +1507,7 @@ var
1505
1507
RemoveAppxPackageResultCode: Integer;
1506
1508
begin
1507
1509
if AppxPackageInstalled(RemoveAppxPackageResultCode) then begin
1508
- ShellExec(' ' , ' powershell.exe' , ' -Command ' + AddQuotes(' Remove-AppxPackage -Package '' ' + AppxPackageFullname + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1510
+ ShellExec(' ' , ' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass - Command ' + AddQuotes(' Remove-AppxPackage -Package '' ' + AppxPackageFullname + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1509
1511
end ;
1510
1512
end ;
1511
1513
#endif
@@ -1611,7 +1613,9 @@ begin
1611
1613
exit;
1612
1614
end ;
1613
1615
#ifdef AppxPackageName
1614
- RemoveAppxPackage();
1616
+ #if " user" == InstallTarget
1617
+ RemoveAppxPackage();
1618
+ #endif
1615
1619
#endif
1616
1620
if not RegQueryStringValue({ #EnvironmentRootKey} , ' {#EnvironmentKey}' , ' Path' , Path)
1617
1621
then begin
0 commit comments