MSFN Forum: WinPE 2.0 simple Ghost Menu HTA - MSFN Forum

Jump to content


  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

WinPE 2.0 simple Ghost Menu HTA a simple HTA to make Ghosting easy Rate Topic: -----

#41 User is offline   Stratuscaster 

  • Newbie
  • Group: Members
  • Posts: 31
  • Joined: 05-April 07

Posted 24 October 2007 - 01:30 PM

Let's try this again:
t:\Programs\ghost11\files\ghost32.exe  -clone,mode=load,src=k:\images\sample.gho,dst=1


The above string, when passed to be run by the click of a button, does not work.


#42 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 24 October 2007 - 02:24 PM

Ok, I'm at a loss. Can you post the code as you are using it in your HTA? It would give me a better idea of the context in which you are trying to run the command.

This post has been edited by zorphnog: 24 October 2007 - 02:25 PM


#43 User is offline   Stratuscaster 

  • Newbie
  • Group: Members
  • Posts: 31
  • Joined: 05-April 07

Posted 24 October 2007 - 02:29 PM

It's the original wizard.hta script, with my ghost32.exe locations...
<html>
<!--
'********************************************************************
'*
'* File: wizard.hta
'* Author: greg & fisher
'* Created: Mar 2007
'* Modified:
'* Version: .9
'*
'* Description: windows imaging platform
'*
'* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,
'* XML, HTA packages
'* Notes: Line 26 - might want to make this "normal" when you are
'* testing and don't want the hta fullscreen
'* Line 58 - customize your headings here
'* Line 72, 101 - confirm directory.name path, this would be a mapped
'* drive to the filer where the images shorcut dir is
'* Line 193 - confirm background image source location
'* Line 200 - confirm path to ghost executable
'*
'********************************************************************
-->

<!****************************************************************************>
<!* HTA Header >
<!****************************************************************************>
<HEAD>
<TITLE>Imaging Application</TITLE>
<HTA:APPLICATION
BORDER = None
APPLICATION = Yes
WINDOWSTATE = normal
INNERBORDER = No
SHOWINTASKBAR = Yes
SCROLL = No
APPLICATIONNAME = "Windows PE Wizard"
NAVIGABLE = Yes
>
<!-- external stylesheet -->
<link rel="stylesheet" type="text/css" href="htaStyle.css" />
</HEAD>

<!****************************************************************************>
<!* Begin Script >
<!****************************************************************************>
<script Language=VBScript>

'****************************************************************************
'* Globals
'* setup global script parameters
'****************************************************************************
Option Explicit
Dim strTaskValue, objShell, objFso, strBody, objWmiService
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")

'****************************************************************************
'* Window_OnLoad
'* load up behavior and preferences
'****************************************************************************
Sub Window_Onload
self.Focus()
strBody = "<H1>PE Build and Recovery Environment</H1>" &_
"<H2>Select Images to apply an OS image using Ghost.<BR><BR>" &_
"Please select an image category:<BR><BR>"
enumDirs
End Sub

'****************************************************************************
'* enumDirs
'* find directories and create category buttons
'****************************************************************************
Sub enumDirs
Dim colSubfolders, objFolder, fileName
'enumerate folders in images folder
Set colSubfolders = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='z:\winpe'} Where AssocClass = Win32_Subdirectory ResultRole = PartComponent")
'create html buttons from each folder name
For Each objFolder in colSubfolders
fileName = objFolder.fileName
strBody = strBody &_
"<button id='" & fileName & "' onClick='enumImages("" & fileName & "")'>" & fileName & "</BUTTON>"
Next
'post resulting html body to document
strBody = strBody & "<BR><HR><BR>"
body.innerHTML = strBody
End Sub

'****************************************************************************
'* enumImages
'* find images and create radio buttons
'****************************************************************************
'this sub is a little messy because of limitations of win32_shortcutfile and need to go between fso and wmi for different info
'also, without the advantages of .net sorting classes, the old bubble sorting is not the funnest

Sub enumImages(fileName)
Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem
ReDim arrButtons(1,-1)

