• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
geezery

WinPE 2.0 GimageX COM based HTA

357 posts in this topic

@Geezery

sorry I mean't an apply button I know you list the wims from a location you set in the script but another apply button would be heplfull to browse to a network share or USB Drive. That way you cover all base's and add extras in later.

I like the colour scheme as well just make it translucent to make it look like vista aero

Edited by p4ntb0y
0

Share this post


Link to post
Share on other sites

Hi Geezery, finally had a chance to test your new version, looking good, I really like the new icons. Something to watch is that if you save the imagex.hta onto a network drive. and then move it to your tech pc to add to the windows pe, right click the HTA and click unblock before creating the winpe. For some reason having it on a network drive makes it a blocked file and then when you boot into winpe and run imagex.hta you will get "access denied".

I was pulling my hair out for awhile. I noticed in your hta you have a space between diskpart and its extension (diskpart .txt) no problem for me as I changed the location, but it may cause others a hassel, other than that everything looks sweet.

The chkdsk seems to work great, haven't had a single image fail today, the actual process of running chkdsk also happens so quickly even with a lot of files that it doesn't seem necessary to have an option not to run chkdsk, but that just my opinion.

I like the current apply functionality. with the wim drop down list and everything. I still think their should be a prompt asking for the wim location as the program starts instead of manually adding the location of the wim file in the hta.

Looking forward to the disk status functionality, at the moment I just make use of the cmd button and then run diskpart list volume, but if the info actually automatically pops up the info within the hta that would be excellent.

I have tested the append functionality and it works great.

Is there any chance of hard coding imagex to use wimscript.ini when capturing/appending so pernament exclusions can be set.

I believe the syntax is imagex /capture /config=x:\windows\system32\wimscript.ini .... etc.

In the wimscript.ini file you can just have the default exclusions, but it gives us a chance to add new exclusions. eg. exclude zip files from compression, etc.

Edited by solutionone
0

Share this post


Link to post
Share on other sites

I noticed that extra space also yesterday. I think there is a possibility to make a dynamic diskapart also without the diskpart.txt file, but the scripting of it might take like 20 hours or more and I don't have time for it now. Actually I managed to make that diskpart list volume popup, but the text formatting is a mess. I think I'm going to use wmi to retrieve the volume information. I actually have code for that also.

If someone likes to make that diskpart script it would be nice. I tested the Sendkeys method to diskpart and it works pretty well.

msdn sendkeys

http://msdn2.microsoft.com/en-us/library/8c6yea83.aspx

I don't know about that extra apply button, since if I make that *.wim file path change option you can then always change the path.

Adding options to Imagex /Capture

Line: 252 in v0.23

Original:

ObjShell.Run "%comspec% /c imagex /capture "& strDrv &" "  & myFilepath &  strWimFile & " " &chr(34) & strWimDesc &chr(34) & " " &chr(34) & strWimDesc2 &chr(34)

Modified:

ObjShell.Run "%comspec% /c imagex /capture /config=x:\windows\system32\wimscript.ini "& strDrv &" "  & myFilepath &  strWimFile & " " &chr(34) & strWimDesc &chr(34) & " " &chr(34) & strWimDesc2 &chr(34)

Notice the extra space after the wimscript.ini!

I think it would be nice to have an option to install Windows XP from the Gui also, does anyone have a step by step tutorial for this? I noticed the thread here and there was a mention about some registry keys that needs to be edited before the diskpart.

Edited by geezery
0

Share this post


Link to post
Share on other sites

Hi again Geezery, I've been doing some research into p4ntb0y's idea of using the open dialog box for picking the wim location and etc. I found this brilliant hta reference from the scripting guy @ MS.

http://www.microsoft.com/technet/scriptcen...s/fileopen.mspx

hope this helps, by the way thanks for the quick reply regarding the imagex config file. I've made the changes which work great. I'll post my exclusions list for compression when I get the chance at work tomorrow.

I think installing XP/Vista from this would be an excellent addition to this project, but we should probably get all the base functions down pat first. Good foundations and all that, not that it doesn't work well at the moment, but we can all work together with ideas, etc to make a good project a great one :thumbup

0

Share this post


Link to post
Share on other sites

When it finds my wim file it does not display the images contained (but I can select the radio button) and it also does not display the image decription.

Any ideas?

0

Share this post


Link to post
Share on other sites

Can you try the same thing with winpe.wim that is included in waik?

Where are you running the script virtual or real environment?

What version of imagex are you using?

0

Share this post


Link to post
Share on other sites

Well, I'm doing this from VistaPE (made with Winbuilder) I haven't done this scrictly in a WinPE environment. I did try the AutoIt gui and after modifying it a bit it did display the images and description and also layed the image down.

I haven't tried it with the wim file from the AIK, I'll give that a try and am using imagex 6.0.6000.16386

0

Share this post


Link to post
Share on other sites

Ok, the problem must be the VistaPe. Is there all the components included that I specified on the first post?

0

Share this post


Link to post
Share on other sites

Nightman has made the following available: WSH, MDAC, HTA, WMI and XML. Although that plugin is in beta so I would have to say that it might not be fully supported. Everything else in your hta works it just doesn't list the images, description or lay the image down on the hard drive. The autoit tool does.

0

Share this post


Link to post
Share on other sites

I'll try to solve the vistape problem. I first have to build a fresh Vista Pe image

0

Share this post


Link to post
Share on other sites

@Geezery

I was thinking of the diskpart list volume popup coming out all jumbled. Is the jumbled mess a CSV (comma separated) or does it just completely lose its formatting entirely.

If it is comma separated, I know of a way we might be able to sort it out so it is usable again quite easily.

I think I have a working plan for a dynamic diskpart.txt, but I'm still looking into it.

@powaking

Forgive my ignorance, but when you talk about Vista PE, are you just talking about WinPE 2.0 (the version created with the latest WAIK that is a cut down/basic version of Windows Vista), or is this some new custom system, like Bart PE?

Edited by solutionone
0

Share this post


Link to post
Share on other sites

Geezery,

Yes sorry an filepath dropdown list would be nice for the browse to...

beware that vista acts a little bit different to code than in xp for some reason.

0

Share this post


Link to post
Share on other sites
@powaking

Forgive my ignorance, but when you talk about Vista PE, are you just talking about WinPE 2.0 (the version created with the latest WAIK that is a cut down/basic version of Windows Vista), or is this some new custom system, like Bart PE?

I guess you can say it is like BartPE. It uses either Vista source or WAIK to build a wim file. Here is the website for the VistaPE project: http://vistape.boot-land.net/eng/about.html

It does use the WinPE2.0 core with the addition of adding a shell and the ability to use 32bit tools.

@Geezery

I tried the WinPE.wim file from the WAIK booting via PXE on a machine and when I attempted to launch the hta file I was presented with a Open With dialog box. Sorry, haven't really played around with WinPE itself, been focused on the VistaPE project myself. Would like to get a gui working for wim files as this might be the choice we will be moving towards in our environment (currently using RDeploy for our imaging needs).

0

Share this post


Link to post
Share on other sites

Does anyone know of a project that uses the standard WinPE 2.0 but lets you integrate the MassStorage and Networking driverpacks into it. (found here http://www.driverpacks.net/DriverPacks/ )

This would be handy for this particular project as it would make it easier to support multiple hardware platforms.

It would be great to be able to boot a system with RAID and make a image of it without having to search for all the RAID drivers.

0

Share this post


Link to post
Share on other sites

p4ntb0y->

Do you know how I can get this dialog to work on Winpe v2. It works on Windows XP, but not on WinPe based system.

Here is the full sub, just make a button to call it. I also tried BrowseForFolder method and safrcdlg.CommonDialog and none of them work in Winpe. I noticed that in winpe's notepad there is a nice dialog when opening files. I wonder how I can call it?

'****************************************************************************
'* Browse Folder Button
'****************************************************************************

Sub Browse

Dim objDialog, FilePath, JustPath, objFile
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Wim Files|*.wim|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = myFilePath
FilePath = objDialog.ShowOpen
If FilePath = 0 Then
Exit Sub
Else

FilePath = objDialog.FileName
Set objFile = objFSO.GetFile(FilePath)
MyFilePath = objFSO.GetParentFolderName(FilePath) & "\"
Window_Onload
End If
End Sub

Solutionone ->

Here is the code for the diskpart.

If you find a way to make it readable that would be nice. Maybe you can try to Replace " " empty chars with vbTab or something:)

Sub Volumes
Dim oExec,OShell, list
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec("diskpart")
oExec.StdIn.Write "list volume" & VbCrLf
oExec.StdIn.Write "exit" & VbCrLf
list = Trim(OExec.StdOut.ReadAll)
msgbox(list)
End Sub

I'll try to find time to test this on Vistape, but I would first like to get some more features working.

0

Share this post


Link to post
Share on other sites

powaking->

Can you make a test in VistaPe?

Copy this code to notepad and change the filename.wim to your wim filename. Then Save it to same folder where the wim is i. e. test.vbs

CAll Volumes

Sub Volumes
Dim oExec,OShell, list
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec("imagex /info filename.wim") 'Change filename.wim to your wim filename
list = Trim(OExec.StdOut.ReadAll)
msgbox(list)
End Sub

Execute the script. You should get a msgbox containing the wim info. Try this in the VistaPE.

0

Share this post


Link to post
Share on other sites

It seems that everything works, but suddenly, I realized the background image is gone!

Below is what I have, Geezrey, you used to put in the older version:

<Body background="pe.jpg">

that no longer works (I just have a grey background). Then I modify your lines as follows:

<BODY>

<DIV id=bg>

img src="e:\pe.jpg">

</DIV>

What happens is I have the image at the top of the screen, and the selection comes below the image, not in the image. Do you know why?

thx

0

Share this post


Link to post
Share on other sites

Yes I know. I added some parameter also to the .css file replace the .css file with the old one and it should work. Or look at the Body section in the css.

0

Share this post


Link to post
Share on other sites
powaking->

Can you make a test in VistaPe?

Copy this code to notepad and change the filename.wim to your wim filename. Then Save it to same folder where the wim is i. e. test.vb script: test.vbs

Tried it but got this error:

Line: 6

Char: 1

Error: The system cannot find the file specified

Code: 800700002

Source: WshShell.Exec

I even issued a cscript //H:WScript for giggles and got the same results.

BUT

I then relealized I hadn't copied the required wim files into the system32. Once I did that then I got the msgbox displaying the WIMs information. So looks like we are heading in the right direction.

Now just need to make a plugin for Vistape to copy these files to the system32 folder (so I don't have to manually do it each and every time).

Edit:

If I add this:

Do While Not oExec.StdOut.AtEndOfStream

sReadLine = oExec.StdOut.ReadLine

pos = Instr(1, sReadLine, "<DESCRIPTION>", 1)

if pos = 0 then

else

msgbox pos

end if

loop

To the Test.vbs all I get is 5 for the value of pos.

Edit #2: (Sorry but I think this is it and we can work from here)

This works. It displays the Image number, description and name

CAll Volumes

Redim strNames(0)

Redim strIndx(0)

Redim strDesc(0)

Sub Volumes

Dim oExec,OShell, list

Set oShell = CreateObject("WScript.Shell")

Set oExec = oShell.Exec("imagex.exe /info i:\vistape\MyWim.wim")

Do While Not oExec.StdOut.AtEndOfStream

sReadLine = oExec.StdOut.ReadLine

pos = Instr(1, sReadLine, "<NAME>", 1)

pos2 = Instr(1, sReadLine, "<IMAGE ", 1)

pos3= Instr(1, sReadLine, "<DESCRIPTION>", 1)

If pos2 > 0 Then

i = i + 1

Redim Preserve strIndx(i)

Redim Preserve strNames(i)

Redim Preserve strDesc(i)

strDesc(i) = "NO DESCRIPTION"

tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13))

