Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

WinPE 2.0 simple Ghost Menu HTA

- - - - -

  • Please log in to reply
117 replies to this topic

#76
weedy171

weedy171
  • Member
  • 8 posts
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"


How to remove advertisement from MSFN

#77
Stratuscaster

Stratuscaster

    Newbie

  • Member
  • 31 posts

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:
wpeutil reboot


#78
weedy171

weedy171
  • Member
  • 8 posts

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

#79
Guest_ArmBoy_*

Guest_ArmBoy_*
  • Guests
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 ;)

#80
sinecure

sinecure
  • Member
  • 3 posts
Thanks for a great tool, still getting a few errors but I'm sure I'll hash them out in a day or so.

Edited by sinecure, 28 April 2008 - 05:45 PM.


#81
sinecure

sinecure
  • Member
  • 3 posts
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.

Edited by sinecure, 27 May 2008 - 03:20 PM.


#82
naclejoh

naclejoh
  • Member
  • 1 posts
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
rgaspar

rgaspar
  • Member
  • 3 posts
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 Files


Edited by Tripredacus, 08 July 2009 - 07:55 PM.
added codebox tags


#84
rgaspar

rgaspar
  • Member
  • 3 posts
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....

Edited by Tripredacus, 08 July 2009 - 07:56 PM.
Added Codebox tags


#85
rgaspar

rgaspar
  • Member
  • 3 posts
Ok, nevermind
I found this solutions.

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

Thanks


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
jalexander319

jalexander319
  • Member
  • 3 posts
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...

Edited by jalexander319, 08 August 2008 - 03:31 PM.


#87
MichaelG

MichaelG
  • Member
  • 6 posts
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
Stratuscaster

Stratuscaster

    Newbie

  • Member
  • 31 posts

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
peter@superit.com.au

peter@superit.com.au
  • Member
  • 3 posts

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
KenKightly

KenKightly

    Newbie

  • Member
  • 15 posts
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 Files



#91
falcon72

falcon72
  • Member
  • 2 posts
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 Files



#92
falcon72

falcon72
  • Member
  • 2 posts
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"

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
oemlife

oemlife
  • Member
  • 1 posts

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.

Edited by oemlife, 23 September 2009 - 09:35 PM.


#94
slandsaw

slandsaw
  • Member
  • 1 posts
  • OS:none specified
  • Country: Country Flag
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
baza23

baza23

    Newbie

  • Member
  • 32 posts
Very impressed by this was wondering will it work with WinPE 3.0?

#96
Bumbastik

Bumbastik

    Newbie

  • Member
  • 32 posts
YES , i confirm that all work fine with WinPe 3.0 environment

Bye
AnyB.

#97
rafael901

rafael901

    Newbie

  • Member
  • 11 posts
  • OS:Windows 7 x86
  • Country: Country Flag
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
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,766 posts
  • OS:Server 2012
  • Country: Country Flag

Donator

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?
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#99
rafael901

rafael901

    Newbie

  • Member
  • 11 posts
  • OS:Windows 7 x86
  • Country: Country Flag
I am using winpe 3.0 and I did load the HTA and scripting package into it.

#100
rafael901

rafael901

    Newbie

  • Member
  • 11 posts
  • OS:Windows 7 x86
  • Country: Country Flag
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN