Tripredacus Posted September 18, 2009 Posted September 18, 2009 This is a project thread to create and deploy the WinPE 2.0 GimageX COM based HTA with WinPE 3-4 x64 from WDS.Update: Minimal changes needed for WinPE4 build, see here.I will be using v7.1 version of the program as v9.0 and v9.1 are not functioning enough to use. If anyone wants to try making them work properly, I can add them into this project. See the following resource:http://www.msfn.org/board/17-t97512.htmlLast available versionsVersion 7.1 :: downloadVersion 7.3 :: download from SkyDriveVersion 7.4 Beta Server HTA :: postFirst, this is not a tutorial regarding how to set up the WDS on Server 2008. No questions regarding PXE or WDS errors will be permitted in this thread, only ones relating to the creation of the PE and actual use/behaviour of the HTA in the (booted) PE. Some of these instructions may be used to create this on a DVD, CD or a UFD if a network boot is not an option for you. The specifics of converting this to those methods are not permitted. If you have a question relating to this project but falls into the "non-permitted" category (outlined above), please make a new thread and refer to this topic.This tutorial also uses the following constants. The Server being deployed from is Server 2008 Standard x64. I am also using the OPK Tools, and not the Windows AIK. As a result of these two things, the paths used in the examples below may be incorrect in your case. You may be using the AIK, or your program may have been installed into Program Files (x86). You need to be aware of these differences if they apply to you and adjust your commands appropriately. I am also using the RTM version of the OPK Tools for Windows 7 Enterprise/Server 2008 R2. There may be slight differences from the WAIK, or Release Candidate versions that I am not aware of. If a specific command is not working for you, check what you typed and then check to see if the commands I am using are valid for your version.
Tripredacus Posted October 2, 2009 Author Posted October 2, 2009 (edited) We'll start out with building our base PE that we will work with. You will need to open the Windows PE Tools Command Prompt, and open it as the Administrator. copype.cmd amd64 c:\winpe_amd64xcopy c:\winpe_amd64\winpe.wim c:\winpe_amd64\ISO\sources\boot.wimDism /Mount-Wim /WinFile:c:\winpe_amd64\ISO\sources\boot.wim /index:1 /MountDir:c:\winpe_amd64\mountDism /image:c:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\amd64\WinPE_FPs\winpe-hta.cab"Dism /image:c:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\amd64\WinPE_FPs\winpe-mdac.cab"Dism /image:c:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\amd64\WinPE_FPs\winpe-scripting.cab"Dism /image:c:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\amd64\WinPE_FPs\winpe-wmi.cab"Dism /unmount-Wim /MountDir:c:\winpe_amd64\mount /commitThis adds the HTA, MDAC, Scripting and WMI packages. The MDAC may or may not be required for you, but not having it only can limit future development. Check out the Windows PE User's Guide (in the Start Menu) for more information on each package and how to add them.At this point, you should test your new PE that you made to make sure it works. You may skip this step if you feel sure about it. You will need these steps when you are finished with your PE anyways. The following also assumes a currently active WDS, and these steps will imply that.Update 10-05-09: It seems there was a step left out of the MS instructions. You need to take the files from C:\Program Files\Windows AIK\Tools\amd64 and put them in c:\winpe_amd64\mount\Windows\System32 if you want to have access to Imagex.exe!1. Open Windows Deployment Services as Administrator (runas)2. Expand your server you want to use until you see the containers inside.3. Right-click on the Boot Images container and click Add Boot Image.4. Browse to your PE location (look above if you forgot) choose it.5. CLick next to the Name and Description page. I try to make things easy for my directed audience, so I will rename each line to "Imagex (x64)"6. Keep clicking Next until it loads it and then Finish.Last step, boot a client to the network and choose the new Imagex (x64) if you have a menu, if not it should boot right in. Next we will put the HTA into the image. I've already gone through the liberty of figuring out how to get this working before writing up this post.First, make a folder to extract (or copy to) the files from the v7.1 zip file. If you have a customized one like I do, that's fine, or you can customize it ahead of time too, or leave it at stock. Up to you. There are a few things we need to make or get before we can put this in the Boot.wim. In order for this to work in x64, we need the new GimageX COM files. Not only is there one for x64 but also it is updated to handle Windows 7. Download the full package here:http://www.autoitscript.com/gimagex/After you get this, you need to extract it out. You will find a COM folder and an x64 folder with the gimagex_com.dll inside. Copy this one and replace the one in the v71 folder. The second thing we need to take care of is the BROWSE.EXE program. You may choose to skip this step if you want to test to see if it works anyways. For me, it did not work until I decompiled it and recompiled it for x64. In order to do this, you need to download (or have installed) AutoIT v3.http://www.autoitscript.com/autoit3/Once installed, in the start menu in the AutoIT folder you will find a program called "Decompile .exe to Script". Open this up and point it to the BROWSE.EXE in the v71 folder. In the second box you need to pick a name to save it as, which should be BROWSE.AU3. After it does this, go back into the AutoIT Start Menu and find a program called "Compile Script to .exe". Same concept, first line you choose the BROWSE.AU3 and second you choose the BROWSE.EXE that was already there. Make sure to choose the x64 radio button. In this step you will be overwriting the original BROWSE.EXE (the 32bit one) from the zip file. This is fine because if you want the original one back, just get it out of the Zip again!A little note about the Decompile .exe to Script program. It is used to decompile .EXE files compiled with AutoIT. This does not mean you can decompile any AutoIT based .EXE, just ones that have no password on them. Fortunately, Geezery did not put a password on his EXE so we can decompile it to make it 64bit. Now we are ready to make the Startnet.cmd file. This is what mine looks like on my test server:wpeinitwpeutil initializenetworkping 127.0.0.1 -n 16 -w 1000>nullnet use z: \\7SERVER\images ZarleyZalapski33 /user:kdineenregsvr32 /s misc/gimagex_com.dllmshta.exe x:\windows\system32\imagex.htaThe ping command are in there to delay mapping of the network drive for systems with NICs on an initialization delay. NICs on boards such as the Intel DG45ID and DG45FC (among others) require this in order to be able to be able to map the drive properly. The command after is mapping to the network share where the WIMs are kept. As you can tell, we are going to put all the files from inside the v71 folder into C:\Windows\System32. This includes the MISC folder and the Startnet.cmd! So here are your steps for updating the image with new files:1. Mount the wim using the following command:Dism /mount-wim /wimfile:c:\winpe_amd64\iso\sources\boot.wim /index:1 /mountdir:c:\winpe_amd64\mount2. Next, copy all files from the v71 folder, including the startnet.cmd and paste into c:\winpe_amd64\mount\windows\system32. You may need to provide Admin Rights for replacing the startnet.cmd. After you do this, we are ready to save the image with the following:dism /unmount-wim /mountdir:c:\winpe_amd64\mount /commit3. Lastly we need to refresh the Boot image in WDS. From the WDS CPL, find your image under Boot Images, if named as in the tutorial it will be called Imagex (x64). Right-click on it and choose replace image. When you use the browse box, it will look at the last path (directory) you imported or replaced from the last time you used that option. So if you did nothing in WDS since adding the original Boot.wim, the one that appears when you hit browse will be the file we want. Select that, and go through the screens as you did the first time. It will default the Image name and Description, so you will have to change that again. After it is done and the Finish button lights up, you are good to go. You do not need to restart the WDS service, or refresh the window at all. Boot your client and see how it looks. At this point in the tutorial, you should be able to capture XP, Vista, 2003 and 2008 images just fine. Windows 7 instructions will be added to this thread later. Edited January 27, 2011 by Tripredacus
Tripredacus Posted October 2, 2009 Author Posted October 2, 2009 New PE background will be uploaded soon. You may re-use but do not de/rebrand it.
Tripredacus Posted October 2, 2009 Author Posted October 2, 2009 Because the XML is different from WinPE 2.x to 3.0, this HTA will not work with Windows 7 images created with Imagex from the 7 OPK/WAIK. You can try modifying how the VBScript reads from the network share. For now, I recommend you put your Windows 7 images in a subfolder from the file share, and grab them from there. This will stop them from showing up in the list. I have created a program that will install Windows 7 images from said sub-folders. I will not be able to post the source for that program or give instructions on how to deploy it because they are images with WinRE installed. I will now re-open this thread so that others can have a try at it.Current Issues1. Setres does not work, PE is 800x600.2. Buttons at the bottom do nothing.Starting with SetRes.exe, it is a 32bit EXE and does not work in PEx64. I found another program here that seems to work:http://www.boot-land.net/forums/index.php?showtopic=2897Put it in System32 and run using the following switches:setresolution-x64.exe -r1024x768x32 -hideAlso, the shortcut buttons at the bottom do not work. I have 3 of them changed in my PE version, such as Capture, Mount and Map Network Drive. I run programs instead, such as Install XP Apps, Install Vista Apps and Deploy Windows 7. The command prompt button works, oddly enough, but the restart and shutdown buttons do not work either!
dabone Posted October 15, 2009 Posted October 15, 2009 (edited) Here is my customized version of the imagex.hta.I've been using it in house for awhile now.This version runs under winpe 3.0 (x86 so far, I'll try X64 tomorrow)The big changes I made to get it to run are. The command window.confirm doesn't seem to work for me in pe 3.0 so they got replaced.The xml for the wims are different, so I changed the way the program gets image names, the new way is much slower, but you can use it with new or old wims.This version only support writing out images, giving a command shell, reboot, or shutdown. I made this for system builders to deploy images only. If the Image description has the letters XP in it, the program will automatically put the nt52 bootsector on. Hope this helps other people.later,dabone Edited October 16, 2009 by Tripredacus Removed code for thread organization purposes
dabone Posted October 18, 2009 Posted October 18, 2009 Ok, I've done a little more playing and noticed if you append an older wim with the newer imagex, the xml data for the different images stay the same as the imagex version used.. (I.e PE2.0 images in the wim file have the name located in the first child node, pe 3.0 images have the name in the last child node.)The modification I did uses the gimagex com to select the image number then extract the imagename. It works with new and old and the mixed images I have generated. (I have quite a few images, 40 or 50 of them, so redoing them would be a pain).To speed up the parsing of the xml file, would any of you real programmers care to write a parse routine that takes the raw xml data, then parse out the image number followed by the name? We already have all of the xml in memory, the original programmer just used the xmlcom method of grabbing image number followed by grabbing a specific child node for the name.(Would love to get the windows version out also, so the boot sector type wouldn't be tied by name)Later,dabone
Tripredacus Posted October 19, 2009 Author Posted October 19, 2009 The real problem about the XML parsing that exists in the original code, is that it searches for the index, then does a "node+1" to find the IMAGENAME. This is where it fails to work with the new Imagex XML. It should specifically grab the node by name, since the name is the same in both versions. I have not (personally) been able to decode much of the code other than what I've already said. I appreciate your feedback on this dabone. I am glad that my efforts (with Geezery's help!) has allowed us to even have this conversation. It is really a great application. And like you, I'm also not interested in starting over and using something else.However, I have already accepted that I can make do with using the old PE to capture and the new PE to deploy XP, Vista and Windows 7. Either way, I won't kill the discussion, being able to select Windows 7 images like the older ones would be very helpful.PS: I've never had to do the bootsect part. I've done XP and Vista from the same PE and never did bootsect... I know where this was proved to be needed otherwise, but I haven't encountered such a situation.
dabone Posted October 21, 2009 Posted October 21, 2009 Ok, I've written the code to parse the xml for image names. It doesn't care where in the file it lives.It's just using string functions, I didn't bother trying to figure out that xml crap anymore.It will handle mixed mode images (created with pe 2 and then appended with 3 or vice versa)And its alot faster than using the gimagex com.Do you mind if I post the new parsefile code here?Later,dabone
dabone Posted October 22, 2009 Posted October 22, 2009 Ok this is the parseFile sub only, to use this just replace you entire parseFile sub with this.This version of the sub will extract the image name where ever it is in the childnodes.'****************************************************************************'* parseFile''****************************************************************************Sub parseFile()Set objSel1 = window.document.getElementById("select1")objWIM.Source = myFilepath + objSel1.options(objSel1.selectedindex).textobjWIM.GetWIMInfostrWimInformation = objWIM.XMLImageCount = objWIM.ImageCountSet xNodes = objXMLDocument.selectNodes("//IMAGE")Dim strlenDim namestartDim nameendDim nameposRedim strIndx(ImageCount-1)Redim strNames(ImageCount-1)namepos = 1verpos = 1blnLoaded = objXMLDocument.loadXML(strWimInformation)k = 0 If (blnLoaded = True) And (objXMLDocument.parseError = 0) Then For Each xNode In xNodes objWIM.ImageIndex = k +1 namestart=InStr (namepos,strWimInformation,"<NAME>") nameend=InStr (namepos,strWimInformation,"</NAME>") strlen = nameend - namestart strNames (k) = Mid(strWimInformation,namestart+6,strlen-6) namepos = nameend + 1 strIndx(k) = xNode.getAttribute("INDEX") k = k + 1 Next End IfenumDirsEnd subHope this helps.Also, I'm putting together a posting on my version and the correct way to have multiple wims with a menu.Later,dabone
Tripredacus Posted October 22, 2009 Author Posted October 22, 2009 Dabone, this code works just fine! Good job. Now it appears everything is squared away for this HTA in 64bit.
Tripredacus Posted November 2, 2009 Author Posted November 2, 2009 New Skin on this post:http://www.msfn.org/board/index.php?s=&...st&p=885860Additional changes in order to re-build this HTA to 32bit for use on Atom and other 32-bit CPUs. Changes made:- recompile all custom apps to ANSI instead of x64.- replace the Gimagex_com.dll with the 32bit version.- replace the SetRes exe instead of the 64bit resolution changer.- Edit the Startnet.cmd with setres:wpeinitwpeutil initializenetworkping 127.0.0.1 -n 16 -w 1000 >nullnet use z: \\imagex\images Password1 /user:remotenet use v: \\imagex\unattend regsvr32 /s misc/GImageX_COM.dllx:\windows\system32\misc\setres.exe 1024 600 32 60mshta.exe x:\windows\system32\ImageX.hta- replace all extra DLLs and EXE (from Windows 7 install) to 32bit versions. I will be doing some testing with this version. The instructions should be the same as above, except make sure specify x86 instead of amd64 in the paths. Also not certain that the new background will work properly. I may have to change the colors in case the text does not appear properly.Server 2008 x64 (or any x64 OS) as the Technician PC will give a message using DISM to import packages. The following Hotfix needs to be applied. Unfortunately the one for 2008 x64 does not appear in the "Request" page so I am going to have to get my elsewhere.http://support.microsoft.com/kb/960037
greenfrognet Posted November 10, 2009 Posted November 10, 2009 Here is my customized version of the imagex.hta.I've been using it in house for awhile now.This version runs under winpe 3.0 (x86 so far, I'll try X64 tomorrow)The big changes I made to get it to run are. The command window.confirm doesn't seem to work for me in pe 3.0 so they got replaced.The xml for the wims are different, so I changed the way the program gets image names, the new way is much slower, but you can use it with new or old wims.This version only support writing out images, giving a command shell, reboot, or shutdown. I made this for system builders to deploy images only. If the Image description has the letters XP in it, the program will automatically put the nt52 bootsector on. Hope this helps other people.later,daboneHi Friend, Could you post your code again please or can you sendme by email.Thanks
Tripredacus Posted November 10, 2009 Author Posted November 10, 2009 (edited) Hi Friend, Could you post your code again please or can you sendme by email.ThanksThe XML parser code change is here:http://www.msfn.org/board/index.php?s=&...st&p=889162The window.confirm code change examples are here: Edited April 22, 2013 by Tripredacus fixed link
cluberti Posted January 13, 2010 Posted January 13, 2010 Been messing around a bit with 7.1, as 9.x is unstable as hell for my needs, and I decided to make a new pe.jpg to go in the pics folder to make it more Win7-like:You have to go into misc, edit htastyle.css, and add "color: #FFFAFA" in the #title section, otherwise the default black text for the title is too hard to read (it's the color code for "snow").
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