strIndx(i) = Left(tmpStr1, Len(tmpStr1) -3) 'increased to 3 to remove the additional "

msgbox strIndx(i)

End If

If pos > 0 Then

tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5))

strNames(i) = Left(tmpStr1, Len(tmpStr1) -8)

msgbox strNames(i)

End If

If pos3 > 0 Then

tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos3 + 12))

strDesc(i) = Left(tmpStr1, Len(tmpStr1) -15)

msgbox strDesc(i)

End If

loop

End Sub

When I incorporated this into your hta I still don't get the information in the hta.

Edited by powaking
0

Share this post


Link to post
Share on other sites
p4ntb0y->

Do you know how I can get this dialog to work on Winpe v2. It works on Windows XP, but not on WinPe based system.

Here is the full sub, just make a button to call it. I also tried BrowseForFolder method and safrcdlg.CommonDialog and none of them work in Winpe. I noticed that in winpe's notepad there is a nice dialog when opening files. I wonder how I can call it?

'****************************************************************************
'* Browse Folder Button
'****************************************************************************

Sub Browse

Dim objDialog, FilePath, JustPath, objFile
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Wim Files|*.wim|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = myFilePath
FilePath = objDialog.ShowOpen
If FilePath = 0 Then
Exit Sub
Else

FilePath = objDialog.FileName
Set objFile = objFSO.GetFile(FilePath)
MyFilePath = objFSO.GetParentFolderName(FilePath) & "\"
Window_Onload
End If
End Sub

Have you taken a look here?

http://www.visualbasicscript.com/m_36250/tm.htm

0

Share this post


Link to post
Share on other sites

I hardcoded this line to the hta file:

Set oExec = oShell.Exec("imagex.exe /info " + strFile)

to this

Set oExec = oShell.Exec("imagex.exe /info m:\vistape\mywim.wim")

One I did that I was able to view that wims image number and description.

It appears it has something to do with this:

Set objSel1 = window.document.getElementById("select1")

strFile = myFilepath + objSel1.options(objSel1.selectedindex).text

??

Edited by powaking
0

Share this post


Link to post
Share on other sites

Ok, I haven't looked at the source code, but if you copied that directly the +'s should be &'s. Thats just strictly from a vbscripting perspective.

0

Share this post


Link to post
Share on other sites

I think I found the issue. My file path was set to M:\vistape. After doing some msgbox's I realized it should have been M:\Vistape\. Once I added the last \ it then processed my wim files. Feel sooooo stupid :wacko:

0

Share this post


Link to post
Share on other sites

After much thought about getting rid of the diskpart.txt file, when using the apply function. I thought of another way we would possibly do this better.

Instead of having the static diskpart.txt file, we could create the diskpart.txt file actually in the HTA dynamically line by line.

somebody could even write in some logic paths into the code, e.g. how many partitions do you wish to create, what size do you want to make the partitions. (unfortunately I'm not a scripter/programmer at all, so I found this sample code, but I'm not sure if it will work, so how to implement it)

The code could be set to delete the diskpart.txt everytime imagex.hta is refreshed.

<%
dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("x:\windows\system32\diskpart.txt", True)
path = filesys.GetAbsolutePathName("x:\windows\system32\diskpart.txt")
getname = filesys.GetFileName(path)
filetxt.WriteLine("Your text goes here.")
filetxt.Close
If filesys.FileExists(path) Then
Response.Write ("Your file, '" & getname & "', has been created.")
End If
%>

EDIT

Haha, I figured out the "diskpart list volume" formatting issue, I'll post my findings in the morning. Its been a long day.... I think my plan will be a pretty cool addition, and I've figured out most of the coding.

Edited by solutionone
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.