How can I set the agent to reboot after the post imaging installs run? As of right now everything is installed and works fine how ever the user is left logged in as administrator... I'd like the installs to run then after the cleanup task for the system to reboot it's self. I know I could force the last MSI to reboot but then I'd miss out on the cleanup task.

Thanks for any thoughts!
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Try making your last task a batch file that adds a command to RunOnce, it shouldn't run until after the RunOnceEX post-install tasks finish. Here's something similar to what I've done, Install.bat is zipped along with a folder with the path structure of C\WINDOWS\Temp\PostPost.bat it seems a bit dirty but works pretty well, you could probably just add the Shutdown command to RunOnce but I like the .bat because it gives me an easy way to add small tweaks after everything finishes.

REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v P1 /t REG_SZ /d "CMD /C \"%WINDIR%\Temp\PostPost.bat\"" /f

%systemroot%\system32\shutdown.exe -r -f -t 99 -c "The scripted install is now complete. This system will automaticaly reboot shortly" -d p:2:3
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v PP1 /t REG_SZ /d "CMD /C \"rd /s /q %systemroot%\Temp\PostPost\""
Answered 02/19/2010 by: ncmonag
Senior Yellow Belt

Please log in to comment
I did something really similar, except I added an additional file in there. Basically if you put a shutdown command in the runonce, after login, before the desktop loads, windows has to finish running all the runonce commands before it can show a desktop. The shutdown command will prevent anything else from running or being started. So I put a little bootstrap type thing in there so that the desktop would finish loading. My initial batch file makes a runonce, that runonce starts a batch file, that batch file starts a 3rd batch file, and my 3rd batch file sleeps for 120 seconds or what not, then it initiates the shutdown. I end up with 3 batch files basically, but a little better timing control, so I'm not shutting down windows when a bunch of stuff is still being built or loaded.
Answered 02/25/2010 by: lindsamw
Orange Senior Belt

Please log in to comment
I just created a post install task to execute the shutdown command as the last task to do. I set it to have a time out of 3 min so that the desktop will still load, but once the command is executed and you get the count down to the reboot the KBOX will continue on with whatever is left in the list (e.g. Cleaning Up). I chose 3 min as the timeout based on that was how long it took my oldest machines to get to the desktop of windows xp.
Answered 03/30/2010 by: tcasey
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity