tblo Posted August 16, 2009 Posted August 16, 2009 (edited) So I'm building a computer for a friend of mine & I wanted it to be as complete in every respect as a OEM the likes of hp or dell. The tower assembled .(check), windows installed booted to audit mode custom progs installed OOBE entered rebooted winpe booted imagex .wim captured.(check), Windows OPK used to make custom winre with all peimg pakages installed including HTA & scripting with /list to verify.(check) ,4 days of R&D to learn how & to write my very first HTA (looks better then I ever hoped).(check), extensive testing of said HTA in windows.(check),final test deploy winre solution & run HTA localy to apply custom .wim & be sure everything works.(check/FAILURE!!!!!!!!!!!!!!!!!!!!!!)In windows my custom HTA just runs nicely. In windows PE/RE it asks what program it should open with only option is notepad & browse dose not work. I manually verify'd mshta.exe exsists I also used peimg to verify there was a + meaning installed next to everything cept the jp/ko lang packs (english here mate!). Hell I even rebuilt the winre from scratch just to be sure even tried using /prep. same results I cannot get the HTA to run. I have read & seen other HTA tools meant for winpe/re.Someone please help.my solution uses 4 files self explanitory I am including the code for all filesA.jpg <----just some cool looking 1024x768 background make this shiz look cool.----------------------------------------------------SystemImageRestore.hta <--problem child gui & 4 days of R&D in a topic iv never before dabled in. scource as follow<head><title>System Image Restore</title><HTA:APPLICATION APPLICATIONNAME="System Image Restore"SCROLL="no"SINGLEINSTANCE="yes"Windowstate="maximize"Border="none"Innerboarder="no"></head><script language="VBScript">Sub GOblnAnswer = window.confirm("Are you sure you want to continue?")If blnAnswer Thencancel.Disabled = TRUERestore.Disabled = TRUEDataArea.InnerHTML = "This may take some time please wait system will automatically restart when done."Dim WshShell Set WshShell = CreateObject("WScript.Shell") WshShell.Run "Recover.bat", 1, trueElseMsgbox "Aborted"End IfEnd Sub Sub CancelScriptSelf.Close()End Sub</script><body><text><center><p align="center"><font color="Red" face="Times New Roman" size="12">Automated System Restore<p align="center"><font color="white" face="Times New Roman" size="2">This is the automated system image Recovery program.<p align="center">This program will FORMAT your computer (ERASE's EVERYTHING).<p align="center">This program will then restore your computer to the state it was in<p align="center">originally. <p align="center">ALL DATA WILL BE ERASED. <p align="center">If you need to backup your data first please EXIT & reboot NOW<p align="center">If you are ready then please click "Restore My Computer"<p align="center">ALL DATA WILL BE ERASED</font></center></text><br><br><br><br><br><table width="100%"><tr><td width="25%" valign="top"></td><td width="25%" valign="top"></td><td width="25%" valign="top"><input type="button" value="Restore My Computer" name="Restore" onClick="Go"><input type="button" value="I've Changed My Mind" name="Cancel" onClick="CancelScript" ></td></tr></table><br><p><center><p align="center"><font color="green" face="Times New Roman" size="6"><span id = "DataArea"></span></center><body background = "A.jpg"></body>-------------------------------------------------------Recover.bat <-----The real heavy weight doing all the work scource as followsstart x:\tools\SystemImageRestore.hta <----(bring back to front so as to hide cmd while working)diskpart /s x:\tools\diskpart.txtimagex /apply x:\images\vista64.wim 1 c:\Shutdown /r /t 1 <------ yea i know dosent exsist in winpe so i copy'd shudown.exe from vista install-----------------------------------------------------Diskpart.txtselect disk 0select partition 1FORMAT FS=NTFS LABEL="Vista" QUICK exit Edited August 16, 2009 by Tripredacus code tags added
Tripredacus Posted August 16, 2009 Posted August 16, 2009 There is a lot of things wrong with how this done. First I can say, welcome to the forum! It will take a real lot of work and learning before you can make a recovery partition as robust as what HP and Dell have! It is possible to even create a recovery partition with the WAIK and not use WinRE. I know, I've done it!Firstly, you should read the documentation that comes with the OPK Tools. Second, it doesn't appear that you are even using WinRE here, since the steps you are outlining are completely different. If you are having difficulty in obtaining the correct information to help you use WinRE, you should contact your TAM or other Channel Rep. You can get this information from logging into the OEM Channel. If you are not employed by a Certified System Builder, you need to use the WAIK.Now that all the legal stuff is out of the way, here are a few things you didn't do right:1. In order to launch an HTA from the PE, you need to use MSHTA to launch it. I used WINPESHL.INI to launch my HTA. This is done if you want to limit the end user from being able to access the command prompt.2. What you are doing is very similar to something I have done in the past. For the diskpart script, you are missing a lot.Check out this thread of mine. Note the disclaimer at the top, about how some info wasn't posted. Especially the final (working) HTA.http://www.msfn.org/board/index.php?showtopic=130645
tblo Posted August 18, 2009 Author Posted August 18, 2009 (edited) There is a lot of things wrong with how this done. First I can say, welcome to the forum! It will take a real lot of work and learning before you can make a recovery partition as robust as what HP and Dell have! It is possible to even create a recovery partition with the WAIK and not use WinRE. I know, I've done it!Firstly, you should read the documentation that comes with the OPK Tools. Second, it doesn't appear that you are even using WinRE here, since the steps you are outlining are completely different.First i would like to respond in kind & say thank you for both the welcome & the fast reply(and for editing my code into them nice code box's(now i needa find where to do that at)) Now to the meat & potato's of this post. The steps I outlined were not for the AIK (automated instalation kit) but rather for the OPK (Oem preinstallation kit). as I have used both I can attest that they are the same thing minus a few small but vital diffrences.in both cases you runcopype.cmd <arch> <destination>In windows aik you would then use imagex to extract the winRE out of the boot.wim of the vista install disk. This has a down side tho. you can add custom files & stuff through mountrw or capture via imagex but there are some built in pakages that "can be" installed to winpe/re that are not in the version that you extract from the boot.wim & MS ran /prep on that winre version making it impossible to use peimg to add any of these packages.(HTA & scripting support are 2 such built in non apply'd packages.)In the windows OPK there is a base winpe.wim in the same dir as ISO mount & the rest of those good files. this winpe.wim you can add (or not) any packages you want using peimg(the SRT package is the recovery console tho the winpeshl.ini is what makes the diffrence(delete that .ini from any winRE reboot into it & it's now WinPE)) Because peimg /prep was not used on the base winpe you get from the opk there is nothing locked out. (well within reason of winpe/re standards here).I could use that same .ini to auto launch my custom hta sure but the start up recovery & system restore can be handy at times & I would like them available.My hta launches a .bat file & disables the buttons to prevent double running & the bat file inturn relaunches the hta file except that its single instance so it just come back into view hiding the cmd window as it works.also my hta file did have a few small errors that a friend of mine that (that codes html) jus happend to stop by today pointed out. (couldent get him over when i was writing this shiz so the hta i posted before was all mine (with lots of help from the coding guys on microsofts forums that show you the basics of writing a hta. (I started with a few lines of code for a window and a button that told you what OS you had. added back drop figured out how to repourpose the button add another move around ...... you get the idea. what started as 6 line of thir code turned into like 30 lines of mine(first prog i ever wrote first html I ever scripted on my own instead of just changing backdrop url's & hight/width))))Also first time I ever used diskpart (EVER!) I will be reading your linked post in a moment to see what is in error but in a live test I tried it works perfectly.On the note of my HTA I found that a command line or .bat of"mshta" "X:\tools\recovery.hta" will make it run so i guess my original problem is solved however adding a .bat to the winRE dashboard = "UNKNOWN" with no discription altho it works perefectlyusing a shortcut .lnk results in "application faild to start. I hoped a shortcut would work as it would allow me to have a icon & add a comment (I had hoped would show up as discription proved nul & void so never found out).So new question is there a way to add a discription to the metadata of a .bat and or someway to manually add a discription to the winRE dashboard(and maybe a nice looking icon)?On the note of HP or DELL I wanted it to look professionally done like theirs would & the .hta i made I think fits the bill. As for robust I'll get to that level one of these days or years but robust is not my concern atm simplicity is.Here is my revised HTA curtasy my friend. same stuff really just moved the buttons & corrected the lack of </p>'s<head><title>System Image Restore</title><HTA:APPLICATION APPLICATIONNAME="System Image Restore" SCROLL="no" SINGLEINSTANCE="yes" Windowstate="maximize" Border="none" Innerboarder="no"></head><script language="VBScript"> Sub GO blnAnswer = window.confirm("Are you sure you want to continue?") If blnAnswer Then cancel.Disabled = TRUE Restore.Disabled = TRUE DataArea.InnerHTML = "This may take some time please wait system will automatically restart when done." Dim WshShell Set WshShell = CreateObject("WScript.Shell") WshShell.Run "X:\Tools\Recover.bat", 1, true Else Msgbox "Aborted" End If End Sub Sub CancelScript Self.Close() End Sub </script><body background = "A.jpg"><text><center><p align="center"><font color="Red" face="Times New Roman" size="12">Automated System Restore</p><p align="center"><font color="white" face="Times New Roman" size="3">This is the automated system image Recovery program.<br>This program will FORMAT your computer (ERASE's EVERYTHING).<br>This program will then restore your computer to the state it was inoriginally. <br>ALL DATA WILL BE ERASED. <br>If you need to backup your data first please EXIT & reboot NOW<br>If you are ready then please click "Restore My Computer"<br>ALL DATA WILL BE ERASED</p></font></center></text><br><br><br><br><br><br><table width="100%"> <tr> <td width="25%" valign="top"><input type="button" value="Restore My Computer" name="Restore" onClick="Go"></td> <td width="50%" valign="top"></td> <td width="25%" valign="top"><input type="button" value="I've Changed My Mind" name="Cancel" onClick="CancelScript" ></td> </tr></table><br><center><p align="center"><font color="green" face="Times New Roman" size="6"><span id = "DataArea"></span></center></body>If you are not employed by a Certified System Builder, you need to use the WAIK.On this note lol I am Employed by walmart as a electronics cashier. But computer building is a hobby of mine & I order OEM copys of windows from newegg.The OEM copys come with info on howto reg as a OEM with MS & for "s***s & gigles" & because this is truly a hobby of mine I regesterd myself as one. That was a few years ago but i still get their newsletter & my login still works (I know I used it other day to download the OPK to replace my AIK so I could build my own PE/RE instead of extracting from the disk with imagex so i could add HTA support.) So I guess I am the regesterd OEM. ...... maybe I should get some employee's. Edited August 18, 2009 by tblo
Tripredacus Posted August 19, 2009 Posted August 19, 2009 I have no knowledge of the functional differences between the standard PE and the modified RE that you have made. Although, there are particular licensing issues regarding your ability to create this tool to be used on a computer that you are selling or giving to someone else. I'm no master in licensing, but it controls what I can and cannot do in my own job as well. Also, in your new HTA code, there is no particular reason you would ever need to call a batch file from it. Since VBScript can do everything that batch files can do. IMO, it is less professional to use batch files to do certain things unless absolutely necessary, OR you are feeling lazy. It may be a good start to use batch files (or external programs) but eventually you will want to learn how to make it all without that use. The number one issue with batch files and other types of flat-files is that people can see what they are doing without much work. I typically will hide information (like commands, passwords, innerworkings) in other programs, such as ones created in AutoIT.
tblo Posted August 21, 2009 Author Posted August 21, 2009 I am fluent at bat files hence why I'm using them. Vb is cool and I'd like to learn but ATM I dunno much this hta was a collage of copy paste from of code I saw or read about mixxing in alot of educated guesses and trial/error. I also learned a lil C++ to issue "mshta" x:\tools\*.hta To the command prompt. Woulda been simpler to use a bat but i want a icon and program descriptionoddly I figured out how to write C++ easier then I can figure out how to add a icon and description in MS visual studio 08 4 days research I'm still no closer to adding s icon an description.
Atheros Posted August 26, 2009 Posted August 26, 2009 i had the same issue when building my recovery sector. i basically made a HTA and an autoit script to launch it, then found a third party hex exe file tage editor to change the descriptions and version information.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now