'reset display element style
details.innerHTML = ""
details.style.visibility = "hidden"
' strButtons = "<table id=buttonTable>"
'enumerate ghost image shortcuts in specific images subfolder from enumDirs
Set colFileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='z:\winpe\" & fileName & "'} Where ResultClass = CIM_DataFile")
'find ghost image shortcut targetpath (fso)
For each objFile in colFileList
If objFile.Extension = "lnk" Then
Set objShortcut = objShell.CreateShortcut(objFile.name)
'find ghost image shortcut target (wmi)
Set colTargetList = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where name = '" & replace(objShortcut.targetpath,"\","\\") & "'")
'add radio button label (from fso) and radio button target (from wmi) to an array
For each objTarget in colTargetList
ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)
arrButtons(0,UBound(arrButtons,2)) = objShortcut.Description
arrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & objTarget.Drive & objTarget.Path &

objTarget.fileName &_
"' onClick=showRadioInfo>" & objShortcut.Description & "</BUTTON><BR>"
Next
End If
Next
'perform a a shell sort of the string array based on button label
For x = 0 To UBound(arrButtons,2) - 1
For y = x To UBound(arrButtons,2)
If StrComp(arrButtons(0,x),arrButtons(0,y),vbTextCompare) > 0 Then
strKey = arrButtons(0,x)
strItem = arrButtons(1,x)
arrButtons(0,x) = arrButtons(0,y)
arrButtons(1,x) = arrButtons(1,y)
arrButtons(0,y) = strKey
arrButtons(1,y) = strItem
End If
Next
Next
'create combined buttons html code from sorted buttons array
For x = 0 To UBound(arrButtons,2)
strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"
Next
' strButtons = strButtons & "</table>"
'create a start button with start image command and append and post resulting html to body
body.innerHTML = strBody & strButtons & "<BR><HR><BR><button id=start Accesskey=S onclick=doTask(strTaskValue)><U>S</U>tart

Image!</BUTTON><BR>"
start.style.visibility="hidden"
End Sub

'****************************************************************************
'* doTask
'* run task selected by radio button
'****************************************************************************
Sub doTask(doMe)
objShell.Run doMe
End Sub

'****************************************************************************
'* showRadioInfo
'* display details of radio button selection in details divider
'****************************************************************************
Sub showRadioInfo
Dim objTextFile, Radio, strRadioValue, strDetails
'set details and start element styles
details.style.visibility = "visible"
start.style.visibility = "visible"
'find checked button
For Each Radio in Document.getElementsByName("radioList")
If Radio.Checked = True Then
'create imaging command line from button id
strTaskValue = Chr(34) & "t:\Programs\ghost11\files\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) &

Radio.Id & ".gho" & Chr(34) & ",dst=1"
'display image details in details element if they exist
If objFso.FileExists(Radio.Id & ".htm") Then
Set objTextFile = objFso.OpenTextFile(Radio.Id & ".htm", 1)
strDetails = objTextFile.ReadAll()
Else
'display error message in details element if no matching details file found
strDetails = "Can't find anything!!!<BR><BR>" &_
"Make sure the info file has the same name as the .gho and has an .htm extension."
End If
End If
Next
'post resulting html to details element
Details.innerHTML = strDetails
End Sub

'****************************************************************************
'* Reset
'* reset the tool interface, also reloads the code (helpful for programming)
'****************************************************************************
Sub Reset
Location.Reload(True)
End Sub

</Script>
<!****************************************************************************>
<!* End Script / Begin HTML >
<!****************************************************************************>

<BODY>
<DIV id=bg>
<img src=winpe.bmp>
</DIV>

<DIV id=body></DIV>
<DIV id=details></DIV>

<DIV id=tools>
<Button id=ghost onclick=doTask('"t:\Programs\ghost11\files\ghost32.exe"')>Ghost</BUTTON>
<Button id=cmd onclick=doTask('%comspec%')> Cmd </BUTTON>
<Button id=notepad onclick=doTask('notepad')> Notepad </BUTTON>
<Button id=taskmgr onclick=doTask('taskmgr')> Taskmgr </BUTTON>
<Button id=close onclick=self.close()> Quit </BUTTON>
<Button id=reset onclick=reset> ResetApp </BUTTON>
<Button id=reboot onclick=self.navigate('reboot.hta')> Reboot </BUTTON>
</DIV>
</BODY>
</HTML>

