IPB

Google Frontpage Forums Unattended CD/DVD Guide
 Forum Rules Unattended CD/DVD Guide Homepage · MSFN Forum Rules
17 Pages V   1 2 3 > »   
Closed TopicStart new topic
> WinPE 2.0 GimageX COM based HTA
geezery
post May 6 2007, 04:06 AM
Post #1


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


Not available anymore

** update ** this software will soon be made available again. This thread is closed and to be used for reference only. Please use the new thread:
http://www.msfn.org/board/index.php?showtopic=133547

This post has been edited by Tripredacus: May 6 2009, 08:12 AM
Reason for edit: Added the **update**
Go to the top of the page
 
+Quote Post
obiwantuxedo
post May 7 2007, 06:57 PM
Post #2





Group: Members
Posts: 5
Joined: 17-February 04
Member No.: 14450



Thanks for the HTA. This is exactly what I started last week. Yours, however, is an improvement over what I had started. I have added the Ghost32 capability for my techs to use should an ImageX image not be available. I am looking for a section that also allows for capture/append so we can create the ones we don't have. Any suggestions? I have started one that works in a separate HTA file, but when I add it to yours, it fails, only prompting for the first parameter (Drive to capture) the other two, WIM file name and description never appear. I'll post code tomorrow, left it at work.

Also, your link to the sample files isn't working.

Thanks again!

This post has been edited by obiwantuxedo: May 7 2007, 06:58 PM
Go to the top of the page
 
+Quote Post
geezery
post May 8 2007, 12:09 AM
Post #3


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


Thanks for your reply.

I fixed the broken link.

I didn't want to add those Capture / Append buttons, because I wanted to keep the menu simple as possible. And if I want to capture new image I can always use CMD-Prompt.

The description field might be nice, but I didn't have any use for more information about Images.

But if you are making some improvements to HTA, please post it here so everyone can use it. I look forward to see other versions of this HTA.
Go to the top of the page
 
+Quote Post
obiwantuxedo
post May 8 2007, 11:30 AM
Post #4





Group: Members
Posts: 5
Joined: 17-February 04
Member No.: 14450



Here's what I've got...
CODE
<!****************************************************************************>
<!* HTA Header >
<!****************************************************************************>
<HEAD>
<TITLE>ImageX Deployment</TITLE>
<HTA:APPLICATION
BORDER = yes
APPLICATION = Yes
WINDOWSTATE = MAXIMIZE
INNERBORDER = No
SHOWINTASKBAR = Yes
SCROLL = yes
APPLICATIONNAME = "Windows PE Wizard"
NAVIGABLE = Yes
>
<!-- external stylesheet -->
</HEAD>

<!****************************************************************************>
<!* Begin Script >
<!****************************************************************************>
&lt;script Language=VBScript>

'****************************************************************************
'* Globals
'* setup global script parameters
'****************************************************************************
Option Explicit
Dim strTaskValue, objShell, objFso, strBody, objWmiService, strImgSrc, strOutPut, cmdImgInfo, cmdPartHD, tmpFile, j, strImages, strLocation
Dim strIndx(), strNames()
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
'Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")


'-------------- Editable commands --------------
' Diskpart command
cmdPartHD = "%comspec% /c diskpart /s z:\diskpart.txt"
' Image-X /info command. (xml-print)
cmdImgInfo= "%comspec% /c imagex /info z:\Image62.wim"
' Default file, where to parse image list
strImages = "z:\images.txt"
'------------------------------------------------
'****************************************************************************
'* Run Ghost is necessary
'****************************************************************************
Sub RunGhost32
Set objShell = CreateObject("Wscript.Shell")
objShell.Run ".\Ghost32.exe"
End Sub

'****************************************************************************
'* Window_OnLoad
'* load up behavior and preferences
'* Read image files
'* Parse indexes and filenames
'****************************************************************************
Sub Window_Onload
readImages()
strLocation = strImages 'InputBox("Path to images.txt file:", "images.txt" , strImages)
Call parseFile(strIndx, strNames, strLocation)
self.Focus()
strBody = "<BR><font face=verdana><B>Select image to apply:</B></font><BR>"
enumDirs
End Sub

