Jump to content

Script startup BartPE


zbarre

Recommended Posts

I don't use CDs at my shop, we PXE/RIS boot instead, so my copy of BartPE runs over a gigabit network which is sooo sweet. The best part is I don't have to make a new CD every time I want to try a new build of BartPE I can just copy the files to the Windows Server 2003 server that's running RIS. Of course it takes some effort to get it working but it's very cool once it's setup.

I know this isn't practile for everyone as many PC's don't have NICs & BIOS that support PXE booting; although I bet your Dells do press F12 while booting one up and check the boot menu option for "Network" or "PXE" boot (if not check the BIOS and see if boot from network is enabled).

At any rate we need to find a solution for those admins that are still making shiny plastic coasters to boot from (aka bootable CD-ROMs). Did you try the .EXE I mentioned in this post earlier in our thread? http://www.msfn.org/board/index.php?s=&sho...ndpost&p=498574

I know you can add the SHUTDOWN.EXE command to the BartPE environment; however, this doesn't seem any better than telling Ghost to reboot when done because there is no Eject CD and Reboot option.

I just had a fresh thought on this subject (keep the laughter down), who says the CD has to be ejected immediately after Ghost/BartPE is done? Can't we just add a registry entry to eject the CD when Windows starts up the first time? The solution I am thinking of would go like this:

1.) When you Sysprep before making the original Ghost image file include the ejectcd.exe file in the Sysprep directory. Get this .exe from: http://www.alexnolan.net/software/commandline.htm

2.) Make a registry entry that calls the ejectcd.exe when the system first boots or use the cmdlines.txt file to run it.

You can add this registry entry from the CMD script you use to run Sysprep like so:

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" /v "EjectCD" /t REG_SZ /d "C:
\Sysprep\ejectcd.exe" /f

If you are familiar with cmdlines.txt with Sysprep this file would look like:

[Commands]
C:\Sysprep\ejectcd.exe

3.) Boot from BartPE CD

4.) Menu.bat runs from network share and allows user to choose the image to restore

(or maybe automate this using the SMBIOSD trick)

5.) Let Ghost reboot the computer when imaging is complete or have Ghost exit and then issue a

SHUTDOWN -R -F

6.) The newly imaged PC reboots and runs through mini-setup (I hope your using Sysprep before making your Ghost images to eliminate the duplicate side issue). According to this article it's even possible to make this entry in an .inf file used by unattended installs (I forgot about that) but for Ghost you will want to add the RunOnceEX registry key during the Sysprep process as previously discussed.

TIP: The RunOnceEX commands are processed before the user logs and are automatically deleted after they run. This should be perfect to automatically eject the CD-ROM! :D

So at this point the computer has been imaged with Ghost and the CD should eject right before the first reboot after mini-setup completes. Now I can't do anything if the BIOS trys to close the CD tray drawer during the shutdown or boot process (I know some BIOS do that, so tell your users to be fast to snatch the CD) :P

Of course, yet again I have done the brain work so it's up to those of you that still boot from the shiny, round coasters to test this out... :thumbup

Either I'm on a technical role or none of this cr*p I have suggested will work outside the wonderful world of theory... :rolleyes:

Link to comment
Share on other sites


Hi Indy,

It's nice to learn a lot of stuff from you lately. I am new to this BartPE stuff so I have learned a lot from your posts. Now, how do I make BartPE boots from PXE/RIS so that I can get rid of boot CD. Can you give me an idea of how to set this up? Thanks.

Link to comment
Share on other sites

Dje wrote> If the bartPE CD is still inside when rebooting, won't it reboot on BartPE again, preventing the next step to occurs?

Depends on the BIOS, most of the bootable CD-ROM's I have used over the last 10 years post a question like "Press any key to boot from CD..." if the BIOS has been directed to boot off CD first. I used to think this was a BIOS enabled feature, but I recently realized it's controlled by one of the startup files on the CD-ROM.

