Reboot the computer without the InstallationRestartPrompt

Topics: Archive - General
Oct 17, 2013 at 9:05 AM
Hi, I'm deploying an application withe the PS App Deployment Toolkit, which kills the explorer.exe process in the middle of the install. Since SCCM installs applications with the local system account, it can't restart the explorer.exe process. I made a workaround for this behaviour. I first give the users an installationprompt, explaining them that they have to save and close every application first, telling them the pc will reboot at the end of the install (they can still choose to defer at this time). So, at the end of the installation, the script should trigger a reboot. I don't want to ask them again (with the installationrestartprompt) if they want this. The pc just has to reboot. (because their desktop is gone! If they press the "restart later" button, they end up with nothing, only their wallpaper with no desktop icons, no taskbar, nothing...)
How can I do this?
Oct 17, 2013 at 8:21 PM
Hi Annemie,

You have a number of options:
  1. Set the Show-InstallationRestartPrompt countdown to 1 second.
  2. Use the PowerShell cmdlet Restart-Computer
  3. Use Execute-Process to launch explorer.exe after the application installs so that you can display the Show-InstallationRestartPrompt.
Hope that helps.

Nov 5, 2013 at 8:58 AM
Hi PowerSheller,

Thanks for the response, I really like the Deployment Kit!

When I use Show-InstallationRestartPrompt or the Restart-Computer , the application installs fine, the computer restarts, but software center says the installation failed after the reboot. Is there a way to set the errorcode before the reboot, because this is very confusing?
Nov 5, 2013 at 2:08 PM
Edited Nov 5, 2013 at 2:08 PM
Hi Annemie,

If you want to use Show-InstallationRestartPrompt, I would set the countdown to 5 or 10 seconds. This gives the toolkit time to finish running and return an exit code of 0, while the countdown counts down from 5 or 10.

I would advise not using Restart-Computer cmdlet as this will cause the toolkit to terminate abnormally and thus, software center will say the installation failed.

Alternatively, you could run the following:
Execute-Process "Shutdown" -Arguments "/R /T 10"
This will kick off a restart after 10 seconds, but doesn't display the toolkit window.

Hope this helps, Dan.