'****************************************************************************
'* enumDirs
'****************************************************************************
Sub enumDirs
Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem, k
ReDim arrButtons(1,-1)

'Reset display element style
details.innerHTML = ""
details.style.visibility = "hidden"

'Create list
For k = 0 To Ubound(strIndx)
ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)
arrButtons(0,UBound(arrButtons,2)) = strNames(k)
arrButtons(1,UBound(arrButtons,2)) = "<font face=verdana><Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</font></BUTTON><BR>"
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

'End of the list
For x = 0 To UBound(arrButtons,2)
strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"
Next

strBody = strBody & "<BR><HR><BR>"
strBody = strBody & strButtons & "<BR><HR><BR><button class='defBtn' id=start Accesskey=S onclick=doTask(strTaskValue)><U>A</U>pply</BUTTON>   <Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>"

body.innerHTML = strBody
End Sub

'****************************************************************************
'* doTask
'* run task selected by radio button
'****************************************************************************
Sub doTask(doMe)
Dim myInput
Dim myError
If doMe = "" Then
MsgBox "You must choose image to apply first."
Else
If Instr(1, doMe, "gex /apply", 1) > 0 Then
myInput = MsgBox("The hard disk of the computer will be formatted and the image will be applied to it."+Chr(13)+Chr(13)+"Continue?", 4)
If myInput = 7 Then
MsgBox "Aborted by user"
Else
doTask(cmdPartHD)
objShell.Run doMe
End if
Else
myError = objShell.Run(doMe, 1, True)
End if
End if
End Sub

'****************************************************************************
'* readImages
'* Imagex info-print -> file
'****************************************************************************
Sub readImages()
'ObjShell.Run "%comspec% /c Dir " & chr(34) & strImgSrc & chr(34) & " > " & chr(34) & strOutPut & chr(34)
' Imagex /Info command
' ObjShell.Run "%comspec% /c " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34)
' objShell.Run cmdImgInfo & " > " & strImages
End Sub

'****************************************************************************
'* parseFile
'* Parses the text inside <name> and <index> tags from text file.
'****************************************************************************
Sub parseFile(strIndx(), strNames(), strFile)
Dim objTextFile, sReadLine, pos, pos2, i, tmpStr1
i = -1
Redim strNames(0)
Redim strIndx(0)

If objFso.FileExists(strFile) Then
Set objTextFile = objFso.OpenTextFile(strFile, 1)
Do While Not objTextFile.AtEndOfStream
sReadLine = objTextFile.ReadLine
' indexit ja name haltuun
pos2 = Instr(1, sReadLine, "<IMAGE", 1)
pos = Instr(1, sReadLine, "<NAME>", 1)
If pos2 > 0 Then
i = i + 1
Redim Preserve strIndx(i)
Redim Preserve strNames(i)
'strIndx(i) = Right(sReadLine, Len(sReadLine) - (pos2 + 9))
tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13))
strIndx(i) = Left(tmpStr1, Len(tmpStr1) -2)
End If

If pos > 0 Then
'strNames(i) = Right(sReadLine, Len(sReadLine) - (pos + 5))
tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5))
strNames(i) = Left(tmpStr1, Len(tmpStr1) -8)
End If
loop
End If
End sub
'****************************************************************************
'* showRadioInfo
'****************************************************************************
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 = "imagex /apply z:\Image62.wim " + Radio.Id + " c:"
End If
Next
'post resulting html to details element
Details.innerHTML = "<BR><font face=verdana><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table></font><BR>"
End Sub
'****************************************************************************
'* Reset'* reset the tool interface, also reloads the code (helpful for programming)
'****************************************************************************


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

'<BODY background="pe.jpg">
<table width=739 height =128 background=./masthead.jpg><tr><td align=center valign=bottom><font face=verdana color=white><b>ImageX Deployment Menu</b></font></td></tr></table>
<DIV id=bg>
<!-- <img src="K:\WinPE\pe.jpg"> -->

</DIV>

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

<DIV id=tools>


