keythom

WinPE 2.0 simple Ghost Menu HTA

118 posts in this topic

First of all - Thanks for all the great info in this thread...

I have created a Booting USB flash drive with a nice little Boot Environement. I am currently setting this up for a Ghost environment, but will probably be switching over to an ImageX environment in the future. I can get this to boot and work on my Dell D610s, Optiplex 280s, etc with no issue. It will not work on my D600s. The whole thing loads, but I get a script error when it trys to populate the Image lists. It is because it doesn;t load the network drivers right. It should work with the B57win32.inf driver like the other Dells that work, but it doesn't. I have tried putting my own drivers into the PE Image, but it doesn't seem to work. The 610, and 280 are using what appears to be an existing B57 driver in the PE environment. I guess the 600 doesn't like it (I saw all this from looking at the PE Boot Log and seeing what drivers load). Here is what my build scriptslook like:

pushd "C:\Program Files\Windows AIK\Tools\PETools\"

if not exist "c:\winpe_x86" (

rem Prepare the build environment

call copype.cmd x86 "c:\winpe_x86"

rem Copy the Windows PE source files from the image to the build environment

md c:\winpe_x86\base

imagex /apply "C:\Program Files\Windows AIK\Tools\PETools\x86\winpe.wim" 1 c:\winpe_x86\base

rem Set TimeZone

peimg /timezone="Eastern Standard Time" c:\winpe_x86\base

rem Install optional components in to the image

peimg /install=WinPE-HTA-Package c:\winpe_x86\base

peimg /install=WinPE-Scripting-Package c:\winpe_x86\base

peimg /install=WinPE-XML-Package c:\winpe_x86\base

peimg /install=WinPE-WMI-Package c:\winpe_x86\base

rem Install Applications

xcopy /chery c:\Apps\imagex.exe "c:\winpe_x86\base\program files\imagex\imagex.exe"

xcopy /chery c:\Apps\ghost32.exe "c:\winpe_x86\base\program files\ghost\ghost32.exe"

rem Copy Custom startnet.cmd

xcopy /chery c:\CMDFiles\startnet.cmd "c:\winpe_x86\base\windows\system32\startnet.cmd"

rem Copy Custom Environment Files

xcopy /chery c:\Apps\WSCwizard.hta "c:\winpe_x86\base\WSCwizard.hta"

xcopy /chery c:\Apps\pe.jpg "c:\winpe_x86\base\pe.jpg"

xcopy /chery c:\Apps\htaStyle.css "c:\winpe_x86\base\htaStyle.css"

xcopy /chery c:\Apps\reboot.hta "c:\winpe_x86\base\reboot.hta"

rem Install device drivers in to the image

peimg /inf=c:\drivers\*.inf c:\winpe_x86\base\Windows

)

popd

Then I run another script to Prep and finish it up:

pushd "C:\Program Files\Windows AIK\Tools\PETools\"

rem Prepare the image for capture by optimizing it

peimg /prep c:\winpe_x86\base /f

rem Capture the image

"c:\Program Files\Windows AIK\Tools\x86\imagex.exe" /boot /compress max /capture c:\winpe_x86\base c:\winpe_x86\ISO\sources\boot.wim "WSC Windows PE"

popd

Any ideas? I know about Mounting and applying the Drivers, then Unmounting, but that didn't do anything for me either... I am using the Vista Resource Kit as reference here. Just out of things to try and could use some help.

Thanks,

Darren

0

Share this post


Link to post
Share on other sites

keythom,

please, can you post your htm file about this great tutorial

Thanks

Bumbastik

0

Share this post


Link to post
Share on other sites

Thanks for your sharing.

I have one Q about this.

While I preper the HTA it's look good on my computer but when it run on the Windows PE, it's not open in full screen of the win PE and I'm getting line breaking.

Any idea why ?

0

Share this post


Link to post
Share on other sites

Hi ,

change in hta code this parameters

from

WINDOWSTATE = normal

to

WINDOWSTATE = fullscreen

bye

0

Share this post


Link to post
Share on other sites

Thanks a lot.

I think this is also a resolution problem sine the button are very big.

What do you think ? any option to change, I don't understand why the button are bigger then the print screen in this post

