randalldale Posted June 1, 2007 Share Posted June 1, 2007 Hello,First thanks for all the insightful information. Now on to the fun.I install XP SP2 through an unattend.txt and I'm using HTA files to get user information so that I can dynamically build the unattend.txt and runonce.cmd files. Once my HTA file finishes copying I can't seem to figure out the scritping to tell WinPE to reboot. I know that on WinPE 2.0 you just script 'wpeutil reboot' to restart the PC and begin the setup. But nothing I've tried seems to work on WinPE 2005.Is there anything that will work from a .BAT, HTA or VBS file that I can use to tell the system to restart once I finsh copying and execute the winnt32.exe?I know it is probably something simple I'm missing.Things I've tried:objWShell.Run ("cmd.exe shutdown -r")objWShell.Run ("exit")objWShell.SendKeys "exit"Thanks for the help,Randy Link to comment Share on other sites More sharing options...
zorphnog Posted June 4, 2007 Share Posted June 4, 2007 I'm fairly sure that shutdown.exe requires you to use the -t parameter no matter what.So try:objWShell.Run("shutdown -r -t 0") Link to comment Share on other sites More sharing options...
randalldale Posted June 12, 2007 Author Share Posted June 12, 2007 Thanks although I got my WinPE 2.0 version working so ended up not having to rebuild using WinPE 2005. Link to comment Share on other sites More sharing options...
Br4tt3 Posted June 13, 2007 Share Posted June 13, 2007 Just so that u know....Easiest way of rebooting ur WinPE once ur .hta app is done, is to:1. From ur startnet.cmd u add the: Start /Wait cmd.exe /c mshta.exe <full-path>\my-hta.hta2. At the end of the .cmd, make sure u have a quit..... that will close the .cmd (which is the shell) one the .hta i done3. Within ur .hta u can use the self.quit or windows.close to end the .hta once it has performed it's duties4. Now, the .hta will close, the cmd will move down to perform it's next action, which will be a "quit", and there u go...Cheers... Link to comment Share on other sites More sharing options...
randalldale Posted June 19, 2007 Author Share Posted June 19, 2007 Thanks I will add that to my information DB as you can never have to much information in the WinPE world.Randy Link to comment Share on other sites More sharing options...
TofuBug Posted August 7, 2007 Share Posted August 7, 2007 Hello,First thanks for all the insightful information. Now on to the fun.I install XP SP2 through an unattend.txt and I'm using HTA files to get user information so that I can dynamically build the unattend.txt and runonce.cmd files. Once my HTA file finishes copying I can't seem to figure out the scritping to tell WinPE to reboot. I know that on WinPE 2.0 you just script 'wpeutil reboot' to restart the PC and begin the setup. But nothing I've tried seems to work on WinPE 2005.Is there anything that will work from a .BAT, HTA or VBS file that I can use to tell the system to restart once I finsh copying and execute the winnt32.exe?I know it is probably something simple I'm missing.Things I've tried:objWShell.Run ("cmd.exe shutdown -r")objWShell.Run ("exit")objWShell.SendKeys "exit"Thanks for the help,RandyMay be a little late seeing as we're into August but if you want a solid way to reboot PE from an HTA This is what I use any time I need to reboot (Works in PE 1.5, 1.6, 2.0 as well as XP, 2000 ... haven't tried it in vista only because my company is not deploying vista as a production image yet)Function RestartComputer() For Each OS in GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2").ExecQuery("Select * from Win32_OperatingSystem") OS.Reboot() NextEnd FunctionAs long as you have WMI loaded it will work (NOTE: depending on the speed of the Computer it may take WMI a few seconds to process the restart request be patient it will happen)I like to keep a small collection of functions like the one above that i know will operate the same no matter the platform I'm running them on (thankfully we currently only support 2000 and XP) the less re-work i have to do the more time I have to focus on the fun stuff rewriting decade old legacy support tools.Hope that helps.Cheers,Ryan StropeDistributed Services(Software package development/testing)Lockheed Martin Systems Integration Owego(Cyber City Computers)ryan.strope@lmco.comQuid quid latine dictum sit, altum videtur Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now