</DIV>
<br>
<table border="0" width="737">
<tr>
<td bgcolor="#000000" >
<p align="center"><font face="Verdana" color="#FFFFFF"><b>
Symantec Ghost</b></font></td>
</tr>


<tr>
<td ><font face="Verdana" size="2">If all else fails, you can use Ghost to image a workstation. 
You will need to know the path to the image or call the Help Desk (x4-5666) to setup a Multicast session.</td>
</tr>


<tr>
<td> </td>
</tr>
<tr>
<td><font face="Verdana" size="2"><font face = Verdana>

<input id=runbutton3 class="button" type="button" value="Ghost32" name="btnGhost32" onClick="RunGhost32"></font></td>
</tr>
</table>

</BODY>
</HTML>

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


So far the response from my techs and other SAs has been great. Again, thanks.
Go to the top of the page
 
+Quote Post
obiwantuxedo
post May 8 2007, 11:37 AM
Post #5





Group: Members
Posts: 5
Joined: 17-February 04
Member No.: 14450



Here is the code I added for the capture, but only gives me one prompt instead of the the three:

Under the &lt;script ...>
CODE
'****************************************************************************
'* Capture Image
'****************************************************************************
Sub RunScript
strDrv = window.prompt("Please enter the drive letter you would like to capture.", "Drive Letter")
strWimFile = window.prompt("Please enter the name for the captured image.", "Image Name")
strWimDesc = window.prompt("Please enter the make and model, i.e. Dell Latitude D820.", "Description")

'Test purposes only!!!
Msgbox "IMAGEX /CAPTURE "& strDrv &" " & strDrv & "\"& strWimFile & " " &chr(34) & strWimDesc &chr(34) & " /verify /compress maximum"

End Sub


Under <BODY ...>
CODE
<input id="runbutton" class="button" type="button" value="Capture" name="run_button" onClick="RunScript">


Like I said before, when I run this exact code in an HTA of its' own, it works. Cut and paste into this HTA, and I only receive one prompt.
Go to the top of the page
 
+Quote Post
geezery
post May 8 2007, 11:58 AM
Post #6


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


Good to hear some nice feedback.

I personally wouldnt use that /compress maximum switch, because the time it takes is like 3x to normal compression and the size difference is quite small.

And you don't need that verify switch, if you are using network path, because it is turned on by default on network paths.

Very nice work obionetuxedo.

If someone else has some more ideas to give, put your wishes here.
Go to the top of the page
 
+Quote Post
zorphnog
post May 9 2007, 01:29 PM
Post #7


Advanced Member
***

Group: Members
Posts: 427
Joined: 25-July 06
From: Charleston, SC
Member No.: 105938
Country Flag


While I agree that compress max takes a substantially greater amount of time to capture, the difference in size can be great depending on what kind of data you're capturing. Compression algorithms rely on repeated data, so if you have a lot of similar data it can make a difference. In my captures it reduces the size by about 25% which is fairly good considering I have 9GB images. Though for smaller images its not very beneficial.
Go to the top of the page
 
+Quote Post
Seattle
post May 10 2007, 09:45 AM
Post #8





Group: Members
Posts: 2
Joined: 10-May 07
Member No.: 138741
OS: none
Country Flag


Hello,

First, I would like to say thanks to the OP for some fine work here smile.gif

Second, I am trying to use this in my PE Boot Image (WDS Server) and it sort-of works.

PE Loads / Boots / Initializes / Maps the Drive / and then launches the program but I receive a script error.

Error:

Line: 54
Char: 1
Error: Invalid Syntax
Code: 0

It asks if I would like to continue running the script and I click yes.

The interface comes up with no images listed.

If you need more information, please let me know.

Thanks!
Go to the top of the page
 
+Quote Post
geezery
post May 10 2007, 10:56 AM
Post #9


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


I think you have problem with the images.txt file.

Can you post your code here?
Go to the top of the page
 
+Quote Post
Seattle
post May 10 2007, 11:16 AM
Post #10





Group: Members
Posts: 2
Joined: 10-May 07
Member No.: 138741
OS: none
Country Flag


