keythom

WinPE 2.0 simple Ghost Menu HTA

118 posts in this topic

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

post-249619-1247072717_thumb.jpg

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites
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.microsoft.com/en-us/library/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
0

Share this post


Link to post
Share on other sites

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> </td>
</tr>

<tr valign="top">
<td> </td>
<td> </td>
</tr>

<tr valign="top">
<td>Software</td>
<td>Version</td>
</tr>

<tr valign="top">
<td> </td>
<td> </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> </td>
<td> </td>
</tr>

<tr valign="top">
<td>Change Log</td
><td> </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. :)

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

I've not used this HTA before, but I know I had to make some VBScript changes in mine to work with WinPE 3.0. I'm not sure what would need to be changed in this one.

0

Share this post


Link to post
Share on other sites

Ok,

I just switched to winpe 2.0 instead of 3.0. But now I am getting the access denied problem when I call my .hta file from the mapped drive cmd.exe /c Mshta.exe z:\wizard.hta. Did anyone ever solve this problem? I do not want to use the X: system drive. I prefer to stick with the mapped network drive for editing purposes.

0

Share this post


Link to post
Share on other sites

I found the solution in another thread to the access denied problem but now I have an all white .hta file that comes up on my winpe image.

0

Share this post


Link to post
Share on other sites

You are likely battling network permissions. I never tried to run an HTA from a network share. Use a USB key (or WDS) to have your boot image on, so you can easily mount and edit it.

0

Share this post


Link to post
Share on other sites

I was able to get the .hta file to work over the network except for the information in my .htm files does not show up. I created the files using excel and saved them as html files in my ghost images directory. All the category buttons show up and the radio button show up but the information in the .htm files does not show up on the side when I click one of my radio buttons. It just give an script error message and asks if I would like to continue. Any ideas on what's wrong?

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.