Jump to content

WinPE 2005 rebooting from HTA


randalldale

Recommended Posts

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


  • 2 weeks later...

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...

Link to comment
Share on other sites

  • 1 month later...
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)

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...