QUOTE (geezery @ May 10 2007, 09:56 AM) *
I think you have problem with the images.txt file.

Can you post your code here?


CODE
<html>
<!--
'********************************************************************
'*
'* File: ImageXHTA.hta
'* Author: geezery
'* Big thanks to : greg & fisher
'* Created: May 2007
'* Version: .1
'*
'* Description: windows imaging platform
'*
'* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,
'* XML, HTA packages, Imagex components
'* Notes: Line 28 - might want to make this "normal" when you are
'* testing and don't want the hta fullscreen
'* Line 206 - Put your background image there if you want
'********************************************************************
-->

<!****************************************************************************>
<!* HTA Header >
<!****************************************************************************>
<HEAD>
<TITLE>Imaging Application</TITLE>
<HTA:APPLICATION
BORDER = yes
APPLICATION = Yes
WINDOWSTATE = maximize
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 >
<!****************************************************************************>
&lt;script Language=VBScript>

'****************************************************************************
'* Globals
'* setup global script parameters
'****************************************************************************
Option Explicit
Dim strTaskValue, objShell, objFso, strBody, objWmiService, strImgSrc, strOutPut, cmdImgInfo, cmdPartHD, tmpFile, j, strImages, strLocation
Dim strIndx(), strNames()
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")


'-------------- Editable commands --------------
' Diskpart command
cmdPartHD = "%comspec% /c diskpart /s F:\winpe\diskpart.txt"
' Image-X /info command. (xml-print)
cmdImgInfo= "%comspec% /c imagex /info F:\images.wim"
' Default file, where to parse image list
strImages = "F:\Winpe\images.txt"
'------------------------------------------------

'****************************************************************************
'* Window_OnLoad
'* load up behavior and preferences
'* Read image files
'* Parse indexes and filenames
'****************************************************************************
Sub Window_Onload
readImages()
strLocation = InputBox("Path to images.txt file:", "images.txt" , strImages)
Call parseFile(strIndx, strNames, strLocation)
self.Focus()
strBody = "<div id='title'>Tetra Tech Deployment Center</div>" & "<BR><B>Select image to apply:</B><BR>"
enumDirs
End Sub

'****************************************************************************
'* enumDirs
'****************************************************************************
Sub enumDirs
Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem, k
ReDim arrButtons(1,-1)

'Reset display element style
details.innerHTML = ""
details.style.visibility = "hidden"

'Create list
For k = 0 To Ubound(strIndx)
ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)
arrButtons(0,UBound(arrButtons,2)) = strNames(k)
arrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</BUTTON><BR>"
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

'End of the list
For x = 0 To UBound(arrButtons,2)
strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"
Next

strBody = strBody & "<BR><HR><BR>"
strBody = strBody & strButtons & "<BR><HR><BR><button class='defBtn' id=start Accesskey=S onclick=doTask(strTaskValue)><U>A</U>pply image</BUTTON><BR>"

body.innerHTML = strBody
End Sub

'****************************************************************************
'* doTask
'* run task selected by radio button
'****************************************************************************
Sub doTask(doMe)
Dim myInput
Dim myError
If doMe = "" Then
    MsgBox "You must choose image to apply first."
Else
    If Instr(1, doMe, "gex /apply", 1) > 0 Then
        myInput = MsgBox("The hard disk of the computer will be formatted and the image will be applied to it."+Chr(13)+Chr(13)+"Continue?", 4)
        If myInput = 7 Then
            MsgBox "Aborted by user"    
        Else
            doTask(cmdPartHD)    
            objShell.Run doMe
        End if
    Else
        myError = objShell.Run(doMe, 1, True)
    End if
End if
End Sub

'****************************************************************************
'* readImages
'* Imagex info-print -> file
'****************************************************************************
Sub readImages()
    'ObjShell.Run "%comspec% /c Dir " & chr(34) & strImgSrc & chr(34) & " > " & chr(34) & strOutPut & chr(34)
    ' Imagex /Info command
    ' ObjShell.Run "%comspec% /c Dir " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34)
End Sub

