![]() ![]() |
Oct 24 2007, 01:30 PM Post
#41 | |
| Newbie Group: Members Posts: 31 Joined: 5-April 07 Member No.: 134295 |
Let's try this again: CODE 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. |
| | |
Oct 24 2007, 02:24 PM Post
#42 | |
| Advanced Member ![]() ![]() ![]() Group: Members Posts: 427 Joined: 25-July 06 From: Charleston, SC Member No.: 105938 |
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: Oct 24 2007, 02:25 PM |
| | |
Oct 24 2007, 02:29 PM Post
#43 | |
| Newbie Group: Members Posts: 31 Joined: 5-April 07 Member No.: 134295 |
It's the original wizard.hta script, with my ghost32.exe locations... CODE <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: CODE '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" |
| | |
Oct 26 2007, 04:59 AM Post
#44 | |
| Group: Members Posts: 1 Joined: 5-December 06 Member No.: 117657 |
Many Thanks for sharing keythom, I'm just getting into HTAs and yours is very cool!
|
| | |
Nov 6 2007, 03:04 PM Post
#45 | |
| Group: Members Posts: 6 Joined: 16-August 07 Member No.: 151012 OS: Vista Ultimate x86 |
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 |
| | |
Nov 6 2007, 03:07 PM Post
#46 | |
| Advanced Member ![]() ![]() ![]() Group: Members Posts: 427 Joined: 25-July 06 From: Charleston, SC Member No.: 105938 |
Do the recovery files have different extensions? Use the file extension to determine what application needs to be executed.
|
| | |
Nov 7 2007, 02:51 PM Post
#47 | |
| Group: Members Posts: 6 Joined: 16-August 07 Member No.: 151012 OS: Vista Ultimate x86 |
yes, i forgot to add that. one has img extension used by imgit by briwave in china and the other is pqi - powerquest
|
| | |
Nov 13 2007, 02:54 PM Post
#48 | |
| Newbie Group: Members Posts: 31 Joined: 5-April 07 Member No.: 134295 |
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. |
| | |
Nov 14 2007, 06:52 AM Post
#49 | |
| Group: Members Posts: 3 Joined: 8-November 07 Member No.: 161598 OS: none |
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! |
| | |
Nov 14 2007, 02:03 PM Post
#50 | |
| Group: Members Posts: 2 Joined: 15-October 07 Member No.: 158393 OS: XP Pro x86 |
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=- |
| | |
Nov 14 2007, 03:17 PM Post
#51 | |
| Advanced Member ![]() ![]() ![]() Group: Members Posts: 427 Joined: 25-July 06 From: Charleston, SC Member No.: 105938 |
Add a color value to the H1 attribute in the htaStyle.css file: CODE h1 { font-family: Albertus Extra Bold; font-size: 30; color: #FFFFFF; } Hex color codes |
| | |
Nov 15 2007, 03:21 PM Post
#52 | |
| Group: Members Posts: 3 Joined: 15-November 07 Member No.: 162633 OS: none |
Are there any plans to include an updated version of this just for ImageX? |
| | |
Nov 16 2007, 07:53 AM Post
#53 | |
| Advanced Member ![]() ![]() ![]() Group: Members Posts: 427 Joined: 25-July 06 From: Charleston, SC Member No.: 105938 |
There already is one for imagex. Not exactly like this one, but an HTA that has similar features. http://www.msfn.org/board/index.php?showtopic=97512 |
| | |
Nov 16 2007, 10:45 PM Post
#54 | |
| Newbie Group: Ultimate Sponsors Posts: 15 Joined: 2-November 07 Member No.: 160855 OS: Windows 7 x86 |
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: Nov 16 2007, 11:35 PM |
| | |
Nov 17 2007, 12:12 AM Post
#55 | |
| Newbie Group: Ultimate Sponsors Posts: 15 Joined: 2-November 07 Member No.: 160855 OS: Windows 7 x86 |
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. |
| | |
Nov 19 2007, 12:35 PM Post
#56 | |
| Group: Members Posts: 3 Joined: 15-November 07 Member No.: 162633 OS: none |
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 |
| | |
Nov 21 2007, 02:41 AM Post
#57 | |
| Newbie Group: Ultimate Sponsors Posts: 15 Joined: 2-November 07 Member No.: 160855 OS: Windows 7 x86 |
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. |
| | |
Nov 26 2007, 03:12 AM Post
#58 | |
| Newbie Group: Members Posts: 20 Joined: 22-November 07 Member No.: 163534 OS: XP Pro x86 |
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. |
| | |
Nov 26 2007, 09:26 AM Post
#59 | |
| Newbie Group: Members Posts: 31 Joined: 5-April 07 Member No.: 134295 | 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. |
| | |
Nov 26 2007, 02:51 PM Post
#60 | |
| Newbie Group: Ultimate Sponsors Posts: 15 Joined: 2-November 07 Member No.: 160855 OS: Windows 7 x86 | 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. |
| | |
![]() ![]() |
| Lo-Fi Version | Time is now: 21st November 2009 - 10:36 PM |