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

Jump to content



  • 6 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • You cannot start a new topic
  • You cannot reply to this topic

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

#81 User is offline   sinecure 

  • Group: Members
  • Posts: 3
  • Joined: 28-April 08

Posted 23 May 2008 - 05:22 PM

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.

This post has been edited by sinecure: 27 May 2008 - 03:20 PM



#82 User is offline   naclejoh 

  • Group: Members
  • Posts: 1
  • Joined: 20-July 08

Posted 20 July 2008 - 08:21 AM

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.

#83 User is offline   rgaspar 

  • Group: Members
  • Posts: 3
  • Joined: 31-January 07

Posted 28 July 2008 - 09:23 AM

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 

Attached File(s)


This post has been edited by Tripredacus: 08 July 2009 - 07:55 PM
Reason for edit: added codebox tags


#84 User is offline   rgaspar 

  • Group: Members
  • Posts: 3
  • Joined: 31-January 07

  Posted 28 July 2008 - 09:03 PM

Hello,

This script in HTA not show radio button :(

 
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 :(

Thanks for help me....

This post has been edited by Tripredacus: 08 July 2009 - 07:56 PM
Reason for edit: Added Codebox tags


#85 User is offline   rgaspar 

  • Group: Members
  • Posts: 3
  • Joined: 31-January 07

Posted 31 July 2008 - 07:46 AM

Ok, nevermind
I found this solutions.

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

Thanks


View Postrgaspar, on Jul 28 2008, 10:03 PM, said:

Hello,

This script in HTA not show radio button :(

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 :(

Thanks for help me....


#86 User is offline   jalexander319 

  • Group: Members
  • Posts: 3
  • Joined: 08-August 08

Posted 08 August 2008 - 10:54 AM

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...

This post has been edited by jalexander319: 08 August 2008 - 03:31 PM


#87 User is offline   MichaelG 

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

Posted 21 August 2008 - 04:26 PM

this is an awesome utility but i need some help. i have couple of image with different file extension ( gho, wim, pqi). how can i get button once check use the appropiate radio button to use correct imaging software.

#88 User is offline   Stratuscaster 

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

Posted 24 October 2008 - 01:42 PM

View Postjalexander319, on Aug 8 2008, 11:54 AM, said:

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...

In our shop, we've modified the script to run a CMD file that includes the specific switch for that image, rather then reference the image itself.

Yes, it's an extra step to create that CMD for each image, but we require that degree of control.

#89 User is offline   peter@superit.com.au 

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

Posted 16 November 2008 - 01:07 AM

View Postgeezery, on Apr 12 2007, 04:23 PM, said:

It would be nice to have something similar to this made for imagex.


I have just found this really usefull work. Thanks for sharing it

#90 User is offline   KenKightly 

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

Posted 06 February 2009 - 02:08 PM

I have gotten a lot of use out of this script, and modified it heavily for my own use.
I really appreciate the work that’s been done here.

On that note, I would like to contribute to this group.

I have seen several posts where people have had issues using USB drives due to the nature of there dynamic allocation of a drive letter.

I have a script that will find the drive letter of your USB drive, and change it to the drive letter of your choice. I have created this so I can run this script from my USB drive with the drive letter assign as Z:.

There are a couple of prerequisites that need to be followed first. They have to do with the setup of the USB drive initially.

My USB drive has 2 partitions. The first partition is a 1GB partition that holds the boot files for WinPE. The second partition holds the script and image files, and is 460GB.

The 1st partition should be formatted as Fat32, and should be setup to boot your WinPE.
The following article is a good one for this. (hint look for creating a UFD boot disk)
http://technet.micro...y/cc709665.aspx

Once you have the WinPE boot created, format the second partition using NTFS, and label the volume IMAGE This is important because the script looks for this drive by its volume label and gets the drive letter.

The attached zip file contains 4 files.
startnet.bat (this is an example and should not be coppied to your winpe windows\system32 dir.)
getUSBLetter.bat (copy this to your WinPE windows\system32 directory)
chgletter.txt (copy this to your WinPE windows\system32 directory)
image.bat (copy this to your WinPE windows\system32 directory)

What are the scripts doing.

The first script is getUSBLetter.bat.

This script uses a filesystem object to look at all “hard disks” on your system, then find the volume with the label of “IMAGE” it also sets the drive letter in the variable USB, which can be used in scripts.

The second task of the script is to change the drive letter that it finds using diskpart. In my case I have a chgletter.txt file that I pass to diskpart that changes the %USB% to Z

The third part of the script is basically the same as the first, and queries the drive again and resets the variable USB to the new drive letter.

At the end of this bat file it calls image.bat file that will cd to the drive letter %USB% and starts the wizard.hta.

I am sure there are better ways to achieve this, but this works well for me, and I haven’t seen any post here to help those users who are looking for a solution.

I hope this is useful.

Ken.

Attached File(s)



#91 User is offline   falcon72 

  • Group: Members
  • Posts: 2
  • Joined: 01-July 09

Posted 08 July 2009 - 11:05 AM

Im using rdeploy for imaging and I have individual batch file for each of my images. How do I change this script to launch the the batch files instead. Thanks

Attached File(s)

  • Attached File  Image.JPG (37.82K)
    Number of downloads: 122


#92 User is offline   falcon72 

  • Group: Members
  • Posts: 2
  • Joined: 01-July 09

Posted 08 July 2009 - 01:51 PM

I figured it out after posting this so here it is incase any one needed.

'create imaging command line from button id
strTaskValue = Radio.Id & ".bat"

View Postfalcon72, on Jul 8 2009, 11:05 AM, said:

Im using rdeploy for imaging and I have individual batch file for each of my images. How do I change this script to launch the the batch files instead. Thanks


#93 User is offline   oemlife 

  • Group: Members
  • Posts: 1
  • Joined: 25-August 09

Posted 23 September 2009 - 09:34 PM

View PostKenKightly, on Feb 6 2009, 03:08 PM, said:

I have gotten a lot of use out of this script, and modified it heavily for my own use.
I really appreciate the work that’s been done here.

On that note, I would like to contribute to this group.

I have seen several posts where people have had issues using USB drives due to the nature of there dynamic allocation of a drive letter.

I have a script that will find the drive letter of your USB drive, and change it to the drive letter of your choice. I have created this so I can run this script from my USB drive with the drive letter assign as Z:.

There are a couple of prerequisites that need to be followed first. They have to do with the setup of the USB drive initially.

My USB drive has 2 partitions. The first partition is a 1GB partition that holds the boot files for WinPE. The second partition holds the script and image files, and is 460GB.

The 1st partition should be formatted as Fat32, and should be setup to boot your WinPE.
The following article is a good one for this. (hint look for creating a UFD boot disk)
http://technet.micro...y/cc709665.aspx

Once you have the WinPE boot created, format the second partition using NTFS, and label the volume IMAGE This is important because the script looks for this drive by its volume label and gets the drive letter.

The attached zip file contains 4 files.
startnet.bat (this is an example and should not be coppied to your winpe windows\system32 dir.)
getUSBLetter.bat (copy this to your WinPE windows\system32 directory)
chgletter.txt (copy this to your WinPE windows\system32 directory)
image.bat (copy this to your WinPE windows\system32 directory)

What are the scripts doing.

The first script is getUSBLetter.bat.

This script uses a filesystem object to look at all “hard disks” on your system, then find the volume with the label of “IMAGE” it also sets the drive letter in the variable USB, which can be used in scripts.

The second task of the script is to change the drive letter that it finds using diskpart. In my case I have a chgletter.txt file that I pass to diskpart that changes the %USB% to Z

The third part of the script is basically the same as the first, and queries the drive again and resets the variable USB to the new drive letter.

At the end of this bat file it calls image.bat file that will cd to the drive letter %USB% and starts the wizard.hta.

I am sure there are better ways to achieve this, but this works well for me, and I haven’t seen any post here to help those users who are looking for a solution.

I hope this is useful.

Ken.


DISCLAIMER:
This is my first post, please forgive me if I mess it up somehow. I'm also an amateur so my code sucks, but for me it gets the job done.

I faced a similar problem. I found that WinPE was assigning a different drive letter to the USB drive. The way I figured out which was my usb drive was to query WMI for drive sizes, since I know how big it is. I looked for a drive bigger than 10GB and smaller than 20GB. Fortunately this logic works in my environment. Another assumption is that there's only one drive that size plugged into the server. I have no idea what a for each loop would do if it found more than one. I don't imagine it can assign the value to the string multiple times.

 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_DiskDrive WHERE Size < 21474836480 AND Size > 10737418240",,48)

For Each objItem in colItems    
	strDID = (Right(objItem.DeviceID,1)) 


After I have the physical drive number assigned to the variable i dynamically generate my diskpart script to assign the usb drive letter to U:

I suppose it's ghetto, and I'm not sure why I don't just look for the actual byte count of the usb drive.

Edit:

I don't have the actual code with me at home. I'll see if I can post it tomorrow.

This post has been edited by oemlife: 23 September 2009 - 09:35 PM


#94 User is offline   slandsaw 

  • Group: Members
  • Posts: 1
  • Joined: 16-July 10
  • OS:none specified
  • Country: Country Flag

Posted 17 July 2010 - 09:40 AM

Awesome thread! Thanks to everyone who put in the effort. I'd like to share the html code that I use for the image details piece.


<html>

<head>
</head>

<table width=350 border="0">
<tr valign="top">
<td><Insert Computer Make/Model Here></td>
<td><Insert Image Creation Date Here></td>
</tr>
 
<tr valign="top">
<td><Insert Image Description Here></td>
<td>&nbsp;</td>
</tr>
 
<tr valign="top">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
 
<tr valign="top">
<td>Software</td>
<td>Version</td>
</tr>
 
<tr valign="top">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
 
<tr valign="top">
<td><software package # 1></td>
<td><software package # 1></td>
</tr>
 
<tr valign="top">
<td><software package # 2></td>
<td><software package # 2 version></td>
</tr>

<tr valign="top">
<td><software package # 3></td>
<td><software package # 3 version></td>
</tr>
 
<tr valign="top">
<td><software package # 4, etc.></td>
<td><software package # 4 version, etc.></td>
</tr>

<tr valign="top">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
 
<tr valign="top">
<td>Change Log</td
><td>&nbsp;</td>
</tr>
 
<tr valign="top">
<td><Insert Change Date Here></td>
<td><insert Change Log Entry Here></td>
</tr>

</table>

</body>

</html>




I think it would be cool to figure out a way to make this more "dynamic". In other words, just have one image details html file and have logic that would write specific details to the file. Maybe I'm overthinkin' it. :)

#95 User is offline   baza23 

  • Newbie
  • Group: Members
  • Posts: 32
  • Joined: 15-January 04

Posted 13 November 2010 - 05:54 AM

Very impressed by this was wondering will it work with WinPE 3.0?

#96 User is offline   Bumbastik 

  • Newbie
  • Group: Members
  • Posts: 26
  • Joined: 31-October 05

Posted 13 November 2010 - 03:27 PM

YES , i confirm that all work fine with WinPe 3.0 environment

Bye
AnyB.

#97 User is offline   rafael901 

  • Newbie
  • Group: Members
  • Posts: 10
  • Joined: 23-September 11
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 27 September 2011 - 06:56 AM

I attempted to run the wizard.hta but all I get is a box with nothing on it except the background and the buttons down at the bottom (Ghost, Quit, Reset App, ...etc) of the page which do not work. I have the z:\winpe directory with all my subdirectories inside it and all my shortcut links inside the subdirectories. Any help would be appreciated.

#98 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 7,353
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 27 September 2011 - 08:24 AM

Are you using WinPE 2.0? Some code changes may be needed for 3.0. Also, did you build your PE using the HTA and Scripting packages?

#99 User is offline   rafael901 

  • Newbie
  • Group: Members
  • Posts: 10
  • Joined: 23-September 11
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 27 September 2011 - 08:40 AM

I am using winpe 3.0 and I did load the HTA and scripting package into it.

#100 User is offline   rafael901 

  • Newbie
  • Group: Members
  • Posts: 10
  • Joined: 23-September 11
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 27 September 2011 - 11:10 AM

Now I have 2 all white boxes that pop up with nothing on them when I load the image. I have the HTA, Scripting, Legacy Setup packages added to the image. Does anybody know what code is changed in 3.0? Need Help to get this to work.

Thanks

Share this topic:


  • 6 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • You cannot start a new topic
  • You cannot reply to this topic

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



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