'****************************************************************************
'* parseFile
'* Parses the text inside <name> and <index> tags from text file.
'****************************************************************************
Sub parseFile(strIndx(), strNames(), strFile)
Dim objTextFile, sReadLine, pos, pos2, i, tmpStr1
i = -1
Redim strNames(0)
Redim strIndx(0)

If objFso.FileExists(strFile) Then
    Set objTextFile = objFso.OpenTextFile(strFile, 1)
    Do While Not objTextFile.AtEndOfStream
        sReadLine = objTextFile.ReadLine
        ' indexit ja name haltuun
        pos2 = Instr(1, sReadLine, "<IMAGE", 1)
        pos = Instr(1, sReadLine, "<NAME>", 1)
        If pos2 > 0 Then
            i = i + 1
            Redim Preserve strIndx(i)
            Redim Preserve strNames(i)
            'strIndx(i) = Right(sReadLine, Len(sReadLine) - (pos2 + 9))
            tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13))
            strIndx(i) = Left(tmpStr1, Len(tmpStr1) -2)
        End If

        If pos > 0 Then
            'strNames(i) = Right(sReadLine, Len(sReadLine) - (pos + 5))
            tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5))
            strNames(i) = Left(tmpStr1, Len(tmpStr1) -8)
        End If
    loop
End If
End sub
'****************************************************************************
'* showRadioInfo
'****************************************************************************
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 = "imagex /apply F:\images.wim " + Radio.Id + " c:"
End If
Next
'post resulting html to details element
Details.innerHTML = "<BR><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table><BR>"
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 background="pe.jpg">
<DIV id=bg>
<!-- <img src="pe.jpg"> -->

</DIV>

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

<DIV id=tools>
<Button class = 'defBtn' id=cmd onclick=doTask('%comspec%')> CMD-Prompt </BUTTON>
<Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>
<Button class = 'defBtn' id=reset onclick=reset> Refresh List</BUTTON>
</DIV>
</BODY>
</HTML>

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


** Also, are these files supposed to be placed on the MappedDrive:\winpe\ folder? I keep getting an access denied when calling the HTA, even though the drive maps fine.

I apologize for my newbiness smile.gif I really do appreciate your help.

Originally, I added these files to the winpe boot image and was able to call the HTA but that is when I receive the script error.

Then I saw the note about creating a winpe folder in the image directory but now i am receiving access denied. sad.gif

This post has been edited by Seattle: May 10 2007, 11:19 AM
Go to the top of the page
 
+Quote Post
geezery
post May 10 2007, 12:03 PM
Post #11


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


I think you have an file access problem.

Here is how I use this HTA:

1. Make a Windows share somewhere for example \\mysrv\share

2. Give the appropriate access to files & share it for "Everyone".
(You can test it by giving user "Everyone" Read access to share)

3. Put your *.wim file & diskpart.txt file to that dir.
(Then you must create an xml output file from your wim file)

4. You can do it from cmd prompt easily (imagex /info filename.wim > images.txt)
(Now you have three files inside the share "images.wim, images.txt, diskpart.txt")

5. You should also edit diskpart.txt to suite in your needs.

