Help - Search - Members - Calendar
Full Version: WinPE 2005 rebooting from HTA
MSFN Forums > Unattended Windows Discussion & Support > Windows PE

   
Google Internet Forums Unattended CD/DVD Guide
randalldale
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
zorphnog
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")
randalldale
Thanks although I got my WinPE 2.0 version working so ended up not having to rebuild using WinPE 2005.
Br4tt3
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.hta
2. 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 done
3. Within ur .hta u can use the self.quit or windows.close to end the .hta once it has performed it's duties
4. 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...
randalldale
Thanks I will add that to my information DB as you can never have to much information in the WinPE world.

Randy

thumbup.gif
TofuBug
QUOTE (randalldale @ Jun 1 2007, 04:52 PM) *
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


May 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)

CODE
Function RestartComputer()
  For Each OS in GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2").ExecQuery("Select * from Win32_OperatingSystem")
    OS.Reboot()
  Next
End Function


As 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 Strope

Distributed Services

(Software package development/testing)

Lockheed Martin Systems Integration Owego

(Cyber City Computers)

ryan.strope@lmco.com

Quid quid latine dictum sit, altum videtur
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.