<!****************************************************************************>
<!* End HTML >
<!****************************************************************************>



This is the snippet that creates the string that should get launched by the button:
'find checked button
For Each Radio in Document.getElementsByName("radioList")
If Radio.Checked = True Then
'create imaging command line from button id
strTaskValue = Chr(34) & "t:\Programs\ghost11\files\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1"


#44 User is offline   Tyrell 

  • Group: Members
  • Posts: 1
  • Joined: 05-December 06

Posted 26 October 2007 - 04:59 AM

Many Thanks for sharing keythom, I'm just getting into HTAs and yours is very cool!

#45 User is offline   MichaelG 

  • Group: Members
  • Posts: 6
  • Joined: 16-August 07

Posted 06 November 2007 - 03:04 PM

i love this hta menu. i use it on my software imaging recovery program but i need help on it. i used a 2 different recovery program, how can i used the button to distinguish which program to used to reload the image. for example
image a, image b, image c use a recovery software
image d, image e, image f uses another recovery software


i want to use this menu to keep it simple for my techs.


any ideas or sugesstion or how to code properly.

remind you that i am total noobie at this. i have general idea how it works but not to code it ... any ideas would appreciated


thanks

#46 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 06 November 2007 - 03:07 PM

Do the recovery files have different extensions? Use the file extension to determine what application needs to be executed.

#47 User is offline   MichaelG 

  • Group: Members
  • Posts: 6
  • Joined: 16-August 07

Posted 07 November 2007 - 02:51 PM

yes, i forgot to add that. one has img extension used by imgit by briwave in china and the other is pqi - powerquest

#48 User is offline   Stratuscaster 

  • Newbie
  • Group: Members
  • Posts: 31
  • Joined: 05-April 07

Posted 13 November 2007 - 02:54 PM

Thanks to those that attempted to help with my issues.

Went back into the HTA and through trial and error located the problems - lots of confusion between " and Chr(34) and ' placement that just kept breaking things.

As of right now, it appears to be working correctly. I changed the layout a bit - put the list of images on the right side where the HTML details were, because in our setup we have lots of clients with lots of images and I needed the room.

On the HTML "details" side of things, I have a small section above the "tools" buttons to show those details - we only use a line or two (if we use them at all) - so that works out fine for us.

Someone here at work asked for a keyboard shortcut for each 'client' button - as nice as that would be, I think we could run out of letters and numbers before we ran out of client buttons.

The only other issue I have - and it's no fault of the script - is when the actual GHO image file name or the directory name contains 'odd' characters in them - like parentheses and apostrophes. That's more a training issue here - get folks to keep the images directories simple and put the notes and things in the HTML details file instead.

Kudos again for a fine piece of work. :D

#49 User is offline   someoneingbg 

  • Group: Members
  • Posts: 3
  • Joined: 08-November 07

Posted 14 November 2007 - 06:52 AM

Hello
I have problems to get WMI to work with UBCD4Win PE Builder 3.1.10a.

Need help to get WMI Support to work, any suggestions?

THX in advance!

#50 User is offline   EricWoodland 

  • Group: Members
  • Posts: 2
  • Joined: 15-October 07

Posted 14 November 2007 - 02:03 PM

What is the quickest way to change the Title text to another color than Black?
IE "Build and Recovery Center"

Also, how tough would it be to create a button which will kick-off a specific session, such as:
"X:\Program Files\Ghost\Ghost32.exe" -clone,mode=restore,src=@mcHP,dst=1,SZE1=20471M,SZEL -sure -RB

I'm trying to migrate my existing Ghost configuration into this GUI without changing a lot behind the scenes.

Thanks!

-=Woody=-

#51 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 14 November 2007 - 03:17 PM

Add a color value to the H1 attribute in the htaStyle.css file:

h1
{
   font-family:	Albertus Extra Bold;
   font-size:	  30;
   color:		   #FFFFFF;
}

Hex color codes

#52 User is offline   bigjon440 

  • Group: Members
  • Posts: 3
  • Joined: 15-November 07

Posted 15 November 2007 - 03:21 PM

Are there any plans to include an updated version of this just for ImageX? :)

#53 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 16 November 2007 - 07:53 AM

