Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



keythom

WinPE 2.0 simple Ghost Menu HTA

Recommended Posts

weedy171    0

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"

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
weedy171    0
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.

Share this post


Link to post
Share on other sites
sinecure    0

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

Share this post


Link to post
Share on other sites
naclejoh    0

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.

Share this post


Link to post
Share on other sites
rgaspar    0

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

FoldersWizard.ppt

Edited by Tripredacus
added codebox tags

Share this post


Link to post
Share on other sites
rgaspar    0

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
Added Codebox tags

Share this post


Link to post
Share on other sites
rgaspar    0

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
MichaelG    0

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
KenKightly    0

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.

getusbletter.zip

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.

×