Help - Search - Members - Calendar
Full Version: WinPE 2.0 simple Ghost Menu HTA
MSFN Forums > Unattended Windows Discussion & Support > Windows PE
Pages: 1, 2

   
Google Internet Forums Unattended CD/DVD Guide
zorphnog
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
bigjon440
Are there any plans to include an updated version of this just for ImageX? smile.gif
zorphnog
There already is one for imagex. Not exactly like this one, but an HTA that has similar features. http://www.msfn.org/board/WinPE-20-GimageX-COM-based-HTA-t97512.html
KenKightly
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.
KenKightly
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.
bigjon440
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 smile.gif
KenKightly
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.
lucas*z
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.
Stratuscaster
QUOTE (KenKightly @ Nov 21 2007, 03: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.

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.
KenKightly
QUOTE (Stratuscaster @ Nov 26 2007, 08:26 AM) *
QUOTE (KenKightly @ Nov 21 2007, 03: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.

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.
vickerps
QUOTE (Bumbastik @ Jun 28 2007, 12:59 PM) *
Hi ,

change in hta code this parameters

from

WINDOWSTATE = normal


to
WINDOWSTATE = fullscreen


bye



Hi

First of all well done with this exactly what i have been looking for.

I am trying to get this to run in full screen without any joy. I have edited the wizard.hta and set it to Fullscreen but this dosn't do anything?

Update

Sorted it you need to set it to WINDOWSTATE=maximize
vickerps
Hi having problems point to the path of my ghost32.exe

I have a mapped drive f:\ which contain ghost32.exe

I edited the line

<Button id=ghost onclick=doTask('&quot;%programfiles%\ghost8\ghost32.exe&quot;')>Ghost</BUTTON> &nbsp;&nbsp;&nbsp;&nbsp;


to

<Button id=ghost onclick=doTask('"f:\ghost32.exe"')>Ghost</BUTTON> &nbsp;&nbsp;&nbsp;&nbsp;


This doesn't work. I am new to this kind of coding can anyone help please
vickerps
Ok I have another Q.

I would like to change the Buttons being generated by the folder name (HP, DELL, ETC)to be a dropdown list box.

the reason for this is that i have a lot of folders which makes way to many buttons.

Anyone help me with this as i am only just learning the HTM coding
Stratuscaster
QUOTE (vickerps @ Dec 5 2007, 12:12 PM) *
Hi having problems point to the path of my ghost32.exe

I have a mapped drive f:\ which contain ghost32.exe

I edited the line

<Button id=ghost onclick=doTask('&quot;%programfiles%\ghost8\ghost32.exe&quot;')>Ghost</BUTTON> &nbsp;&nbsp;&nbsp;&nbsp;


to

<Button id=ghost onclick=doTask('"f:\ghost32.exe"')>Ghost</BUTTON> &nbsp;&nbsp;&nbsp;&nbsp;


This doesn't work. I am new to this kind of coding can anyone help please

This drove me bonkers for quite some time.

I created a variable called "ghoCmd"
CODE
ghocmd = "%comspec% /c t:\11\ghost32.exe"


Then I created a new subroutine:
CODE
'****************************************************************************
'* doGhost
'****************************************************************************
Sub doGhost(doMe)
  objShell.Run ghoCmd
End Sub


And then I set my button to this:
CODE
<Button class='tool' id=ghost   onclick=doGhost('')>Ghost 11</BUTTON> &nbsp;


Might be overkill - but it works.
Stratuscaster
QUOTE (vickerps @ Dec 7 2007, 07:26 AM) *
Ok I have another Q.

I would like to change the Buttons being generated by the folder name (HP, DELL, ETC)to be a dropdown list box.

the reason for this is that i have a lot of folders which makes way to many buttons.

Anyone help me with this as i am only just learning the HTM coding

As an alternative, a co-worker wound up creating 26 copies of the HTA and modifying them to only pull items matching the first letter.

So there's a small HTA that shows the A-Z buttons, then each button launches it's own HTA for that 'letter.'

Not elegant, but again - it works.
Stratuscaster
QUOTE (KenKightly @ Nov 26 2007, 03:51 PM) *
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.


I set a variable:
CODE
walker = "%comspec% /c t:\11\GhWalk32.exe"


I create a new subroutine:
CODE
'****************************************************************************
'* doGhostWalker
'****************************************************************************
Sub doWalker(doMe)
  objShell.Run walker
End Sub


And my button is:
CODE
<Button class='tool' id=notepad onclick=doWalker('')>GhostWalker</BUTTON>&nbsp;
vickerps
Hi Guy Done it

Change the buttons to a combo box. Open the wizard.hta and cut this in place of the one already there. (i have tried to upload this as well)

CODE
Sub enumDirs
Dim colSubfolders, objFolder, fileName
'enumerate folders in images folder
  Set colSubfolders = objWMIService.ExecQuery _
    ("Associators of {Win32_Directory.Name='z:\'} Where AssocClass = Win32_Subdirectory ResultRole = PartComponent")

'create html buttons from each folder name

strBody = strBody &_
"<select size='1' name='DropDown1'"

  For Each objFolder in colSubfolders
    fileName = objFolder.fileName

  strBody = strBody &_
"onchange='enumImages(DropDown1.value)'><option value = '"&Filename&"'>"&Filename&"</option>"

  Next
'post resulting html body to document
  strBody        = strBody & "</select size><BR><BR><HR><BR>"
  body.innerHTML = strBody
End Sub
geemail.email
All,

First of all, thank you for this post, it has been very useful in my creation of the boot CD.

I am wondering if anyone can assist me with my next task. My WinPE 2.0 boot cd has all of the packages installed(WMI, HTA, WMI, Scripting). I am using a modified version of the wizard.hta and would like to accomplish something similar to Tombtek99's posting.

I would like to:
1. Boot with the WinPE CD
2. Detect the workstation IP address or DHCP server IP address.
3. Based on the workstation IP address or DHCP server IP address, map a network drive by reading in a text file stored on the boot cd.
4. Use the mapped network drive to execute the HTA to run ghost, etc.

Again, thank you for the previous discussions and for any assistance you can provide.

This forum rocks!!!
Stratuscaster
You can create a VBS script launched from your startnet.bat to read the IP address (among other things) and store it into a variable. We use a sysinfo.cmd file to launch the sysinfo.vbs file, which in turn grabs the info and pipes it to a setenv.cmd file and runs it - both files are in x:\windows\system32.

You can use an IF statement in your startnet.cmd to compare that IP variable and act accordingly (launch a file, run a script, map a drive, etc.)

CODE
REM *** sysinfo.cmd ***
cscript.exe //nologo x:\windows\system32\sysinfo.vbs >x:\windows\system32\setenv.cmd
x:\windows\system32\setenv.cmd

CODE
REM *** sysinfo.vbs ***
dim count,t,ipchar,ip,lab,cnt
REM *** Get IP Address and Filter Link local IPv6 ***
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", &h10 + &h20)

For Each objItem In colItems
    strIPAddress = Join(objItem.IPAddress, ",")
Next
count=1
do while(ipchar<>",")
ipchar=mid(strIPAddress,count,1)
count=count+1
if ipchar<>"," then ip=ip & ipchar
Loop
WScript.Echo "SET IP=" & ip

REM *** Determine which lab menu to load ***
REM *** LAB1 = 10.10.16.x - 10.10.31.x  LAB2 = 10.10.32.x - 10.10.47.x
count=1
cnt=0
ipchar=""
lab=""
do while(ipchar<>",")
ipchar=mid(strIPAddress,count,1)
if ipchar="." then cnt=cnt+1
count=count+1
if cnt=2 and ipchar<>"." then lab=lab & ipchar
loop
if lab<32 then Wscript.Echo "SET LAB=" & "LAB1" else WScript.Echo "SET LAB=" & "LAB2"


CODE
REM *** code placed in startnet.cmd ***

set LAB=UNKNOWN
call x:\windows\system32\sysinfo.cmd
GOTO %LAB%

:LAB1
REM *** launch the HTA and pass the IP variable to be displayed on screen ***
mshta.exe "i:\wizards\lab1.hta" "%IP%"
goto END

:LAB2
REM *** launch the HTA and pass the IP variable to be displayed on screen ***
mshta.exe "i:\wizards\lab2.hta" "%IP%"
goto END

:UNKNOWN
x:\Programs\nu2menu\nu2menu.exe

:END


We just completed a setup that does this very thing. If the third octet of the IP is <32, it launches the hta for one lab, and if it's >=32, it launches the hta for another lab. If it's neither, or an error occurs, a 'default' nu2menu is loaded.

Our setup is fairly deep and uses PXE rather than off the CD, but the basic steps should still apply. Hope this helps.
weedy171
Can someone tell me why for the Image name is blank. The radio button show and all other text shows. Just not the text for the radio button image name.

Thanks

Stratuscaster
QUOTE (weedy171 @ Mar 17 2008, 08:02 AM) *
Can someone tell me why for the Image name is blank. The radio button show and all other text shows. Just not the text for the radio button image name.

Thanks

Did you add anything to the COMMENT field in the PROPERTIES of the shortcut that you created?
weedy171
This is what my code looks like....
'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
weedy171
This is what my code looks like for the radio button section.

'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
zorphnog
This has nothing to do with the HTA code. As @Stratuscaster pointed out, how did you create your shortcuts for your images? Did you add anything to the COMMENTS sections because this is where the text for the radio button is pulled.
weedy171
I thought he was talking about comments in the code. Sorry about that. Yes I did not have any comments in the shortcuts. Thanks a lot for your help and a KUDOS on this cool program.
weedy171
Is their a way to reboot the PE Enviroment after I ghost a computer. I have the RB switch in ghost but I think it restarts the ghost windows and not PE.

strTaskValue = Chr(34) & "%programfiles%\Ghost8\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1,SZEF -fni -auto -sure -ntil -RB"
Stratuscaster
QUOTE (weedy171 @ Mar 17 2008, 12:21 PM) *
Is their a way to reboot the PE Enviroment after I ghost a computer. I have the RB switch in ghost but I think it restarts the ghost windows and not PE.

strTaskValue = Chr(34) & "%programfiles%\Ghost8\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1,SZEF -fni -auto -sure -ntil -RB"


I have in my HTA app that launches Ghost a button that does this:
CODE
wpeutil reboot
weedy171
QUOTE (Stratuscaster @ Mar 19 2008, 10:05 AM) *
QUOTE (weedy171 @ Mar 17 2008, 12:21 PM) *
Is their a way to reboot the PE Enviroment after I ghost a computer. I have the RB switch in ghost but I think it restarts the ghost windows and not PE.

strTaskValue = Chr(34) & "%programfiles%\Ghost8\ghost32.exe" & Chr(34) & " -clone,mode=load,src=" & Chr(34) & Radio.Id & ".gho" & Chr(34) & ",dst=1,SZEF -fni -auto -sure -ntil -RB"


I have in my HTA app that launches Ghost a button that does this:
CODE
wpeutil reboot



I was looking at the aspect as soon as ghost was done it reboot the computer and start working on the building the image.

ArmBoy
you can enhance your hta application by using www.vbs2exe.com it lets you package your hta into a single exe as well as calling win32 API

Regards newwink.gif
sinecure
Thanks for a great tool, still getting a few errors but I'm sure I'll hash them out in a day or so.
sinecure
I'm still getting "clone DST unknown" in ghost.
----

Update:
Fixed the DST error by changing the default location....

The last error I get is a:
AutoIT Error
Line -1:
Error: Unable to execute the external program.
The system cannot find the file specified.
naclejoh
I am having an issue with listing the available images in my directories. It creates buttons for the folders in the path specified, but when I click on one, I recieve the following run time error:

error could not complete the operation due to error 80041002

if I debug it, this is the line in question:

For each objFile in colFileList


Thanks for any info.
rgaspar
Hello,

I need help, please.
I run this script wizard.hta but radio button and description file htm not display.

Here's my code.

'****************************************************************************
'* 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

rgaspar
Hello,

This script in HTA not show radio button sad.gif

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

I create one simply script in vbs, name is testpath.vbs and resume object objtarget.drive, objtarget.path and objtarget.filename not run correctly.
Cant i help me for this issue?

testpath.vbs

strcomputer="."
dim objshell, objfso, objwmiservice, strDrive

set objshell = createobject("wscript.shell")
set objfso = createobject("scripting.filesystemobject")
set objwmiservice = getobject ("winmgmts:\\" & strcomputer & "\root\cimv2")

dim colsubfolders, objfolder, filename

set colsubfolders = objwmiservice.execquery _
("Associators of {win32_directory.name='z:\winpe'} where assocclass = win32_subdirectory resultrole = partcomponent")


for each objfolder in colsubfolders

filename = objfolder.filename
wscript.echo objfolder.name
next

for each objfolder in colsubfolders

filename = objfolder.filename
wscript.echo filename
next

dim colfilelist, objfile, objshorcut, coltargetlist, objtarget

set colfilelist = objwmiservice.execquery _
("Associators of {win32_directory.name='z:\winpe\" & filename & "'} where resultclass = CIM_DataFile")

for each objfile in colfilelist

if objfile.extension = "lnk" then
set objshortcut = objshell.createshortcut(objfile.name)
set coltargetlist = objwmiservice.execquery _
("select * from CIM_DataFile where name = '" & replace(objshortcut.targetpath,"\","\\") & "'")

wscript.echo objfile.name
wscript.echo objshortcut.description

for each objtarget in coltargetlist

wscript.echo objtarget.drive
wscript.echo objtarget.path
wscript.echo objtarget.filename

next

end if
next

My hta not show radio buttons sad.gif

Thanks for help me....

rgaspar
Ok, nevermind
I found this solutions.

All shortcut's and path's have the same letter drive.

Thanks


QUOTE (rgaspar @ Jul 28 2008, 10:03 PM) *
Hello,

This script in HTA not show radio button sad.gif

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

I create one simply script in vbs, name is testpath.vbs and resume object objtarget.drive, objtarget.path and objtarget.filename not run correctly.
Cant i help me for this issue?

testpath.vbs

strcomputer="."
dim objshell, objfso, objwmiservice, strDrive

set objshell = createobject("wscript.shell")
set objfso = createobject("scripting.filesystemobject")
set objwmiservice = getobject ("winmgmts:\\" & strcomputer & "\root\cimv2")

dim colsubfolders, objfolder, filename

set colsubfolders = objwmiservice.execquery _
("Associators of {win32_directory.name='z:\winpe'} where assocclass = win32_subdirectory resultrole = partcomponent")


for each objfolder in colsubfolders

filename = objfolder.filename
wscript.echo objfolder.name
next

for each objfolder in colsubfolders

filename = objfolder.filename
wscript.echo filename
next

dim colfilelist, objfile, objshorcut, coltargetlist, objtarget

set colfilelist = objwmiservice.execquery _
("Associators of {win32_directory.name='z:\winpe\" & filename & "'} where resultclass = CIM_DataFile")

for each objfile in colfilelist

if objfile.extension = "lnk" then
set objshortcut = objshell.createshortcut(objfile.name)
set coltargetlist = objwmiservice.execquery _
("select * from CIM_DataFile where name = '" & replace(objshortcut.targetpath,"\","\\") & "'")

wscript.echo objfile.name
wscript.echo objshortcut.description

for each objtarget in coltargetlist

wscript.echo objtarget.drive
wscript.echo objtarget.path
wscript.echo objtarget.filename

next

end if
next

My hta not show radio buttons sad.gif

Thanks for help me....

jalexander319
Awesome utility! I am so glad you shared this!!!

Update: After playing with this I realize I need to be able to use different ghost switches for different images. It appears that the way it is currently coded, all images will use the same switches.

Is there an easy way to change that or has anyone already added that functionality?

Thanks...
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.