0

Share this post


Link to post
Share on other sites

The person who started this thread recommended that we use PXE to install ImageX; how do you set up PXE? Does the computer have to be on a domain?

0

Share this post


Link to post
Share on other sites

PXE has to be on a DHCP server. You can use RIS or PXElinux. I use PXElinux you can find it information about it here.

0

Share this post


Link to post
Share on other sites

This is a neat tool! I inherited a GUI made using AutoIT tools, but the fact that this dynamically creates radio buttons is a much nicer solution.

I am having an issue though - When I click start to launch ghost, it just hangs. Anyone else have this issue? I have installed all scripting, WMI, XML and HTA components. It DOES run fine from a full WindowsXP system...

Z

0

Share this post


Link to post
Share on other sites

Issue resolved. When I upped the resolution to 1280x1024 the problem went away completely. Now, ghost starts right up and starts plugging away.

Z

0

Share this post


Link to post
Share on other sites

I love this tool, and am just about ready to roll it into production - many thanks!

I have one question:

When Ghost finishes, I have the -rb flag set, but it doesn't seem to work. The hta is still up, and I have to manually hit the Reboot button to get the system to reboot.

Any ideas on how I can actually get the system to reboot when Ghost is finished? I'm using Ghost8 in my environment as well.

Thanks,

Z

0

Share this post


Link to post
Share on other sites

Yeah the reboot functionality of ghost does not work within the PE environment, at least not 8.2 (which I use most often). However, it does work with 11.0. Anyway, what I do is launch ghost with the "-fx" switch which exits ghost after cloning has finished, and reboot via the "wpeutil reboot" command once ghost has completed.

I've written my own HTA for restoring ghost images from disk, but the meat of the code still applies. Just ignore all of the html stuff:

'*****************************************************************************************
'* restoreBuild
'* starts the ghost restoration process for the selected build and method
'*****************************************************************************************
Sub restoreBuild
Dim filename, taskCmd

strTemp = "<h2>Restoring build...</h2>"
general.InnerHTML = strTemp

filename = cdrom & "\" & buildFilename
If not objFso.FileExists(filename) Then
strTemp = "<h2>ERROR: File not found " & filename & "</h2><ul>Ensure that <u><b>DISK 1</b></u> is loaded in the CD-ROM drive and click the " &_
"<i>Retry</i> button."
document.buttonsForm.nextButton.value = "<u>R</u>etry"
document.buttonsForm.nextButton.disabled = false
document.buttonsForm.cancelButton.disabled = false
general.InnerHTML = strTemp
Else
taskCmd = "%comspec% /c ghostontop.exe"
objShell.Run taskCmd,0,false
Select Case curMethod
Case "Initial"
taskCmd = "%comspec% /c ghost32.exe -sure -fdsp -clone,mode=load,src=" & filename & ",dst=" & destinationDisk & ",szeL -fx > \ghost.log"
objShell.Run taskCmd,0,true
finishBuild
Case "Windows"
taskCmd = "%comspec% /c ghost32.exe -sure -fdsp -clone,mode=prestore,src=" & filename & ":1,dst=" & destinationDisk & ":1,sze1=V -fx > \ghost.log"
objShell.Run taskCmd,0,true
finishBuild
End Select
End If
End Sub

'*****************************************************************************************
'* finishBuild
'* handles errors that occur during ghost and handles successful restorations
'*****************************************************************************************
Sub finishBuild
Dim result, logFile, count

