Show-InstallationRestartPrompt forced when non-interactive ?

Topics: Archive - General
Dec 1, 2014 at 9:14 AM
About the function: Show-InstallationRestartPrompt
and the section:
        ## Bypass if in non-interactive mode
        If ($deployModeNonInteractive) {
            Write-Log -Message "Bypass Installation Restart Prompt [Mode: $deployMode]" -Source ${CmdletName}
            Return
        }
When the script is ran by SCCM and no user is logged on, would it then not be nice to have the computer "forced" restarted instead of bypassing the restart ? There is then no user logged on, so why bypassing instead of restarting at that moment ?
Jan 16, 2015 at 10:34 AM
Does anyone know how I can configure my script so it will restart if no user is logged on.
So not bypassing, but a forced restart if nobody is logged on.

Any ideas how ?
Jan 16, 2015 at 2:28 PM
I got the solution already from another post:
#nobody logged on
If ($deployModeNonInteractive) {
   Execute-Process "Shutdown" -Arguments "/R /F /T 10"
} else {
}
Marked as answer by Pollewops on 1/16/2015 at 6:28 AM