In PEBuilder there is a plug-in for this called "Boot Fix (Enabling "Press any key to boot from CD")"

post-93944-1146111892_thumb.png

If you enable this plug-in then when the PC boots from the BartPE CD you will see the "Press any key to boot from CD" message for like 3 seconds and if you don't press a key the PC will go one looking to boot from the next device according to the BIOS boot order. So this would be a good requirement of the RunOnceEX-EjectCD technique so BartPE would not automatically startup on the reboot after the mini-setup is complete.

I do agree it would be absolutely the best solution if BartPE had a shutdown option that ejected the CD as it's last command before restarting the PC and I may look into this further, but this is probably a long shot at best.

I am just wondering if anyone has tried to use the original suggestion to just call the ejectcd.exe from a BartPE enabled CD to see if this works? If it does this .EXE could be run before issuing the shutdown -r -f command, and then the RunOnceEX-EjectCD technique would not be needed.

The real question is anyone willing to do some testing on this??? :whistle:

Link to comment
Share on other sites

Hi Indy,

I have tried the method of issuing the command shutdown -r -f but it did not seem to work. The way the users in our compnay use the system is that they always assume from the BIOS setup, CD would be the first priority to boot. So, everytime they put the CD in, they don't have to worry about which key to select to boot from. This may lead to the problem when adding -rb switch to ghost to ask the system reboot after finished getting image. The system we have is automated so that when the user finished selecting the desired OS, they would walk away then come back, the machine should be ready for them. All the steps of booting up, join the domain, and others processes already automated. So, if CD is the first priority, then I have problem. If hard drive is the first priority, them my method of having switch -sure -rb after ghost32.exe works fine. As of booting up from PXE/RIS, I would like to know how that would work so that I can get rid of boot CD. Thanks again for your excellence posts. If you like, I would try to experiment all the methods you suggest. I have some pretty good automated ideas from the current company I am working now. Please let me knowabout the PXE/RIS so I can try this method.

Link to comment
Share on other sites

Hi Indy,

It's nice to learn a lot of stuff from you lately. I am new to this BartPE stuff so I have learned a lot from your posts. Now, how do I make BartPE boots from PXE/RIS so that I can get rid of boot CD. Can you give me an idea of how to set this up? Thanks.

A gentleman named Tom Speirs is where I got my first tips for this. He has two web pages dedicated to setting up BartPE to run off a Windows Server 2003 server running Remote Install Service (RIS). Tom has very recently posted a new page where he outlines how to integrate those Sneaky Driver Packs and some other major BartPE plug-ins to make an UPBE (Ultimate PXE BartPE Environment), that's my name for it anyway. Tom has a new site for this stuff: http://tomspeirs.co.uk/bartpeonris.htm and Tom has also been nice enough to leave up the original posted site that people like I used originally to get RIS+BartPE to work together: http://tomspeirs.co.uk/bartpeonris-old.htm

Microsoft also offers lots of documentation on getting WinPE (Windows PE) to run from an RIS server also; however, the original intent of RIS was for just remote installs not necesarily to launch PE environments. I think the guys at Microsoft really missed the boat on this one because running from a PE environment I can do regular RIS unattended installs, RIPREP installs, Ghost image installs, system diagnostics and troubleshooting, etc. where from plain RIS all I get is an unattended install that I have to keep a different RIS image for many different types of hardware (at least different mass storage controllers) which seems much more of a hassle than setting up a PXE boot PE environment. This is an opinion and I know somwhere there are probably a dozen RIS junky admins cussing this statement. So all I can say is na na naaa na naaa na :P (cause I prefer to use Ghost and Sysprep and restore images in under 10 minutes).

Requirements for this include:

1.) Client PC's that have a NIC and BIOS that supports PXE or Network boot option. (CHECK THIS FIRST)

2.) Full Administrator rights to a Windows Server 2003 server so you can install Remote Install Service (RIS)

3.) A good working knowledge of DHCP and domain admin permissions to be able to Authorize your DHCP server for RIS.

4.) If you will be trying to PXE boot across routers or subnets you'll need a working knowledge of putting "Helper" or "Hints" entries in your routers or some other clever technique to allow the PXE broadcast to find your RIS server across the WAN/Subnets/Routers etc.

5.) The Server 2003 CD-ROM or I386 files so you can install RIS.

or you can trade some of these requirements for...

1.) A private test domain controller (to run RIS and DHCP and have full domain admin rights too)

1.) A LOT OF PATIENCE

2.) AN INCREDIBLE DESIRE TO LEARN

3.) A LOT OF FREE TIME TO EXPERIMENT

4.) A strong set of Google skills (this is really the ultimate I.T. skill)

Link to comment
Share on other sites

Hi Indy,

I have tried the method of issuing the command shutdown -r -f but it did not seem to work. The way the users in our compnay use the system is that they always assume from the BIOS setup, CD would be the first priority to boot. So, everytime they put the CD in, they don't have to worry about which key to select to boot from. This may lead to the problem when adding -rb switch to ghost to ask the system reboot after finished getting image. The system we have is automated so that when the user finished selecting the desired OS, they would walk away then come back, the machine should be ready for them. All the steps of booting up, join the domain, and others processes already automated. So, if CD is the first priority, then I have problem. If hard drive is the first priority, them my method of having switch -sure -rb after ghost32.exe works fine. As of booting up from PXE/RIS, I would like to know how that would work so that I can get rid of boot CD. Thanks again for your excellence posts. If you like, I would try to experiment all the methods you suggest. I have some pretty good automated ideas from the current company I am working now. Please let me knowabout the PXE/RIS so I can try this method.

Sorry I didn't realize you had tried this technique out. Did the ejectcd.exe force the CD out of the tray while running BartPE? I mean before you issue the restart, something like:

Ghost32.exe blah blah restore image automatically blah blah
ejectcd.exe
shutdown -r -f

Did the CD tray actually eject?

Would the idea to include the "Press any key to boot from CD" be easy enough for your users? I just suggested this Bootfix plug-in in post #19 in this same thread. I think you haven't seen it yet. With this technique the user would only have to press any key to boot from CD initially (not a special key like F3000 or something), they could then walk away, and when the computer reboots after image creation no one will be in front of the PC to answer the boot from CD question the second time so Windows will run from the hard drive, calling the ejectcd.exe option from the RunOnceEX registry key, and if the CD tray opening by itself doesn't cause a user to jump out of their chair or call the help desk saying (this machine is possessed) then it will serve as a visual clue the machine has been completely rebuilt and is ready for the user to take the CD out of the open tray and login for the first time.

What do you think are we getting close on this solution? :)

Edited by indy_dba
Link to comment
Share on other sites

Hi Indy,

All of your ideas are vrey valuble. I have learned a lot since I joined this forum and read all of your recent posts. The idea of having user press any key to boot from CD is very cool. I think it is the best solution for the current environment I am working on right now. I will read that post about having users enter key as the system boot up and try it tomorrow. As of ejecting the CD, I included the eject.exe program to the bat file and it worked. But if the command after ghost.exe -sure -rb then the system would reboot without ejecting CD. If I put the eject.exe before ghost.exe then ghost won't execute after the cd is ejected. So, they can only work one or another, not both. So, I think having user enter key when booting up from CD is the best solution right now. I will try this tomorrow and let you know about this. Thanks again. About BartPE with PXE/RIS, I will try to learn about this from the site you recommend.

Link to comment
Share on other sites

Hi Indy,

All of your ideas are vrey valuble. I have learned a lot since I joined this forum and read all of your recent posts. The idea of having user press any key to boot from CD is very cool. I think it is the best solution for the current environment I am working on right now. I will read that post about having users enter key as the system boot up and try it tomorrow. As of ejecting the CD, I included the eject.exe program to the bat file and it worked. But if the command after ghost.exe -sure -rb then the system would reboot without ejecting CD. If I put the eject.exe before ghost.exe then ghost won't execute after the cd is ejected. So, they can only work one or another, not both. So, I think having user enter key when booting up from CD is the best solution right now. I will try this tomorrow and let you know about this. Thanks again. About BartPE with PXE/RIS, I will try to learn about this from the site you recommend.

I just want to make sure you understand my thought on this, DON'T use Ghost to perform the reboot... instead let Ghost finish and return to the .BAT file you ran it from and then run the ejectcd.exe followed by shutdown.exe -r -f.

An example section of the .BAT file you use might look like:

ghost32.exe -fx -sure -quiet -clone (add syntax for your image)
ejectcd.exe
shutdown -r -f

Note: We did NOT use the -RB option in Ghost, so Ghost will run and gracefully exit and return control to the next line in our .BAT file which ejects the CD-ROM and finally restarts the system (using XP shutdown cmd).

Have you tried this? The only problem I can forsee is if the user has walked away and the BIOS sucks the CD-ROM tray closed then BartPE is going to boot again, so perhaps the Bootfix "Press any key to boot CD" option is the best after all. However, the option menioned above is fine for admins & helpdesk that must wait on the image before leaving the PC being rebuilt, when the CD ejects they know they are done.

Link to comment
Share on other sites

Now, this bat file is located on the mapped drive on the network, right? I can put eject.exe on the same mapped drive and issues run it from the bat file. But what about shutdown -r -f ? Is it on the same mapped drive or it has to be build in with PEBuilder? This shutdown.exe can be found in C:\Windows\System32, right? The question is whether shutdown.exe can be execute after the CD is ejected if shutdown.exe is on the same mapped drive? i will try this method tomorrow and will let you know the result.

Link to comment
Share on other sites

It does look like someone once had written a couple utilities to EjectCD while BartPE was running or perform a Shutdown & Eject combo; however, I cannot read the language the downloads for this plug-in are on. Can anyone tell me if the actual files are on these web pages? http://www.bootcd.us/BartPE_Plugins_Author/dicht/

I can't read german either but I'd say it looks like the domain is down.

EDIT: I'm sorry. Against what I said before, I've just tried again peshuteject.exe and it worked !!!

peshuteject.exe /eject /reboot

The key was maybe that this time it was not on the BartPE CD but on a share.

So you could use it as well, either from a share or maybe copied to the RAM drive, or even on the HD, if it's in the ghost image.

BTW, you can get it from that archive. I found the link in this page.

Edited by Djé
Link to comment
Share on other sites

Now, this bat file is located on the mapped drive on the network, right? I can put eject.exe on the same mapped drive and issues run it from the bat file. But what about shutdown -r -f ? Is it on the same mapped drive or it has to be build in with PEBuilder? This shutdown.exe can be found in C:\Windows\System32, right? The question is whether shutdown.exe can be execute after the CD is ejected if shutdown.exe is on the same mapped drive? i will try this method tomorrow and will let you know the result.

Shutdown is an .EXE and yes it's normally found in the System32 directory; however, it should work fine no matter where you call it from because DOS looks for apps in the following order; current directory and if not found it searchs the locations in the PATH environment variable which includes System32 usually. Type SET PATH at a command prompt to see the list of directories DOS looks in to run programs.

So there is no reason this technique shouldn't work for you. The only possible gotcha would be if the PC automatically closes the CD tray during reboot. In that case call the ejectcd.exe from the RunOnceEX registry key and this should bypass this problem. Of course you original Ghost image needs to have this RunOnceEX key already included.

Link to comment
Share on other sites

The first two commands you recomended works fine. After finished getting image, ghost exited, system ejected CD but would not reboot. The problem here is that the bat file contains these commands is on the mapped drive, when CD is ejected it would not execute shutdown command. Is there any way we put this shutdown command somewhere else to make it execute? Is it posible to put in in RAM disk?

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...