Set logFile = objFso.GetFile("\ghost.log")
If logFile.Size <> "0" Then
Set logFile = objFso.OpenTextFile("\ghost.log")
count = 1
Do While logFile.AtEndOfStream <> true
result = result & count & "> "
Do While logFile.AtEndOfLine <> true or logFile.AtEndOfStream <> true
result = result & logFile.Read(1)
Loop
result = result & "<BR>"
general.InnerHTML = result
count = count + 1
Loop
logFile.Close
strTemp = "<CENTER><H1>FAILED</H1><DIV style='color:red;text-align:left'>An attempt to restore the system failed with the " &_
"following error message:<BR><BR><DIV style='position:absolute;border-style:solid;border-color:black;left:5%;" &_
"width:95%;color:black;padding:5%;border-width:1;font-family:terminal;font-size:10pt;overflow:auto'>" & result &_
"</DIV></DIV></CENTER>"
warning.InnerHTML = strTemp
warning.style.top = "10%"
warning.style.left = "10%"
warning.style.width = "80%"
warning.style.height = "75%"
document.buttonsForm.cancelButton.value = "E<u>x</u>it"
document.buttonsForm.cancelButton.accesskey = "x"
document.buttonsForm.cancelButton.disabled = false
warning.style.visibility = "visible"
Else
strTemp = "<h2>Complete!</h2><ul><font color=orange>" & result & "</font>The restoration process has finished without any " &_
"errors."
document.buttonsForm.cancelButton.value = "E<u>x</u>it"
document.buttonsForm.cancelButton.accesskey = "x"
document.buttonsForm.cancelButton.disabled = false
general.InnerHTML = strTemp
warning.style.visibility = "visible"
If needHAL = "yes" Then
handleHAL
Else
rebootMe
End If
End If
End Sub

'*****************************************************************************************
'* handleHAL
'* prepares the system for use with the correct HAL
'*****************************************************************************************
Sub handleHAL
Dim strDest, inFile, outFile, line, words, lword

strTemp = "<CENTER><H1>Updating HAL...</H1></CENTER>"
warning.InnerHTML = strTemp
objShell.Run "%comspec% /c diskpart /s X:\Windows\system32\probeParts.txt",0,true

Select Case strHAL
Case "acpiapic"
'Remove UpdateUPHal line from sysprep.inf
strDest = "C:\sysprep\sysprep.inf"
If objFso.FileExists(strDest) Then
Set inFile = objFso.OpenTextFile(strDest,1,true)
Set outFile = objFso.CreateTextFile(strDest & ".tmp",true)

'Loop through sysprep.inf file
Do While inFile.AtEndOfStream <> true
line = inFile.ReadLine
If line <> "" Then
words = split(line,"=")
lword = trim(words(0))
outFile.WriteLine(line)
If Lcase(lword) = "[unattended]" Then
If numProcs = 1 Then
outFile.WriteLine("UpdateUPHAL=ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf")
Else
outFile.WriteLine("UpdateHAL=ACPIAPIC_MP,%WINDIR%\Inf\Hal.inf")
End If
End If
Else
outFile.WriteBlankLines(1)
End If
Loop
inFile.Close
outFile.Close
objFso.DeleteFile strDest,true
objFso.MoveFile strDest & ".tmp", strDest
Else
strTemp = "<CENTER><H1>FAILED</H1><DIV style='color:red;text-align:left'>An attempt to update your system HAL has " &_
"failed due to an inaccessible system drive.</DIV></CENTER>"
warning.InnerHTML = strTemp
warning.style.top = "10%"
warning.style.left = "10%"
warning.style.width = "80%"
warning.style.height = "75%"
document.buttonsForm.cancelButton.value = "E<u>x</u>it"
document.buttonsForm.cancelButton.accesskey = "x"
document.buttonsForm.cancelButton.disabled = false
End If
rebootMe
Case Else
rebootMe
End Select
End Sub

'*****************************************************************************************
'* rebootMe
'* opens the CD tray, delays 8 seconds and reboots
'*****************************************************************************************
Sub rebootMe
'Open CD tray
strTemp = "<center><h1>Ejecting Media...</h1></center>"
warning.InnerHTML = strTemp
cdrom = cdrom & "\"
CreateObject("Shell.Application").Namespace(17).ParseName(cdrom).InvokeVerb("Eject")

'Give delay to allow disk to eject
objShell.Run "%comspec% /c cscript X:\Windows\system32\timer.vbs",0,true

'Reboot the system
strTemp = "<center><h1>Rebooting System...</h1></center>"
warning.InnerHTML = strTemp
objShell.Run "%comspec% /c wpeutil reboot",0,false
End Sub

Edited by zorphnog
0

Share this post


Link to post
Share on other sites

Thanks - this was something simple that I just haven't seen yet - wpeutil reboot.

I really need to learn to RTM.

Cheers,

Z

0

Share this post


Link to post
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.