6. Put ImageXHTA.hta and htastyle.css in your boot.wim system32 folder. That way you can call the hta file without full pathname.
(You can also put all these files in the network share and call those mshta.exe Z:\ImageXHTA.hta) (Z:\ mapped network path)
(I haven't tested this method, but it would be great, because you could edit the hta file afterwards.)

You can also put several wim files in the share and make multiple xml output files. Then just point to the xml file you want. You can also leave this section blank if you want always to specify correct path to xml output file.

CODE
' Default file, where to parse image list
strImages = "F:\Winpe\images.txt"
Go to the top of the page
 
+Quote Post
p4ntb0y
post May 13 2007, 05:55 AM
Post #12


Member
**

Group: Members
Posts: 237
Joined: 14-February 06
Member No.: 87996
Country Flag


Very Nice!

If I wanted append images within images will this still have the same effect?
I am a bit of a vbs noob and still going thru it.


It be nice to have all my image options from the xml file (again I have to research weather you can get /info from appeded images)

then select the one I require and off it goes with the right append number.

I would then look to split this across two cds and deploy to our engineers as a backup for no network, be great for support.
Go to the top of the page
 
+Quote Post
geezery
post May 13 2007, 06:45 AM
Post #13


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


Of course it works. The example images.wim file has three images here in my sample. I don't know about the splitting to cd's.
Go to the top of the page
 
+Quote Post
p4ntb0y
post May 13 2007, 07:11 AM
Post #14


Member
**

Group: Members
Posts: 237
Joined: 14-February 06
Member No.: 87996
Country Flag


next time I finish reading thru your code and not just jump in at the deep end sorry for that.
Go to the top of the page
 
+Quote Post
thebearpoo
post May 18 2007, 11:44 AM
Post #15





Group: Members
Posts: 7
Joined: 30-January 07
Member No.: 124185
Country Flag


Thanks for the source code. I need some help though, I am getting an error message after my diskpart runs and exits.
Error is -
Line: 140
Char: 4
Error: The system cannot find the specified file.
Code: 0
URL: file:////X:/windows/system32/tools/hta/ImageXHTA.hta


diskpart.txt, install.wim, and images.txt are all located in a network drive that is mapped using the net use command before the ImageXHTA.hta apps is launched in WINPE 2.0. ImageXHTA.hta, htasyle.css, pe.jpg, and Update Image list.cmd are located in the windows\system32\tools\hta folder of the boot.wim file.

Here is my code:

CODE
<html>
<!--
'********************************************************************
'*
'* File: ImageXHTA.hta
'* Author: geezery
'* Big thanks to : greg & fisher
'* Created: May 2007
'* Version: .1
'*
'* Description: windows imaging platform
'*
'* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,
'* XML, HTA packages, Imagex components
'* Notes: Line 28 - might want to make this "normal" when you are
'* testing and don't want the hta fullscreen
'* Line 206 - Put your background image there if you want
'********************************************************************
-->

<!****************************************************************************>
<!* HTA Header >
<!****************************************************************************>
<HEAD>
<TITLE>Imaging Application</TITLE>
<HTA:APPLICATION
BORDER = yes
APPLICATION = Yes
WINDOWSTATE = maximize
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 >
<!****************************************************************************>
&lt;script Language=VBScript>

'****************************************************************************
'* Globals
'* setup global script parameters
'****************************************************************************
Option Explicit
Dim strTaskValue, objShell, objFso, strBody, objWmiService, strImgSrc, strOutPut, cmdImgInfo, cmdPartHD, tmpFile, j, strImages, strLocation
Dim strIndx(), strNames()
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")


'-------------- Editable commands --------------
' Diskpart command
cmdPartHD = "%comspec% /c diskpart /s Q:\diskpart.txt"
' Image-X /info command. (xml-print)
cmdImgInfo= "%comspec% /c imagex /info Q:\install.wim"
' Default file, where to parse image list
strImages = "Q:\images.txt"
'------------------------------------------------

'****************************************************************************
'* Window_OnLoad
'* load up behavior and preferences
'* Read image files
'* Parse indexes and filenames
'****************************************************************************
Sub Window_Onload
readImages()
strLocation = InputBox("Path to images.txt file:", "images.txt" , strImages)
Call parseFile(strIndx, strNames, strLocation)
self.Focus()
strBody = "<div id='title'>ImageX Deployment platform</div>" & "<BR><B>Select image to apply:</B><BR>"
enumDirs
End Sub

'****************************************************************************
'* enumDirs
'****************************************************************************
Sub enumDirs
Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem, k
ReDim arrButtons(1,-1)

'Reset display element style
details.innerHTML = ""
details.style.visibility = "hidden"

'Create list
For k = 0 To Ubound(strIndx)
ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)
arrButtons(0,UBound(arrButtons,2)) = strNames(k)
arrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</BUTTON><BR>"
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

'End of the list
For x = 0 To UBound(arrButtons,2)
strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"
Next

strBody = strBody & "<BR><HR><BR>"
strBody = strBody & strButtons & "<BR><HR><BR><button class='defBtn' id=start Accesskey=S onclick=doTask(strTaskValue)><U>A</U>pply image</BUTTON><BR>"

body.innerHTML = strBody
End Sub

'****************************************************************************
'* doTask
'* run task selected by radio button
'****************************************************************************
Sub doTask(doMe)
Dim myInput
Dim myError
If doMe = "" Then
MsgBox "You must choose image to apply first."
Else
If Instr(1, doMe, "gex /apply", 1) > 0 Then
myInput = MsgBox("The hard disk of the computer will be formatted and the image will be applied to it."+Chr(13)+Chr(13)+"Continue?", 4)
If myInput = 7 Then
MsgBox "Aborted by user"
Else
doTask(cmdPartHD)
objShell.Run doMe
End if
Else
myError = objShell.Run(doMe, 1, True)
End if
End if
End Sub

'****************************************************************************
'* readImages
'* Imagex info-print -> file
'****************************************************************************
Sub readImages()
'ObjShell.Run "%comspec% /c Dir " & chr(34) & strImgSrc & chr(34) & " > " & chr(34) & strOutPut & chr(34)
' Imagex /Info command
' ObjShell.Run "%comspec% /c Dir " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34)
End Sub

'****************************************************************************
'* parseFile
'* Parses the text inside <name> and <index> tags from text file.
'****************************************************************************
Sub parseFile(strIndx(), strNames(), strFile)
Dim objTextFile, sReadLine, pos, pos2, i, tmpStr1
i = -1
Redim strNames(0)
Redim strIndx(0)

If objFso.FileExists(strFile) Then
Set objTextFile = objFso.OpenTextFile(strFile, 1)
Do While Not objTextFile.AtEndOfStream
sReadLine = objTextFile.ReadLine
' indexit ja name haltuun
pos2 = Instr(1, sReadLine, "<IMAGE", 1)
pos = Instr(1, sReadLine, "<NAME>", 1)
If pos2 > 0 Then
i = i + 1
Redim Preserve strIndx(i)
Redim Preserve strNames(i)
'strIndx(i) = Right(sReadLine, Len(sReadLine) - (pos2 + 9))
tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13))
strIndx(i) = Left(tmpStr1, Len(tmpStr1) -2)
End If

If pos > 0 Then
'strNames(i) = Right(sReadLine, Len(sReadLine) - (pos + 5))
tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5))
strNames(i) = Left(tmpStr1, Len(tmpStr1) -8)
End If
loop
End If
End sub
'****************************************************************************
'* showRadioInfo
'****************************************************************************
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 = "imagex /apply Q:\install.wim " + Radio.Id + " c:"
End If
Next
'post resulting html to details element
Details.innerHTML = "<BR><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table><BR>"
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 background="pe.jpg">
<DIV id=bg>
<!-- <img src="pe.jpg"> -->

</DIV>

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

<DIV id=tools>
<Button class = 'defBtn' id=cmd onclick=doTask('%comspec%')> CMD-Prompt </BUTTON>
<Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>
<Button class = 'defBtn' id=reset onclick=reset> Refresh List</BUTTON>
</DIV>
</BODY>
</HTML>

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


Here is my images.txt file
CODE


ImageX Tool for Windows

Copyright © Microsoft Corp. 1981-2005. All rights reserved.





WIM Information:
----------------
GUID: {1bf6a4c6-35cf-45a4-be1a-526c70946546}
Image Count: 1
Compression: XPRESS
Part Number: 1/1
Attributes: 0xc
Integrity info
Relative path junction


Available Image Choices:
------------------------
<WIM>

<TOTALBYTES>2029827781</TOTALBYTES>

<IMAGE INDEX="1">

<NAME>Windows Vista Business</NAME>

<FLAGS>Business</FLAGS>

<WINDOWS>

<ARCH>0</ARCH>

<PRODUCTNAME>Microsoft® Windows® Operating System</PRODUCTNAME>

<HAL>acpiapic</HAL>

<PRODUCTTYPE>WinNT</PRODUCTTYPE>

<PRODUCTSUITE>Terminal Server</PRODUCTSUITE>

