Show-InstallationRestartPrompt with no users logged in

Topics: Archive - General
Jul 21, 2014 at 11:00 PM
Howdy. I need my app to reboot at the end of my script and I love Show-InstallationRestartPrompt for the "restart later" option; However, if no user is logged in, the reboot simply never happens. What's a better way to reboot a computer with no users logged in while still maintaining the Show-InstallationRestartPrompt for logged in users? Currently I use this:
Show-InstallationRestartPrompt -CountdownSeconds 500 -CountdownNoHideSeconds 120

Thanks!
Jul 22, 2014 at 5:00 PM
In case anybody else finds themselves in a dilemma like mine, here's the solution I came up with:
$info = gwmi -class win32_computerSystem -ea silentlycontinue | Select-Object username
if ($info.username.Length -gt 0){
Show-InstallationRestartPrompt -CountdownSeconds 500 -CountdownNoHideSeconds 120
}
else { 
Execute-Process "Shutdown" -Arguments "/R /F /T 10"
}
This is in my Post-Installation Phase.
Coordinator
Jul 24, 2014 at 11:42 AM
In the latest source code, when Show-InstallationRestartPrompt is called in Non-Interactive / Silent Mode, the computer is restarted immediately instead of being bypassed entirely. Might be considered a bit severe of an action though - what do people think?

Dan
Coordinator
Jul 24, 2014 at 3:54 PM
Actually, I've reverted that change. Doing what you're doing is safer I think