Jump to content











Photo
* * * * - 1 votes

winpe, diskpart, imagex


  • Please log in to reply
19 replies to this topic

#1 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 30 June 2012 - 09:11 PM

I am trying to build a recovery disk using winpe 3.0 /2.0 as the boot agent that automatically formats a disk partition (diskpart) and then populates the partition with a wim image that has been previously stored in a recovery partition (imagex) on the hd. I know the concept works manually, but I'd like to automate all the steps. Any suggestions?

btw.... tried winre, but it would only work if the wim was stored on an external storage device or cd/dvd. If someone knows how to modify winre to restore from a partition on the hd, that would work great.

Thanks much

#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 30 June 2012 - 11:37 PM

See tutorial #1 on my site. There is an example for an XP restore in section 4. For Vista/7/8 you don't need the bootsect command.
To sort out any boot issues I would suggest BCDBoot as a first step. Instead of the WinPE being on a boot stick, just put it on the first partition with the OS on the 2nd partition.
You can use a boot manager like grub4dos to present the user with a menu to boot to the OS or the WinPE partition (with a timeout if you like). You can even password protect the 'restore' menu option to prevent misuse. If the PE partition is type 27 then it won't be seen by the OS but you can still boot from it.

#3 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 01 July 2012 - 02:08 AM

Thanks for the reply steve6375, but.... I know how to do it "manually", what I need is to be able to do it "unattened" - at least after the initial boot from winpe.

The rest of the story.... these systems are ones that are built from donated parts and given to needy families (most of which have never had a computer before). They are not generally computer literate, so we are trying to simplify any restores that occur ... and I have to tell you, we have had to rebuild a bunch of them.

#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 01 July 2012 - 07:11 AM

But it tells you how to script it into a .cmd file. ????

Just call the .cmd file from windowssystem32startnet.cmd to make it autorun when PE boots and just format the C: drive instead of wiping it and creating new partitions.

So the end user sequence would be:
1. Switch on system
2. grub4dos menu appears for 2 seconds - user presses '1' to select Restore option (0 is boot to hard disk which will run on timeout if no key is pressed)
3. System boots to WinPE and starts the restore (use wpeutil reboot at the end of the script to reboot)
4. System reboots to new OS

You should have a simple grub4dos password too to prevent accidents (if a young kid presses '1' accidentally they will lose all their data!).

If yiu like I can write a Tutorial on how to set this up.

P.S. are these Win7 systems? What is the partition arrangement?


So you put WinPE on a partition (copy it from the USB stick made in my tutorial) and install grub4dos so it boots to it
0 = Boot to OS
1 = Boot to WInPE partition (Restore)

Then make a .cmd file (restore.cmd) which formats the OS drive, runs Imagex /apply. As grub4dos is the boot loader you don't need to bother with bootsect or bcdboot. When it is working as you want, edit the boot.wim file in the WinPE partition and add the call restore.cmd line to windowssystem32startnet.cmd.

#5 Uvais

Uvais

    Frequent Member

  • Advanced user
  • 180 posts

Posted 01 July 2012 - 01:46 PM

The rest of the story.... these systems are ones that are built from donated parts and given to needy families (most of which have never had a computer before). They are not generally computer literate, so we are trying to simplify any restores that occur ... and I have to tell you, we have had to rebuild a bunch of them.


Why Don't you Try this :dubbio:

http://reboot.pro/11317/

Edit : I already Tried this and it's Easy and fast :clap:

Edited by Uvais, 01 July 2012 - 01:47 PM.


#6 Uvais

Uvais

    Frequent Member

  • Advanced user
  • 180 posts

Posted 01 July 2012 - 01:51 PM

Or Something like this

http://reboot.pro/11763/

..it's actually same (you just need to edit ghost.bat) for easy Recovery Option and it's good ...Specially for noob ppls

Hope you Like.

..Uvais :good:

#7 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 01 July 2012 - 09:30 PM

I have written up an example here www.rmprepusb.com/tutorials/auto_restore - is this what you were looking for?
It restores an XP basic system in about 2 minutes.

#8 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 02 July 2012 - 12:06 AM

WOW..... steve6375, I can't believe that you put this together this fast. Actually it is a little different than what I was thinking, but it may be a better solution. I'm going to give it a try....

My concept was:
1. shrink the primary directory by 10gb
2. capture a imagex image of the system to the new directory
3. create a winpe boot disk (CD) with scripts to format the C: dir and apply the image (the scripting is what I didn't know how to do or automate)

Conceptually, the user would simply put the CD in, boot the system and indicate that a restore was necessary and the system would do the rest. No boot menu as such, just a Y or N answer to begin the process. Since the CD was seperate, I didn't see a problem of some small kid trying to run it.

I'm a little nervous with grub4dos only because we try to keep the systems pretty simple. Speaking of which: currently we are doing mostly XP refurbs, but Microsoft is forcing all of the refurb'ers to go to win 7 in the next year, so we as starting to experiment with it.

I see a lot of good ideas in your example and will try them to see if I can get it to work....if so, I'll make a pitch with the leader of our group to see if he buys it.

Thanks again....

#9 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 July 2012 - 07:00 AM

Well there is no reason why it cannot be on a DVD as well as on the HDD itself. Then if the whole HDD contents is lost they can use the DVD to restore it.

The DVD will also need a 'wipe hdd and partition and format HDD' option. The DVD could also look for the backup image on the D: drive and use that instead of the one on the DVD itself.

What I do is develop the DVD solution using a large (8GB+) USB Flash drive until I am happy with it and then make it into a bootable DVD. There are tutorials on my site to tell you how to make a DVD from a flash drive.

#10 Uvais

Uvais

    Frequent Member

  • Advanced user
  • 180 posts

Posted 02 July 2012 - 08:03 AM

I have written up an example here www.rmprepusb.com/tutorials/auto_restore - is this what you were looking for?
It restores an XP basic system in about 2 minutes.


Wow...it's looking interesting...i'll definitely Try :dubbio:

#11 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 02 July 2012 - 07:48 PM

Not sure how to "close" a thread.... but I have taken the advice of the members here and built a successful solution to the question. So, steve6375 or one of the members will give me a hand, this one is a wrap.

steve6375..... without your help I could have never figured out how to do this .... thanks a lot. If I was on that side of the "pond" I'd buy ya' a beer. Built both your solution and a modified one with my approach, not it is just an issue of clean up and getting acceptance from the leaders. Great website by the way. I got in there the other day to look at your tutorials and spent more time looking at them than your example.

Thanks again to all for your suggestions.....

#12 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 July 2012 - 08:49 PM

No problem. I found a typo in my menu.lst by the way which is now corrected in version 3 of AUTO_RESTORE.ZIP on my site. Hope it did not cause you a problem!

#13 Tripredacus

Tripredacus

    Frequent Member

  • Expert
  • 234 posts
  • Interests:K-Mart-ian Legend
  •  
    United States

Posted 13 July 2012 - 03:51 PM

Conceptually, the user would simply put the CD in, boot the system and indicate that a restore was necessary and the system would do the rest. No boot menu as such, just a Y or N answer to begin the process. Since the CD was seperate, I didn't see a problem of some small kid trying to run it.

I'm a little nervous with grub4dos only because we try to keep the systems pretty simple. Speaking of which: currently we are doing mostly XP refurbs, but Microsoft is forcing all of the refurb'ers to go to win 7 in the next year, so we as starting to experiment with it.


Since you already appear to be abiding by Microsoft policy, I'm going to have to kill your idea of creating a recovery disk for your customers.
1. You cannot redistribute imagex.exe
2. Only authorised replicators are allowed to create recovery media.

The only recovery you are allowed to make for the end-user/customer is hard disk based and not using imagex. So you can use WinRE for Windows 7, or use a third party tool like Acronis or SoftThinks for XP.

#14 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 13 July 2012 - 05:26 PM

So how does the hard disk recovery work? I thought system builders were allowed to use ImageX and WinPE as long as it is for a hard disk based recovery solution and is not for general use?
So you could use the standard MS Windows System Builder Recovery DVD to boot to WinPE and then kickstart the Recovery by running an app which launches the WinRE utility/script (assuming the Recovery partition is still there).
You could even provide a USB Flash drive which contains an AutoUnattend.xml file and a program or script. The xml file will automatically run when the Install DVD boots and direct WinPE to run a script on the USB flash drive which will attempt to locate Imagex and the backup wim on the hard drive and, if found, carry out a format and /apply?

#15 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 13 July 2012 - 08:37 PM

Steve, the process works with winpe and imagex with very minor tweaking of the sample scripts you created for me. One problem is getting winpe to use a real disk letter (not x:), but I have written a small "How to for the users" to show them how to change the drive letter.

WinRE will only work with external drives .... this would be the best solution because it fits into the MS model of recovery. Keep in mind that we are currently only using this for XP systems .... if it is turned on.

Trip.... you have raised a flag that I was not aware of. I can't find any information that says that we can't use imagex the way that is described. I will look again and deeper. We do not sell our systems, they are given to needy families that are directed to us by charitable organizations. Can you explain why you think this would not be legal.

As it turns we are in a holding pattern to make sure we can do what has been put together .... so any information would be appreciated.....

#16 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 13 July 2012 - 08:47 PM

%systemdrive% will be the winpe system drive letter. Can you explain the problem as there should be a simple solution to make it automatic?
When WinPE boots in RAM, the X: drive is the system drive.

P.S. How are these systems licensed and activated? If they are OEM systems (Dell, HP, etc.) then you should only use the original recovery media. If they are XP systems then the COA lable should be XP Pro, Vista Biz or Ult, or Win7 Pro or Ult to have rights to use XP Pro. If XP Home then they must have an XP Home COA.

#17 senile2

senile2

    Newbie

  • Members
  • 20 posts
  •  
    United States

Posted 13 July 2012 - 11:32 PM

ok... in a nut shell. creating a recovery partition is no problem, creating the winpe disk with your scripts embedded is no problem, but when the winpe disk is booted it opens up as x:. I have thought that it would be easiest to create the recovery partition as say r:, that didn't work in systems that had multiple driver letters already in use.

What I would like is the winpe disk boots and then changes the drive letter to the area that the imagex and your scripts are in so that all you have to do is type: recovery and the scripts will run. As it is now the winpe disk boots to x: then I have to do a change drive letter to say g: (or what every the cd drive is) and then execute the scripts.

As for the systems, they are all built with the coa from the box. Since most of our systems are donated the people that donate them want to be sure that there data is removed from the system so we DBAN the hard drives. This removes all data.....then the systems are rebuilt. Once they are rebuilt (much the same as if a hard drive were to crash), we need a way to allow the end user to rebuild the system if there is a problem.

Again, keep in mind .... none of this has been done yet. It is still in the testing stages and trying to make sure we are legal with what we are doing.

#18 steve6375

steve6375

    Platinum Member

  • Developer
  • 6731 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 14 July 2012 - 08:33 AM

You need to become a Microsoft Refurbisher. http://www.microsoft...bid=sEDIcYJMMZN
See the Licensing Guide for Refurbished PCs
for help. You have to use the original OEM Recovery CD/DVD and you cannot make your own Recovery media.
If you have the original Recovery DVDs then why do you need to make your own?
So I suggest you go with the on-disk Recovery and supply each system with the original OEM Recovery DVD.
When you say 'creating a WinPE disk' do you mean a WinPE Bootable CD or DVD?
Will the restore image still be on the hard disk or will it be on the DVD?
If the restore image is on the hard disk, then what good is the WinPE CD if they have wiped their hard disk or the hard disk is replaced?
You cannot replicate a WinPE CD/DVD or a full image Recovery CD/DVD.

You may be able to use the method I suggested to automate a restore from an image on the hard disk (i.e. use the original OEM DVD + a USB Flash drive with an AutoUnattend.xml if it is a Vista/Win7 Recovery DVD) - but I don't think it is worth it. You would have to supply the USB Flash drive and by the time they needed to restore the system, they would have lost it or wiped it!

So I would suggest a restore partition and a hard disk boot menu (as in my Tutorial #81 ) and the original OEM Recovery Media.

#19 flyboytim

flyboytim
  • Members
  • 5 posts
  •  
    United Kingdom

Posted 14 July 2012 - 11:53 AM

Dism.exe from Windows 8 now does everything imagex.exe does, at about the same speed, including capture and apply wim images.

http://technet.micro...y/hh825072.aspx
http://technet.micro...y/hh824910.aspx

Of course it is contained within the Windows 8 PE as well as Windows 8.

I am not sure about the status of distributing this file though.

#20 Tripredacus

Tripredacus

    Frequent Member

  • Expert
  • 234 posts
  • Interests:K-Mart-ian Legend
  •  
    United States

Posted 23 July 2012 - 02:52 PM

I thought system builders were allowed to use ImageX and WinPE as long as it is for a hard disk based recovery solution and is not for general use?


Yes, it used to be this way. The ability to redist Imagex (in any form) was removed via a policy update sometime last year... I want to say April. I haven't seen anything relating to DISM yet, but I doubt it will be restricted since it already comes with the OS.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users