<LANGUAGES>

<LANGUAGE>en-US</LANGUAGE>

<DEFAULT>en-US</DEFAULT>

</LANGUAGES>

<VERSION>

<MAJOR>6</MAJOR>

<MINOR>0</MINOR>

<BUILD>6000</BUILD>

<SPBUILD>16386</SPBUILD>

</VERSION>

<SYSTEMROOT>WINDOWS</SYSTEMROOT>

</WINDOWS>

<DIRCOUNT>6845</DIRCOUNT>

<FILECOUNT>38059</FILECOUNT>

<TOTALBYTES>7416098786</TOTALBYTES>

<CREATIONTIME>

<HIGHPART>0x01C79672</HIGHPART>

<LOWPART>0x475F3C78</LOWPART>

</CREATIONTIME>

<LASTMODIFICATIONTIME>

<HIGHPART>0x01C79672</HIGHPART>

<LOWPART>0x48083E5F</LOWPART>

</LASTMODIFICATIONTIME>

</IMAGE>

</WIM>



Any ideas???
Go to the top of the page
 
+Quote Post
thebearpoo
post May 18 2007, 02:00 PM
Post #16





Group: Members
Posts: 7
Joined: 30-January 07
Member No.: 124185
Country Flag


Problem solved!!!!!!!!!

Make sure to have your WINPE 2.0 base installation correct first, especially copying imagex.exe into the \mount\windows folder structure.
Go to the top of the page
 
+Quote Post
frankenstein897
post May 25 2007, 08:38 AM
Post #17





Group: Members
Posts: 9
Joined: 25-May 07
Member No.: 140547
OS: Vista Business x86
Country Flag


Forgive my ignorance but, when you reference images.wim does that contain multiple images in 1 file? I have multiple wim files for each images, am I doing that wrong? I am new to imagex so please forgive me. I am trying to figure out how to get this script to enumerate all of the images but, if you are supposed to put it in 1 file then that would make a different. Sorry, confused

Thanks,
Chris
Go to the top of the page
 
+Quote Post
eth0
post May 25 2007, 09:27 AM
Post #18


Newbie


Group: Members
Posts: 20
Joined: 13-August 04
Member No.: 27411



QUOTE (frankenstein897 @ May 25 2007, 04:38 PM) *
I have multiple wim files for each images, am I doing that wrong? I am new to imagex so please forgive me. I am trying to figure out how to get this script to enumerate all of the images but, if you are supposed to put it in 1 file then that would make a difference.

It's not wrong, but you lose one of the advantages the WIM format has i.e. specify multiple versions in the same file.
You can check the (revised) imagex documentation http://www.microsoft.com/downloads/details...;displaylang=en for the details if you want.

I think the hardest part would be getting your script to list the internal catalogue and echo that back into your HTA/textfile/whatever.
I dunno, maybe a dynamic array or something "could" solve that.
Go to the top of the page
 
+Quote Post
geezery
post May 25 2007, 10:41 AM
Post #19


Member
**

Group: Members
Posts: 248
Joined: 21-July 06
From: Helsinki
Member No.: 105112
Country Flag


I think I'm going to add support for multiple *.wim files in the hard coded folder. Maybe it can be dynamic also. I have to change the code a lot.

If someone has example for me to get the imagex /info wimfile.wim output to variable I could make that easily.

There is a nice component available, but it is not free. ****

http://www.smartdeploy.com/products/index.htm

This post has been edited by geezery: May 25 2007, 11:22 AM
Go to the top of the page
 
+Quote Post
frankenstein897
post May 25 2007, 12:05 PM
Post #20





Group: Members
Posts: 9
Joined: 25-May 07
Member No.: 140547
OS: Vista Business x86
Country Flag


Ok, I am convinced to use one image file. Pretty sweet. Thanks all!
Go to the top of the page
 
+Quote Post

Google Frontpage Forums Unattended CD/DVD Guide

17 Pages V   1 2 3 > » 
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 




Lo-Fi Version Time is now: 4th July 2009 - 05:54 AM
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001-2009 msfn.org
Privacy Policy