There already is one for imagex. Not exactly like this one, but an HTA that has similar features. http://www.msfn.org/...showtopic=97512

#54 User is offline   KenKightly 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 02-November 07

Posted 16 November 2007 - 10:45 PM

Please ignore this post, I cant seem to delete it.
I found my problem, I was missing the Scripting in my winpe. I had HTA and XML, but was missing Scripting.

Ken.


I am having a bit of trouble that I hope someone can help straighten out.

I have manage to load the wizard.hta with winpe, but when I do, all I see are the buttons and no text. Also the buttons do not function.

when I load this on my computer, everything works properly.

I have verified the correct directory paths. actually I just made my share z: to match the script.

I am using winpe 2.0 (Vista) I was wondering if there are any special permissions that need to be set somewhere. I am logging in to the share as administrator.

Thanks for any help you can provide.

Ken.

This post has been edited by KenKightly: 16 November 2007 - 11:35 PM


#55 User is offline   KenKightly 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 02-November 07

Posted 17 November 2007 - 12:12 AM

Ok, now I have a real question.

I need to create the links for the images with the share path, but that path doesnt exist on my server, so when I try to create a link with z:\dell\dell.gho for instance, it compains that it doesnt exist.

Do I need to create a share somewhere from my server, and map it as Z: to create these?

Any advice would be apreciated.

Thanks

Ken

BTW, this is an awsome script.

#56 User is offline   bigjon440 

  • Group: Members
  • Posts: 3
  • Joined: 15-November 07

Posted 19 November 2007 - 12:35 PM

I have been trying to get that one working for most of the morning, and without any luck. Myself and a few other individuals were having problems with a certain activex control. That's why I was wondering if there was going to be a version of this for ImageX :)

#57 User is offline   KenKightly 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 02-November 07

Posted 21 November 2007 - 02:41 AM

I was wondering if someone could give me a hand.

I am trying to modify this script to include running ghwalk32.exe /AV=All /sure after the imaging is complete.
I am a total noob to vbscript, so everything I have tried fails.

If someone can give me a little assistance, it would be greatly appreciated.

Thanks

Ken.

#58 User is offline   lucas*z 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 22-November 07

Posted 26 November 2007 - 03:12 AM

good article!
but i consider don't need many images like this, i only created one image to restore 98% computer(IBM WS AND DELL LAPTOP). spare 2% use unattended mode, because these 2% use image would be "blue screen".
HTA! Learning.....

Thanks for u sharing.

#59 User is offline   Stratuscaster 

  • Newbie
  • Group: Members
  • Posts: 31
  • Joined: 05-April 07

Posted 26 November 2007 - 09:26 AM

View PostKenKightly, on Nov 21 2007, 03:41 AM, said:

I was wondering if someone could give me a hand.

I am trying to modify this script to include running ghwalk32.exe /AV=All /sure after the imaging is complete.
I am a total noob to vbscript, so everything I have tried fails.

If someone can give me a little assistance, it would be greatly appreciated.

Thanks

Ken.

My initial guess (because I've not tried it) is to create a CMD script file that launches Ghost32 with the image info and switches and then runs GhWalk32 afterwards - but then that would happen on EVERY image (which might be what you want.)

I added a "tool" button at the bottom for running GhWalk32 manually.

#60 User is offline   KenKightly 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 02-November 07

Posted 26 November 2007 - 02:51 PM

View PostStratuscaster, on Nov 26 2007, 08:26 AM, said:

View PostKenKightly, on Nov 21 2007, 03:41 AM, said:

I was wondering if someone could give me a hand.

I am trying to modify this script to include running ghwalk32.exe /AV=All /sure after the imaging is complete.
I am a total noob to vbscript, so everything I have tried fails.

If someone can give me a little assistance, it would be greatly appreciated.

Thanks

Ken.

My initial guess (because I've not tried it) is to create a CMD script file that launches Ghost32 with the image info and switches and then runs GhWalk32 afterwards - but then that would happen on EVERY image (which might be what you want.)

I added a "tool" button at the bottom for running GhWalk32 manually.


The tool button would be fine with me, Could you share your syntax? I keep trying, but Im messing something up and cant get it to run.

Thanks

Ken.

Share this topic:


  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

5 User(s) are reading this topic
0 members, 5 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy