I'm using Ghost32 in Windows PE and need to preserve the label name on the image that is coming down. Any ideas? I cannot change the ghost image, but need the partition label name to stay the same, or allow mw to change it via Ghost.
-DaG
Page 1 of 1
More Of A Ghost Question Than
#2
Posted 03 March 2005 - 09:26 PM
Hi!
First do something like..
%COMSPEC% /C Dir [Drive you want to know the name] >[Path and file name to a writeable output file]
Read the drive label in the outputed file...
Do your ghost with a PLOAD (Partition load) instead of LOAD (Disk Load) and don't forget to specify the PLOAD format... src=[Disk or Image]:[Partition],dst=[Disk]:[Partition]
Then simply execute this command...
%COMSPEC% /C LABEL [Drive you want to name] [Name you want]
and this is it...
Hope this will help...
ShrimpyOne
P.S.: You can parse the output file with AutoIt (www.hiddensoft.com) or with WSH, and I think that with WSH 5.6 you can do the whole thing without output file!

--------------------------------------------------
Dim WshShell, oExec, input
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("test.bat")
input = ""
Do While True
If Not oExec.StdOut.AtEndOfStream Then
input = input & oExec.StdOut.Read(1)
If InStr(input, "Press any key") <> 0 Then Exit Do
End If
WScript.Sleep 100
Loop
oExec.StdIn.Write VbCrLf
Do While oExec.Status <> 1
WScript.Sleep 100
Loop
--------------------------------------------------
First do something like..
%COMSPEC% /C Dir [Drive you want to know the name] >[Path and file name to a writeable output file]
Read the drive label in the outputed file...
Do your ghost with a PLOAD (Partition load) instead of LOAD (Disk Load) and don't forget to specify the PLOAD format... src=[Disk or Image]:[Partition],dst=[Disk]:[Partition]
Then simply execute this command...
%COMSPEC% /C LABEL [Drive you want to name] [Name you want]
and this is it...
Hope this will help...
ShrimpyOne
P.S.: You can parse the output file with AutoIt (www.hiddensoft.com) or with WSH, and I think that with WSH 5.6 you can do the whole thing without output file!
--------------------------------------------------
Dim WshShell, oExec, input
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("test.bat")
input = ""
Do While True
If Not oExec.StdOut.AtEndOfStream Then
input = input & oExec.StdOut.Read(1)
If InStr(input, "Press any key") <> 0 Then Exit Do
End If
WScript.Sleep 100
Loop
oExec.StdIn.Write VbCrLf
Do While oExec.Status <> 1
WScript.Sleep 100
Loop
--------------------------------------------------
#3
Posted 04 March 2005 - 08:15 AM
If you can run vbs scripts try these two:
Get Volume Name:
Set Volume Name:
Put it together with Ghost in the middle:
I don't remember if Ghost32 automatically remounts the drive after ghosting or not. If not you will need to remount the volume after the ghost then let the last 4 lines run.
Get Volume Name:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk")
For Each objItem In colItems
WScript.Echo "VolumeName: " & objItem.VolumeName
Next
Set Volume Name:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk where DeviceID='C:'")
For Each objItem In colItems
objItem.VolumeName = "Drive C"
objItem.Put_
Next
Put it together with Ghost in the middle:
strComputer = "."
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk where DeviceID='C:'")
For Each objItem In colItems
VName=objItem.VolumeName
Next
WshShell.Run WshShell.CurrentDirectory & "\ghost\ghost32.exe -clone,mode=load,src=" & _
WshShell.CurrentDirectory & "image\gx110.gho,dst=1 -sure -fx -auto",1,true
For Each objItem In colItems
objItem.VolumeName = VName
objItem.Put_
Next
I don't remember if Ghost32 automatically remounts the drive after ghosting or not. If not you will need to remount the volume after the ghost then let the last 4 lines run.
Share this topic:
Page 1 of 1



Help
Back to top









