Copy everything from <html>
to </html>, save it as a .hta file you got yourself an
application. It can wipe
out your hardrive but there are a couple of warnings before that happens. It is made to run from Internet
Explorer within a customized Windows PE. It works with WAIK tools installed in
\system32 to capture and apply partition images to or from a network
share similiar to Ghost.
See the main documentation here.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Imaging w/WAIK</title>
<script language="vbscript">
<!-- Insert code, subroutines, and functions here -->
Sub Window_Onload
PleaseWaitMsg
Clock
DriveStatus
DiskPartListDisk
Ready2GoMsg
End Sub
Sub Clock
myClock.innerHtml = now()
End Sub
Sub PleaseWaitMsg
myStatus.innerHtml = "<h3
style=color:yellow>Please Wait - Loading</h3>"
End Sub
Sub Ready2GoMsg
myStatus.innerHtml = "<h3
style=color:green>Ready 2 Go !</h3>"
End Sub
Sub MappingMDriveMsg
myStatus.innerHtml = "<h3
style=color:orange>Please Wait - Mapping M:
Drive</h3>"
End Sub
Sub DriveStatus
strMsg =
"<table><tr><td>Drive:
</td><td>FileSystem:
</td><td>Size (GB):
</td>" & _
"<td>Freespace (GB):
</td><td>VolumeName:
</td></tr>"
On Error Resume Next
Set objWMIService = GetObject(
"winmgmts://./root/cimv2" )
Set colItems =
objWMIService.ExecQuery("Select * from Win32_LogicalDisk")
For Each objItem in colItems
strMsg
= strMsg & "<tr><td>"
& objItem.Name &
"</td><td>" & objItem.FileSystem
& "</td><td>" & _
FormatNumber ( 0.5 + ( objItem.Size / 1024^3 ) ) & "
</td><td>" & _
FormatNumber ( 0.5 + ( objItem.FreeSpace / 1024^3 ) ) & "
</td><td>" & _
objItem.VolumeName & "</td></tr>"
Next
strMsg = strMsg &
"</table>"
DataArea1.InnerHtml = strMsg
End Sub
Sub DiskPartListDisk
On Error Resume Next
Set objWMIService = GetObject(
"winmgmts://./root/cimv2" )
Set colItems =
objWMIService.ExecQuery("Select * from Win32_Diskdrive")
For Each objItem in colItems
strHtml2
= "" & _
strHtml2 & "Disk " & (Right(objItem.Name,1))
& " - " & _
FormatNumber ( 0.5 + (objItem.Size / 1024^3),2 ) & _
" GB, " & objItem.Model &
"</br>"
Next
DataArea2.InnerHtml =
strHtml2
End Sub
Sub UseFDrive
MappingMDriveMsg
On Error Resume Next
Set WshShell =
CreateObject("WScript.Shell")
WshShell.Run "cmd /c net use m:
/delete", 1, True
Set filesys =
CreateObject("Scripting.FileSystemObject")
If filesys.DriveExists("E:") Then
WshShell.Run "cmd /c subst m: E:\", 1, True
ElseIf filesys.DriveExists("F:") Then
WshShell.Run "cmd /c subst m: F:\", 1, True
Else MsgBox "Drive
Error"
End If
DriveStatus
MakeRadioButtons
Ready2GoMsg
End Sub
Sub MapMDrive
MappingMDriveMsg
On Error Resume Next
Set WshShell =
CreateObject("WScript.Shell")
WshShell.Run "cmd /c subst m: /d", 1,
True
mDrive = "M:"
strRemoteShare = PathnameArea.Value
strUsr = UsrnameArea.Value
strPas = PasswordArea.Value
Set objNetwork =
CreateObject("WScript.Network")
objNetwork.MapNetworkDrive mDrive,
strRemoteShare, "false", strUsr, strPas
If Err.Number <> 0 Then
MsgBox
"Mapping Failed - Err.Number = " & Err.Number
End If
DriveStatus
MakeRadioButtons
Ready2GoMsg
End Sub
Sub MakeRadioButtons
Set objFso =
CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder("M:\")
For each objFile in objFolder.Files
If
objFolder.Files.Count > 0 Then
If
UCase(objFSO.GetExtensionName(objFile.name)) = "WIM" Then
strHtml = strHtml & "<input type=radio
name=ImgName value=" _
& objFile.Name & ">" &
objFile.Name & " - " & Round(objFile.Size/1024/1024) _
& "MB - " & objFile.DateCreated &
"</br>"
DataArea3.InnerHtml = strHtml
End If
End If
Next
End Sub
Sub ApplyImageSubmit
ApplyImageHelp
For Each objButton in ImgName
If
objButton.Checked Then
strImgName = objButton.Value
End If
Next
intAnswer = Msgbox("This Will Wipe All Data From The Disk 0
!!! " & Chr(10) & _
"And Overwrite with image "
& strImgName & Chr(10) & _
"Continue?", vbYesNo, "WARNING !!!")
If intAnswer = vbYes Then
Dim
WshShell
Set
WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /c diskpart /s diskpart.txt", 1, True
DriveStatus
WshShell.Run "cmd /c imagex /apply
M:\" & strImgName
& " 1 W:", 1, True
WshShell.Run "cmd /c
X:\Windows\System32\bcdboot.exe
W:\Windows /s S:", 1, True
Else
MsgBox
"Image Will Not Be Applied To Disk 0"
End If
End Sub
Sub CaptureImage
MsgBox
"Is the M: drive connected?" & Chr(10) & "Is there
enough space?"
strCapDriveLetter = InputBox("Which Drive to capture?"
& Chr(10) & "Usually D or E",,"D")
strCapImgName = InputBox("Enter the Captured
Filename",,"SomethingDescriptive.wim")
Dim
WshShell
Set
WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /c imagex /capture " &
strCapDriveLetter & ": M:\" _
& strCapImgName & " " & strCapImgName
& " /compress fast /verify", 1, True
End Sub
Sub RunGImageX
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "GImageX.exe", 1, true
End Sub
Sub Notepad
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "NotePad.exe", 1, true
End Sub
Sub MapDriveHelp
MsgBox "This will map M: to a network
share for use as the image store" & Chr(10) & _
"It may take several seconds to run."
End Sub
Sub UseFDriveHelp
MsgBox "This is used to map a local
portable drive ""F:"" to ""M:"" for use as the image store." &
Chr(10) & _
"Do not use unless you booted from a
portable harddrive with sufficient free space" & Chr(10)
& _
"It must be NTFS, because of FAT's 2GB
file size limit."
End Sub
Sub ApplyImageHelp
MsgBox "This will repartition Disk 0,
ALL DATA WILL BE LOST!" & Chr(10) & Chr(10)& _
"Check the drive status on the left.
Make absolutely certain that Disk 0 is " & Chr(10) & _
"the correct drive to reimage. Check
the size & type of Disk 0. " & Chr(10) &
Chr(10) & _
"Make sure you have the correct image
from M: selected on the right " & Chr(10) & Chr(10)
& _
"As drive 0 is repartitioned, you will
see the drive letters change " & Chr(10) & _
"on the left to S: and W: , this is
normal" & Chr(10) & Chr(10) & _
"DOS windows will appear showing the
progress of each step."
End Sub
Sub CaptureImageHelp
MsgBox "This will capture a .wim image
of the partition/drive letter " & Chr(10) & _
"that you will choose by drive letter.
This should be the Windows 7 " & Chr(10) & _
"partition which will be usually going
to be either D: or E:. " & Chr(10) & Chr(10)& _
"The system/boot partition and the
recovery partition (if there is one)" & Chr(10) & _
"may take on the C: and D: drive
letters. Check the drive status on the left." & Chr(10)
& Chr(10) & _
"You will need to make sure that there
is enough room on the image store for " & Chr(10) & _
"the imagefile, usually 10-20 GB for a
fresh file system. " & Chr(10) & _
"Check the M: drive status on the
left."
End Sub
Sub RunGimageXHelp
MsgBox "GImageX is a third-party GUI for
Microsoft's WAIK tools, DISM & ImageX" & Chr(10)
& _
"It can be used instead of this system"
End Sub
Sub NotePadHelp
MsgBox "Do you really need help running
notepad? " _
& Chr(10) & "Maybe you
should just turn the power off "_
& Chr(10) & "and go take
a nap :)"
End Sub