Restart between installs

Hi Guys

Is it possible to first uninstall a application then perform a restart then continue with a new installation?

Yes.

Use PSADT’s Show-InstallationRestartPrompt function to trigger a reboot after the first part.
SCCM might see it as a failure but with the reboot it will retry or the user can retry to speed up the installation.

Thank you for the response!

Can it be done while noone is logged on? I need to do over a weekend on 500 machines

PSADT’s Show-InstallationRestartPrompt function will only show a GUI if a user is logged on.
No user, no GUI needed and triggers a reboot.

Thank you so much!! Have a great day

1 Like

Not sure what im doing wronf but the machine is not restarting. Here is me script

      Execute-Process -Path "amp_P_-_Static_VDI_-_CORP" -Parameters '/R /S /remove 1 /uninstallpassword "XXXXXXX"

      ## Remove-File -Path 'C:\Program Files\Cisco\AMP\local.xml' 

      


	##*===============================================
	##* INSTALLATION
	##*===============================================
	[string]$installPhase = 'Installation'

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
	}

	## <Perform Installation tasks here>


       Show-InstallationRestartPrompt -NoCountdown

       Execute-Process -Path "amp_P_-_Static_VDI_-_CORP.exe" -parameters '/desktopicon 0 /startmenu 0 /contextmenu 1 /skipdfc 0 /skiptetra 0 /S'

Check the log file. It will tell you if it even tried to reboot.

BTW: how does your script know which half of the install to run.
If it can tell, it will only do the first part and reboot over and over.

I would of thought the pre-installion that has the uninstall command then restart and post install reinstall the application

If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
	##*===============================================
	##* PRE-INSTALLATION
	##*===============================================
	[string]$installPhase = 'Pre-Installation'

	## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
	## Show-InstallationWelcome -CloseApps 'Outlook' -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt

	## Show Progress Message (with the default message)
	Show-InstallationProgress

	## <Perform Pre-Installation tasks here>
       
      Execute-Process -Path "amp_P_-_Static_VDI_-_CORP" -Parameters '/R /S /remove 1 /uninstallpassword "xxxxxxxxxx'

              


	##*===============================================
	##* INSTALLATION
	##*===============================================
	[string]$installPhase = 'Installation'

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
	}

	## <Perform Installation tasks here>


       Show-InstallationRestartPrompt -CountdownSeconds 1



       



	##*===============================================
	##* POST-INSTALLATION
	##*===============================================
	[string]$installPhase = 'Post-Installation'

	## <Perform Post-Installation tasks here>

     Execute-Process -Path "amp_P_-_Static_VDI_-_CORP.exe" -parameters '/desktopicon 0 /startmenu 0 /contextmenu 1 /skipdfc 0 /skiptetra 0 /S'

hers the log

[Installation] :: Executing [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files\amp_P_-Static_VDI-_CORP.exe /desktopicon 0 /startmenu 0 /contextmenu 1 /skipdfc 0 /skiptetra 0 /S]… Execute-Process 6/21/2023 9:15:40 AM 14440 (0x3868)
[Installation] :: Execution completed successfully with exit code [0]. Execute-Process 6/21/2023 9:16:27 AM 14440 (0x3868)
[Post-Installation] :: Closing the installation progress dialog. Close-InstallationProgress 6/21/2023 9:16:27 AM 14440 (0x3868)
[Post-Installation] :: Closing the installation progress dialog’s runspace. Close-InstallationProgress 6/21/2023 9:16:27 AM 14440 (0x3868)
[Post-Installation] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -ButtonRightText OK -Icon Information -Message Cisco AMP Upgrade has been Installed.]. Show-InstallationPrompt 6/21/2023 9:16:27 AM 14440 (0x3868)
[Post-Installation] :: The installation progress dialog does not exist. Waiting up to 5 seconds… Close-InstallationProgress 6/21/2023 9:16:27 AM 14440 (0x3868)
[Asynchronous] :: [App Deploy Toolkit Main] called with switch [-ShowInstallationPrompt]. PSAppDeployToolkit 6/21/2023 9:16:31 AM 14944 (0x3A60)
[Asynchronous] :: Displaying custom installation prompt with the non-default parameters: [-Icon Information -Message Cisco AMP Upgrade has been Installed. -ButtonRightText OK]. Show-InstallationPrompt 6/21/2023 9:16:32 AM 14944 (0x3A60)
[Post-Installation] :: The installation progress dialog was not created within 5 seconds. Close-InstallationProgress 6/21/2023 9:16:32 AM 14440 (0x3868)
[Post-Installation] :: Cisco_AMP_7.5.11 Installation completed with exit code [0]. Exit-Script 6/21/2023 9:16:32 AM 14440 (0x3868)
[Post-Installation] :: Check if PowerPoint is in either fullscreen slideshow mode or presentation mode… Test-PowerPoint 6/21/2023 9:16:32 AM 14440 (0x3868)
[Post-Installation] :: PowerPoint application is not running. Test-PowerPoint 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: PowerPoint is running in fullscreen mode [False]. Test-PowerPoint 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: Display balloon tip notification asynchronously with message [Installation complete.]. Show-BalloonTip 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe] is a valid fully qualified path, continue. Execute-Process 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: Working Directory is [C:\Windows\System32\WindowsPowerShell\v1.0]. Execute-Process 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: Executing [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [PowerShell ScriptBlock]]… Execute-Process 6/21/2023 9:16:33 AM 14440 (0x3868)
[Post-Installation] :: NoWait parameter specified. Continuing without waiting for exit code… Execute-Process 6/21/2023 9:16:33 AM 14440 (0x3868)

I suspect you are editing one script and running a different one.
I bet if you added a Pause, the script that you are running will not pause.

Regardless, your script does not detect if the first EXE is installed or not.

Ok I tested again and the uninstall works and the reinstall works just the restart never happens . According to the log it says “invoking Show-InstallationRestartPrompt” … Not sure why its now working but Ill try and come up with something else I suppose

[Pre-Installation] :: Working Directory is [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files]. Execute-Process 6/21/2023 10:08:43 AM 12544 (0x3100)
[Pre-Installation] :: Executing [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files\amp_P_-Static_VDI-_CORP.exe /R /S /remove 1 /uninstallpassword &nNvtg<X[idwJ5)U]… Execute-Process 6/21/2023 10:08:43 AM 12544 (0x3100)
[Pre-Installation] :: Execution completed successfully with exit code [0]. Execute-Process 6/21/2023 10:09:13 AM 12544 (0x3100)
[Pre-Installation] :: Unable to resolve file(s) for deletion in path [C:\Program Files\Cisco\AMP\local.xml] because path does not exist. Remove-File 6/21/2023 10:09:13 AM 12544 (0x3100)
[Installation] :: Invoking Show-InstallationRestartPrompt asynchronously with a [1] second countdown… Show-InstallationRestartPrompt 6/21/2023 10:09:13 AM 12544 (0x3100)
[Post-Installation] :: [amp_P_-Static_VDI-CORP.exe] successfully resolved to fully qualified path [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files\amp_P-Static_VDI-_CORP.exe]. Execute-Process 6/21/2023 10:09:14 AM 12544 (0x3100)
[Post-Installation] :: Working Directory is [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files]. Execute-Process 6/21/2023 10:09:14 AM 12544 (0x3100)
[Post-Installation] :: Executing [C:\Users\anthony.raimondi\Desktop\PSAppDeployToolkit_Static VDI_AMP_7.5.11\Toolkit\Files\amp_P_-Static_VDI-_CORP.exe /desktopicon 0 /startmenu 0 /contextmenu 1 /skipdfc 0 /skiptetra 0 /S]… Execute-Process 6/21/2023 10:09:14 AM 12544 (0x3100)
[Post-Installation] :: Execution completed successfully with exit code [0]. Execute-Process 6/21/2023 10:10:01 AM 12544 (0x3100)

you are supposed to exit the script after you call

Show-InstallationRestartPrompt -Countdownseconds 61 -CountdownNoHideSeconds 60
Start-Sleep -Seconds 5 #JIC
Exit-Script -ExitCode 1641     # 1641 = Hard-Reboot
1 Like

Oh OK ill try that now… Sorry sometimes this confuses me

I think that worked… Thank u so much!!

1 Like

I’ve used AppDeployToolkit to perform the uninstall, and then wrote a Scheduled Task in Powershell to rerun the script as soon as the force reboot has taken place.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.