Sonderfall beim Deploymentsystem Wechsel: Probleme mit der UninstallOld-Mechanik

Beim Update von Setup.inf-basierten neo42 Paketen (oder solchen mit identischem RegPackages-Namen) kann es über Deploymentsysteme, die Session 0 nutzen wie Intune und ConfigMgr, dazu kommen, dass das UI der UninstallOld-Mechanik nicht in der Benutzer-Session erscheint - was zu vom Benutzer unbemerkten Installationsabbrüchen führt.

Betroffene Konstellation:

  • Das Vorpaket ist kein PowerShell Paket, heißt gleich wie das zu installierende, steht im selben RegPackagesKey wie das neue Paket und das neue Paket wird über Session 0 gestartet

Lösung

Bis alle Pakete auf PowerShell umgestellt sind, fügt folgendes Snippet in die CustomInstallAndReinstallAndSoftMigrationBegin Funktion ein (Inhalt der ShowInstallationWelcomeBeforeSetupInfUninstall.ps1 Datei):

	if ($DeploymentType -eq 'Install') {
		[scriptblock]$installationWelcomeInstall = {
			[int]$showInstallationWelcomeResult = Show-NxtInstallationWelcome -IsInstall $true -AllowDeferCloseApps
			switch ($showInstallationWelcomeResult) {
				0 {
				}
				1618 {
					Exit-NxtScriptWithError -ErrorMessage 'AskKillProcesses dialog aborted by user or AskKillProcesses timeout reached.' -MainExitCode $showInstallationWelcomeResult
				}
				60012 {
					Exit-NxtScriptWithError -ErrorMessage 'User deferred installation request.' -MainExitCode $showInstallationWelcomeResult
				}
				default {
					Exit-NxtScriptWithError -ErrorMessage "AskKillProcesses window returned unexpected exit code: $showInstallationWelcomeResult" -MainExitCode $showInstallationWelcomeResult
				}
			}
		}
		$installationWelcomeInstall.Invoke()
	}
	Remove-Variable -Name 'installationWelcomeInstall'

Wie ihr das in die Pipeline aufnehmt, seht ihr in der GitHub-Dokumentation.
Mein Befehl im Pipeline Task „Skript Ausführen“ sieht so aus:
Skriptdatei:

<Global.GeneralDirectory>\Add-ContentToCustomFunction.ps1

Argumente:

-DeployApplicationFile "<Phase.PackagePath>\<Run.Version>\Deploy-Application.ps1" -ContentFile "<Global.GeneralDirectory>\ShowInstallationWelcomeBeforeSetupInfUninstall.ps1" -FunctionName CustomInstallAndReinstallAndSoftMigrationBegin
3 „Gefällt mir“