Jump to content

More Of A Ghost Question Than


DaGbyte

Recommended Posts

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

Link to comment
Share on other sites


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

--------------------------------------------------

Link to comment
Share on other sites

If you can run vbs scripts try these two:

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.

Link to comment
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.
×
×
  • Create New...