Jump to content











Photo
- - - - -

WinPE 3.0 BCD Question... DOS Options?!

pxe winpe bcd

  • Please log in to reply
11 replies to this topic

#1 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 29 May 2012 - 04:21 PM

Alright, I've looked around and cannot find a whole lot on this subject. Maybe because it isn't possible?

What's working:
Current environment has PXELINUX running in conjunction with WDS on a Server 08 R2 box. Currently I'm running a system discovery script in WinPE 3.0 applies necessary System Updates (BIOS, system device firmware) and saves a log to a network location. System then reboots to apply updates. After reboot I currently MANUALLY run system diagnostics via a DOS floppy image on my PXELINUX menu.

What I want/need:
I would like to reboot, load another WinPE instance, have it boot to diagnostics (BCD option from the WinPE WIM file with some sort of logic to know which step it is on??) and then when completed, immediately boot from DOS into WinPE and copy the log from diagnostics to the network and display a system summary screen with system specs and highlight any bad hardware found in diagnostics (this summary screen will be coded later).

If anyone has done anything like this before or has ANY ideas, let me know!

#2 Tripredacus

Tripredacus

    Frequent Member

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

Posted 29 May 2012 - 05:24 PM

I don't think a BCD entry can specify to boot off the network. So you can try using hidden partitions to store your DOS image.

Or maybe, (I don't know how PXELINUX works but you can do it in AD) is write a boot exception for that MAC Address (or NIC GUID), so the server gives up a different default boot option. Or maybe no option at all and it just boots to that.

#3 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 29 May 2012 - 06:26 PM

I don't think a BCD entry can specify to boot off the network. So you can try using hidden partitions to store your DOS image.


It would almost have to be done with a new partition but how to get it to complete diagnostics and then immediately bounce into WinPE may be a little tricky. Thanks for the input! Keep em' coming.

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 30 May 2012 - 08:10 AM

Any reason why you cannot have grub4dos as either a primary or secondary bootmanager? :unsure:

I.e. either of:
MBR->PBR->BOOTMGR->\boot\BCD->WindowsPE3
MBR->PBR->BOOTMGR->\boot\BCD->grldr.mbr->whatever
or:
MBR->PBR->grldr->BOOTMGR->\boot\BCD->WindowsPE3
MBR->PBR->grldr->whatever
or:

MBR->grldr->BOOTMGR->\boot\BCD->WindowsPE3
MBR->grldr->whatever

I am failing to see the need to "directly" load WinPE from DOS:

I would like to reboot, load another WinPE instance, have it boot to diagnostics (BCD option from the WinPE WIM file with some sort of logic to know which step it is on??) and then when completed, immediately boot from DOS into WinPE and copy the log from diagnostics to the network...

Can you post some more info on your intended setup?
But it is perfectly possible from "pure" DOS: you can load grub4dos' grub.exe, from which you can load *whatever*.

:cheers:
Wonko

#5 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 30 May 2012 - 02:27 PM

MBR->PBR->grldr->BOOTMGR->bootBCD->WindowsPE3
MBR->PBR->grldr->whatever
or:

MBR->grldr->BOOTMGR->bootBCD->WindowsPE3
MBR->grldr->whatever

I am failing to see the need to "directly" load WinPE from DOS:


Wonko, I think this is exaxtly what I am looking for. I'll have to find some tutorials and do a little trial and error but thanks! I think I can get everything setup and capture as a hard drive image (.img) and boot from PXELINUX. If you have any recommendations, please share.

I don't need to load WinPE from DOS I would like roll directly from DOS into WinPE without rebooting.

Essentially what I'm looking to do is boot the system to DOS, run an update that does not run in Windows then go directly into WinPE and run the rest of the system updates. What I'm wanting is to be able to access the partition that contains the DOS files which will have a log of the DOS update and append that to the other Update log from WinPE being saved to the network. Then I'd like to reboot the system, load WinPE run some system configuration tools which I have scripted, reboot the system one last time, boot into DOS and run system diagnostics and then load into WinPE one last time to display all results. Hope that clarifies. I already have a script within WinPE which records the step of the process to log file and starts running the next step after reboot. The only thing I can't get going is anything automated from DOS. As long as I can run the DOS utilities listed above and can access the partitions from WinPE to get the log files, I'll be good

Again, any additional information you can provide is much appreciated!!

Thanks!

Edited by llaub01, 30 May 2012 - 02:32 PM.


#6 Tripredacus

Tripredacus

    Frequent Member

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

Posted 30 May 2012 - 03:04 PM

It sounds like you could save a lot of time by getting rid of the DOS requirement. Just what are you trying to do in DOS that you can't do in WinPE?

#7 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 30 May 2012 - 06:30 PM

It sounds like you could save a lot of time by getting rid of the DOS requirement. Just what are you trying to do in DOS that you can't do in WinPE?


Direct access to hardware for certain firmware updates and system diagnostics. Believe me, I'd love to be rid of DOS.

#8 steve6375

steve6375

    Platinum Member

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

Posted 30 May 2012 - 10:07 PM

You need to return information from DOS so you will need DOS to have network access. Under DOS, this can be done with an NDIS driver but is very awkward to do. It is better to use the local hard disk if you can.

What I do is make a DOS partition on the hard disk and change the active partition to boot to that. The whole process goes like this:

1. Network boot via PXE (or boot from a USB Flash drive) to WinPE in RAM (must have all network drivers in the image)
2. Make a small partition at the END of the HDD and install WinPE onto that partition over the network (you can choose which image you want to install depending on user choice or h/w type)
3. Make the HDD WinPE partition bootable and reset the system
4. System boots quickly from HDD WinPE partition, loads n/w drivers (must have a selection of NIC drivers in the WinPE image) and now we can run any apps we want and leave results in a network file or database across the network
5. To run a DOS utility from a WinPE environment:
5.1 Create a small FAT ptn on the HDD using diskpart and make it bootable and active (I wrote a version of bootsect which will make a partition FreeDos bootable which runs under WinPE)
5.2 Copy over FreeDos files from the n/w to the DOS ptn + any payload files - e.g. flash files + batch files
5.3 reboot to FreeDOS ptn - run a flash utility via autoexec.bat and record results in a results.txt file on the local hard disk
5.4 make the HDD WinPE ptn active using a Dos utility
5.5 reboot - system boots from HDD WinPE ptn and gets results.txt left by the DOS session
5.6 delete HDD DOS ptn to keep things tidy
6. Repeat 5 for any more DOS utilities you want to run
7. Install Windows to the HDD (leaves WinPE ptn at the end of disk)
8. Can boot between the OS and the WinPE ptn now as many times as you like
9. Finally boot to OS and delete the WinPE ptn - now EXTEND all ptns on the HDD using diskpart, this will fail except for the last ptn which will be extended into the free space (or just leave the spare space at the end unused if you wish)
  • llaub01 likes this

#9 Tripredacus

Tripredacus

    Frequent Member

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

Posted 31 May 2012 - 02:16 PM

Direct access to hardware for certain firmware updates and system diagnostics. Believe me, I'd love to be rid of DOS.


I agree, we still use forms of DOS as well, but we structure everything so that we only use DOS at the beginning and not afterwards. We have one project that wants us to use DOS like you outline, but we just decide to not do it. :P

#10 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 31 May 2012 - 04:36 PM

You need to return information from DOS so you will need DOS to have network access. Under DOS, this can be done with an NDIS driver but is very awkward to do. It is better to use the local hard disk if you can.

What I do is make a DOS partition on the hard disk and change the active partition to boot to that. The whole process goes like this:

1. Network boot via PXE (or boot from a USB Flash drive) to WinPE in RAM (must have all network drivers in the image)
2. Make a small partition at the END of the HDD and install WinPE onto that partition over the network (you can choose which image you want to install depending on user choice or h/w type)
3. Make the HDD WinPE partition bootable and reset the system
4. System boots quickly from HDD WinPE partition, loads n/w drivers (must have a selection of NIC drivers in the WinPE image) and now we can run any apps we want and leave results in a network file or database across the network
5. To run a DOS utility from a WinPE environment:
5.1 Create a small FAT ptn on the HDD using diskpart and make it bootable and active (I wrote a version of bootsect which will make a partition FreeDos bootable which runs under WinPE)
5.2 Copy over FreeDos files from the n/w to the DOS ptn + any payload files - e.g. flash files + batch files
5.3 reboot to FreeDOS ptn - run a flash utility via autoexec.bat and record results in a results.txt file on the local hard disk
5.4 make the HDD WinPE ptn active using a Dos utility
5.5 reboot - system boots from HDD WinPE ptn and gets results.txt left by the DOS session
5.6 delete HDD DOS ptn to keep things tidy
6. Repeat 5 for any more DOS utilities you want to run
7. Install Windows to the HDD (leaves WinPE ptn at the end of disk)
8. Can boot between the OS and the WinPE ptn now as many times as you like
9. Finally boot to OS and delete the WinPE ptn - now EXTEND all ptns on the HDD using diskpart, this will fail except for the last ptn which will be extended into the free space (or just leave the spare space at the end unused if you wish)


This would be perfect and I've thought about doing something like this. Unfortunately, some systems I have going through this process do not have hard drives installed and systems with certain raid cards will not have a virtual disk created until later in the script. This is why I'm trying to stick with the WinPE RAM boot and would like it to boot DOS and then WinPE directly after so I can retrieve the log files. Very informative though. I think we're on the exact same page! :clap:

#11 steve6375

steve6375

    Platinum Member

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

Posted 31 May 2012 - 06:12 PM

Why not use a USB Flash drive then instead? You would need one for each system. Each one could have a WinPE ptn and room for the small DOS ptn. This has the advantage that you don't need to worry about DOS Network drivers and it is much less network traffic (and quicker) to boot from a local USB drive that via PXE each time.

The only other alternative I can think of is to use a PXE server as follows:

1. PXE Boot to WinPE and do WinPE stuff - when you need to boot to DOS...
2. Copy DOS menu file to pxelinux.cfg[MAC ADDRESS] and set up any other files as required (e.g. copy to a [MAC ADDRESS] folder)
3. Reset system
4. System PXE boots to DOS
5. System loads DOS n/w drivers
6. DOS script checks server for what to do - e.g. check S:[MAC ADDRESS]Actionfile.txt

In the action file is the instructions on what to do - e.g.
map network drive at [MAC ADDRESS] to T: and change to T:
run batch file yyy to flash BIOS or run diagnostic, etc.
file yyy is a script which does the required actions and puts the result back on the shared drive (S:[MAC ADDRESS]Result.txt

Note: This could be as simple as just running whatever Autoexec.bat file is found in the T:[MAC ADDRESS] folder once it is mapped.

7. Set next PXE boot for this MAC addess to WinPE (delete pxelinux.cfg[MAC ADDRESS] from the server - see below)
8. Reboot
9. PXE server gets request from MAC address xxxxxx and sends it the WinPE boot file
10. Target now boots to WinPE, gets results and decides on next action,
etc.

It is possible to control what image file is loaded for each MAC address by using a different pxelinux.cfg menu file. When pxelinux PXE TFTP starts, it normally looks for a config file (this is a menu file) in the following order: Note these are all menu FILES that it looks for in the pxelinux.cfg FOLDER in order until it finds one...

pxelinux.cfg/[xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxxxx] the GUID of the booting PXE client
pxelinux.cfg/01-00-23-54-58-32-6b the PXE client MAC address
pxelinux.cfg/C0A80105 the PXE client MAC address in hex
pxelinux.cfg/C0A8010 shortened MAC address
pxelinux.cfg/C0A801 even more shortened MAC address
etc.until and shorter...
pxelinux.cfg/default this is normal file that is loaded if no other match found

so all you have to do is copy a modified config file that boots automatically to DOS by default to the file called C0A80105 in the pxelinux.cfg folder (or whatever the client MAC address is) and on the next PXE boot that client will boot to DOS. Then under the DOS session, delete that file off the server, and on the next PXE boot that client will boot using pxelinux.cfg/default and boot to WinPE again.

#12 llaub01

llaub01
  • Members
  • 7 posts
  •  
    United States

Posted 23 July 2012 - 08:52 PM

Ok, I've successfully accomplished what I was trying to do (Thanks Wonko!!). Here is what I have:

MBR(Dell DOS)->grldr(via batch file in DOS)->BOOTMGR->bootBCD->WindowsPE3

This was all working on a hard drive so I created and IMG file and it is now bootable from PXELINUX. My problem is getting my DOS drives to show up when booting from PXELINUX. How can I carry these drives from DOS through GRUB into WinPE when booting PXE? When booting directly from the hard drive it shows up fine and I can view my diagnostic log files from WinPE but when booting from IMG over PXE I get nothing. Do I need to throw something into the GRUB's menu.lst or is it something with drivers in PE? /KEEPPXE is strictly for IP address, right? I have a feeling it's something simple but am having no luck.

Menu.lst uses the following to boot WinPE:

fallback 2
find --set-root --ignore-floppies /bootmgr
chainloader /bootmgr
savedefault --wait=2

Any information is appreciated!!





Also tagged with one or more of these keywords: pxe, winpe, bcd

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users