Help - Search - Members - Calendar
Full Version: Script startup BartPE
MSFN Forums > Unattended Windows Discussion & Support > Windows PE
Pages: 1, 2

   
Google Internet Forums Unattended CD/DVD Guide
zbarre
Hello,

Is it possible to execute a .cmd script at the end of the startup of BartPE ?
If yes how can i do ?
Thanks for your help
p4ntb0y
I beleive you need to edit the winbom.ini file to start your CMD.

Bart did have a plugin to start the network automactically maybe you can use this to run your batch etc.

I am not sure about HTA support on Barts PE.

I have only had experince with WinPE.

Hope that helps if not try Barts Site.
indy_dba
zbarre wrote> Is it possible to execute a .cmd script at the end of the startup of BartPE ?

Yes it is I use BartPE from Server2003/RIS via PXE boot from server class machines. All I do is press F12 and I have the RIS .OSC screens fully automated to automatically login to RIS and run only BartPE (do you need anything more?)

Check the following plugin directory: pebuilder3110a\plugin\penetcfg and look for the penetcfg.ini You can edit this .ini file with your favorite text editor like Notepad. I have bolded the lines that are critical to fully automating Network startup in BartPE and the line you asked for in particular is shown at the bottom of the listing shown below.

pebuilder3110a\plugin\penetcfg\penetcfg.ini
[General]
AutoStartNet=Yes
PromptForProfile=No
ShowGUI=No
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[NetProfiles]
Dynamic IP Address (DHCP)= penetcfg-dhcp.ini
Static IP Address (Manual)= penetcfg-static.ini
Custom from A:\= a:\penetcfg.ini
Custom from C:\= c:\penetcfg.ini
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[NetID]
; ComputerName = CRS-PE
Workgroup = crs.yourdomain.com
PrimaryDNSSuffix = crs.yourdomain.com
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[FileSharing]
StartFileSharingService = No
; AdminAccount = Pierre
; AdminPassword = 123456
; AdminPassword = * (to be prompted for a password)
; AdminPassword = *
; ShareDriveRoots = Yes
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[NetAdapter1]
; SpeedAndDuplex = {10|100|1000},{Half|Full}
SpeedAndDuplex = Default (for default settings)
;SpeedAndDuplex = 1000,Full

EnableDHCP = Yes
UseStaticGateway = No
UseStaticDNS = No
UseStaticWINS = No

;IPAddress = 192.168.75.2,192.168.75.3
;SubnetMask = 255.255.255.0,255.255.255.0
;DefaultGateway = 192.168.75.230
;DNSServer = 192.168.75.200,192.168.75.201,192.168.75.202
;WINSServer = 192.168.75.150

[NetAdapter2]
;SpeedAndDuplex = 1000,Full

EnableDHCP = Yes
UseStaticGateway = No
UseStaticDNS = No
UseStaticWINS = No
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; You can map up to 10 network drives: [NetDrive1] ... [NetDrive10];
[NetDrive1]
; Drive = x:
; Drive = * (to use the first available drive letter)
Drive = Z:
NetworkPath = \\Server\Path
UserName = Domain\Username
; Password = (leave it empty to be prompted for a password)
Password = Userpassword

[NetDrive2]
;same syntax as NetDrive1 if you want to map more drives
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[PostNetAutoRun]
; StarupFlag = CommandLine

; StartupFlag is a bit field that can take the following values:
; 0 = run hidden and wait (00 00 00 00)
; 1 = run normal and wait (00 00 00 01)
; 2 = run hidden and don't wait (00 00 00 10)
; 3 = run normal and don't wait (00 00 00 11)

3 = z:\scripts\menu.bat

Just to claify there are other Netprofiles like "penetcfg-dhcp.ini" and "penetcfg.static.ini" but BartPE looks at the "penetcfg.ini" first and if you have the AutoStartNet=Yes and PromptForProfile=No and ShowGUI=No then BartPE will not look at the other NetProfiles and will opt to use whatever default settings you have made farther down in the penetcfg.ini file. Make sense? wacko.gif

A slick trick is to map a network drive using the NetDrive section then run the .CMD or .BAT file from a the network drive, this makes it real simple and quick to modify the .CMD file and try different options. My current Menu.Bat has options for running Ghost (with switches of my choosing), installing Server2003, using Diskpart to partition RAW disks and assign them the correct drive letters and format them, run McAfee A/V scans, etc. biggrin.gif

Hope this helps you out... thumbup.gif
zbarre
Thanks for your answers , i'll test it today and let you know
zbarre
It works well indy thks a lot
thesimpsons
Hi Indi,

Thanks for psoting. Can you please show me how to add the .bat script that will start ghost32 automatically right after BartPE bootup and connected to the network share then start the sripts? Thanks.
indy_dba
thesimpsons wrote > Thanks for posting. Can you please show me how to add the .bat script that will start ghost32 automatically right after BartPE bootup and connected to the network share then start the sripts? Thanks.

In my original post the NetDrive section of the pebuilder3110a\plugin\penetcfg\penetcfg.ini file is the key to automatically mapping drives. In the NetDrive section, shown below, simply change the NetworkPath and UserName to the correct information for your network. You can also choose the drive letter by modifying the Drive variable.

On my network I have the Z: drive mapped to an NT share and this is where I store and retrieve the Ghost image files and also where I run a custom .BAT file script that has many menu options.

TIP1: .CMD files are the same as .BAT files were in the DOS 6.x days and either file extension creates an executable command line program in XP or Server2003.

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; You can map up to 10 network drives: [NetDrive1] ... [NetDrive10];
[NetDrive1]
; Drive = x:
; Drive = * (to use the first available drive letter)
Drive = Z:
NetworkPath = \\Server\Path
UserName = Domain\Username
; Password = (leave it empty to be prompted for a password)
Password = Userpassword

[NetDrive2]
;same syntax as NetDrive1 if you want to map more drives

In my original post this .BAT file is called menu.bat and it's stored on a network drive, Z:\Scripts\menu.bat. The menu.bat file is run from the [PostNetAutoRun] section of the pebuilder3110a\plugin\penetcfg\penetcfg.ini file, see example below.

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[PostNetAutoRun]
; StarupFlag = CommandLine

; StartupFlag is a bit field that can take the following values:
; 0 = run hidden and wait (00 00 00 00)
; 1 = run normal and wait (00 00 00 01)
; 2 = run hidden and don't wait (00 00 00 10)
; 3 = run normal and don't wait (00 00 00 11)

3 = z:\scripts\menu.bat;

The menu.bat file just uses standard command line syntax (DOS) which is most likely beyond the scope of any discussion thread posting. This URL may help you with various commands: Microsoft Windows XP - Command-line reference

If you have setup the Ghost8 plugin in BartPE then you can call Ghost32.exe from a .BAT file by creating a file like my menu.bat and add the following line (the Ghost switches -FDSP -CNS -Z2 are optional) then you can put this .BAT file in the shared directory you are mapping too.

z:\scripts\menu.bat
"X:\Programs\ghost8\GHOST32.EXE" -FDSP -CNS -Z2

NOTE1: You could instead add the .BAT file to your BartPE CD and run it from there; however, it's much easier to modify and try different options by storing this file on a network share where you can quickly edit and run it without having to burn a new BartPE CD or modify the BartPE image on the RIS server. whistling.gif

TIP2: Ghost supports a large array or command line switches including the ability to fully automate creating and restoring image files (the -clone switch). The best way to learn about the syntax for these switches is to read the Ghost_ref_Guide.pdf particularly Appendix A titled "Command-line switches". If you Google the phrase (or click this link) ghost_ref_guide you will find this .PDF if you don't already have a copy of it.

So reviewing this example the pebuilder3110a\plugin\penetcfg\penetcfg.ini file has the Z: drive mapped in the [NetDrive1] section and the z:\scripts\menu.bat is ran from the [PostNetAutoRun] section automatically after TCP/IP is started up. The menu.bat file contains a line to run the Ghost32.exe app from the BartPE programs area (usually X:\Programs\Ghost8).

I hope this makes sense and answers your question. biggrin.gif
thesimpsons
Thank you very much for your post. i was able to amke this stuff works following your post. I have have something else in mind to get these steps automated. What is the best way to script if I have different type of Dell workstations and want to get the disired images based on the type of workstation? Thanks again.
indy_dba
thesimpsons wrote> What is the best way to script if I have different type of Dell workstations and want to get the disired images based on the type of workstation? Thanks again.

The only way I know to do this is to create a DOS menu using the Choice.exe command line utility and have one option for each type of workstation you are cloning. Each menu item would then call the appropriate Ghost32 command line that would be pointed to the correct .GHO file for that type of workstation.

Step 1) Edit the Custom.inf file in the pebuilder3110a\plugin\!custom directory adding the following section and line to the end of the file:

[SourceDisksFiles]
choice.exe=2

This will include the Choice.exe program and make it available for use when you rebuild BartPE. This file listens for the choice you make in the menu shown below.

Here is a shortened down version of the Menu.bat file I use. You can see in option 1 I call to another file, diskpart.bat, to handle this partitioning task; however, for option 2 I call Ghost directly. I just did this to keep complex functions like disk partitioning in their own reusable script in case I want to link it to another menu or something in the future.

:MAIN-MENU
CLS
ECHO.
ECHO.Ghost Imaging Menu
ECHO.-----------------------------------------------------
ECHO.
ECHO.1.) DISKPART (Disk0 / C:=32GB / D:=##, NTFS formated)
ECHO.2.) GHOST (-FDSP -FEMAX -CNS -Z2)
ECHO.3.) End Program.
ECHO.
CHOICE /C:123 /M "Enter your choice:" /N
ECHO.
IF ERRORLEVEL 3 GOTO END-OPTION
IF ERRORLEVEL 2 GOTO GHOST-OPTION
IF ERRORLEVEL 1 GOTO DISKPART-OPTION
GOTO MAIN-MENU

:DISKPART-OPTION
CALL diskpart-crs.bat
GOTO MAIN-MENU

:GHOST-OPTION
"X:\programs\ghost8\GHOST32.EXE" -FDSP -CNS -Z2 -FEMAX
GOTO MAIN-MENU

:END-OPTION
CLS
ECHO.
ECHO.Thank You for using the Ghost Imaging Menu!

TIP: You can only have 9 menu items in a single Choice.exe driven DOS menu; however, you can make the main menu call a secondary menu. So for example your first menu might be the hardware vendor like 1.) HP 2.) Dell 3.) AcmePC etc. then each of those would bring up a new menu with options for the specific models like 1.) Optiplex 170 2.) Preceision 360 3.) Latitude D600 etc.

If you want to automatically recognize the type of workstation and have Ghost run without any user input at all I don't have any help for you. I suppose you might be able to write or borrow some type of program that could read information from the BIOS to determine the model and then call the appropriate Ghost command that way, but this is something I have never done. blushing.gif

Seems like once I got to the point where I could press F12 to boot into BartPE with a DOS menu and then choose an option or two from a menu and have Ghost automatically restore the image to the computer was simple and quick enough to not justify the hours of programming it would take to do this any other way. I am all for automation so though so if you find a way to fully automate the Ghost restore by hardware brand/model please post it and let us know how you did it. biggrin.gif
thesimpsons
Hello Indy,
Thank you very much for your post again. I have learned a lot for your posts. There is actually a method that allow you to detemine they type of system you boot from. Have you ever heard of something called PCIScan? This program will allow you to scan the system and return with the value to detemine the system type. It will look for the vendor name and code. We can create a file with name and code...when pciscan run, it will compare the name and code then return with the system name. From here, the system will display the message like "You are using Dell280" then come up with menu that ask users to select the type of image they want to get...If you like I would love to discuss with you about this...Thanks again.
indy_dba
I have never used PCIScan before but I see Bart has a download link for it on this page http://www.nu2.nu/utils/
I tried to run it from XP but I don't think it can read through the HAL layer. If I get time I may try to run this from BartPE and see what it does. smile.gif
thesimpsons
PCIScan runs under DOS. Well, it will give you some information about the system, but you have to difine the values from another file so that it can give you the system type. It won't scan the hardware level as you indicated. Do you know what command or switch from ghost that will eject the CD after it finsh downloading the image and reboot the system? I know there is a switch that will do the reboot bot not the one that does the reject of the CD.
indy_dba
Well if PCIScan only runs from DOS I am not sure if it will run from BartPE or not (we'll just have to test it). I understand you have to do some work to create a system map file to translate the PCI vendor info into a more friendly name like Dell Optiplex GX520 or something...

Regarding the CD Eject method I don't have to do that because I normally PXE boot and run BartPE from the network, but I decided to do a quick search on Google found this utility (ejectcd.exe) http://www.alexnolan.net/software/commandline.htm for ejecting CD's from the Command Line, so I suppose you could add this to your BartPE build, then modify your .BAT file to do the following:
1.) Run Ghost (with command switches for auto-restoring the image you want)
2.) Run the CD Eject utility
3.) Use the Shutdown command (XP/2003 command) to restart the system; shutdown -r -f

You will have to include Shutdown.exe in your BartPE build. One way is by editing pebuilder3110a\plugin\!custom\Custom.inf and add the following line to the [SourceDiskFiles] section we created earlier in this post (to add Choice.exe). What we are doing here is telling BartPE to pull these files out of the I386 directory when PE Builder builds the BartPE files.

[SourceDisksFiles]
choice.exe=2
shutdown.exe=2

I haven't tried this out yet so I will leave the testing to you on this one... biggrin.gif
indy_dba
thesimpsons wrote> What is the best way to script if I have different type of Dell workstations and want to get the disired images based on the type of workstation? Thanks again.

Ok I saw another user post the same question about how to determine the model of computer from the command line so as to be able to automate driver and application installation so I decided to put some effort into it and here is what I came up with... Your going to love this it's too cool! cool.gif

Check my post here http://www.msfn.org/board/index.php?showto...9&#entry498859]
thesimpsons
Hi Indy,

That was an awsome works that you put up there. I will tell you the current environment that I am working in now. We have a QA lab that runs about 1000 Dell machines which has about 10 different models. The challenge is to come up with the ghost system that will allow users to boot with CD (BartPE), determine system type, come up with menu for OS type, from here user will select OS he/she wants and get ghost image. The system will automatically eject CD and reboot once it finished getting the image. We currently have this kind of system running under DOS boot disk combined with Perl script. The problem with DOS is that it takes too long to download the image when running ghost with DOS. With bartPE, I am able to get the image much faster with ghost32. That's the reason why I like to automate the system running with BartPE bootdisk. So far, I am able to make the sytem bootup and autmate all the steps to ghost. From here, I can select ghost images manually, getting the image and reboot the system automatically after the machine finished getting the image. I can't make the machine eject the CD right after it got the image then reboot. I can only either eject the CD or have the system reboot, but I can't do both. Any ideas how to achive this? How about the menu that allow users slect the OS type? Thanks.
indy_dba
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:
CODE
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:
CODE
[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
CODE
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! biggrin.gif

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) tongue.gif

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

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.gif
Djé
If the bartPE CD is still inside when rebooting, won't it reboot on BartPE again, preventing the next step to occurs?
thesimpsons
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.
indy_dba
QUOTE
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")"

Click to view attachment

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??? whistling.gif
thesimpsons
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.
indy_dba
QUOTE (thesimpsons @ Apr 26 2006, 09:40 PM) *
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 tongue.gif (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)
indy_dba
QUOTE (thesimpsons @ Apr 26 2006, 11:46 PM) *
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:
CODE
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? smile.gif
indy_dba
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/
thesimpsons
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.
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 12:36 AM) *
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:
CODE
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.
thesimpsons
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.
Djé
QUOTE (indy_dba @ Apr 27 2006, 06:31 AM) *
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 !!!
CODE
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.
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 01:33 AM) *
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.
thesimpsons
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?
Djé
I edited my post above: It works! (peshuteject.exe, of course)
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 03:09 PM) *
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?

If you modify the Custom plug-in in PEBuilder, as shown below, then the Shutdown.exe command will be automatically included in the BartPE System32 directory which is in the PATH environment variable so your .BAT file will find it correctly. Or you can just copy Shutdown.exe from an existing XP/2003 system to the network share directory where you run the .BAT file from. Either method should work. Also take a look at DJe's post #28 in this same thread.

CODE
Step 1) Edit the Custom.inf file in the pebuilder3110a\plugin\!custom directory adding the following section and line to the end of the file:

[SourceDisksFiles]
shutdown.exe=2

Thanks for testing this out, I was sure you could make these techniques work. I feel we have advanced unattended installs up another notch (maybe to the insane level) with these steps... Great work guys! thumbup.gif

QUOTE (Djé @ Apr 27 2006, 03:31 PM) *
I edited my post above: It works! (peshuteject.exe, of course)

GREAT JOB! Big thanks for finding the PE Shut & Eject Utility! I will have to play with this some day. (though it's hard to find the time to make shiny round coasters when you've set up PXE/RIS... tongue.gif ) You never know when this technique will come in handy!
Anyone buying me beer & pizza for this help? blushing.gif Just kidding...
thesimpsons
Do I have to put those into PEbuilder as a plugin or just put the execute file in the mapped drive and the command in the bat file? Thanks.

using peshuteject.exe can only eject CD but not reboot the system. Is /shut is the right switch?
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 04:12 PM) *
Do I have to put those into PEbuilder as a plugin or just put the execute file in the mapped drive and the command in the bat file? Thanks.

You can do either or both let me say this another way... If you modify the Custom.inf and rebuild your BartPE CD then Shutdown.exe will be available via the System32 directory OR you can copy the Shutdown.exe file to the directory you have the .BAT file in OR you can do both! It won't hurt if Shutdown.exe is in both places (but it's probably cleaner to add it through PEBuilder via Custom.inf) but maybe much faster to test with by just copying it to the network directory the .BAT file is in.

Either method will work and should get you the same result a workings SHUTDOWN -R -F command line utility! biggrin.gif
thesimpsons
I tried your method but it doesn't work.
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 04:20 PM) *
I tried your method but it doesn't work.

Can you be more descriptive, what exactly didn't work? Can you post the part of your .BAT file that didn't work?
Remember when running .EXE's from the network share you must specify the full path to them like so:
Z:\SHUTDOWN.EXE -R -F (where Z: is mapped to the directory the .BAT file is in)

TIP: The other alternative is to modify the PATH variable like so: SET PATH=%PATH%;Z:\ (I haven't tried this yet in BartPE I don't know for sure if BartPE supports the SET command) This method would allow you to run the SHUTDOWN command without specifiying the full path to it.
thesimpsons
Here is the bat file:
z:\ghost32.exe -fx -sure
z:\eject.exe
z:\shutdown.exe -r -f

Where Z is the mapped drive. As I looked into the directory I saw that X:\i386\system32 I noticed that shutdown.exe is in here. However, X drive is the CD drive, if the system eject the CD drive then the shutdown.exe won't execute. Even when I copied shutdown.exe to RAM drive which is B in this case, shutdown.exe still could not execute. I tried peshuteject.exe, the same result. System ejected CD but won't reboot. Any ideas? Thanks.
Djé
QUOTE (thesimpsons @ Apr 27 2006, 10:18 PM) *
using peshuteject.exe can only eject CD but not reboot the system. Is /shut is the right switch?

Here it DOES eject AND reboot using those switches:
CODE
peshuteject.exe /eject /reboot

if you specify the drive to eject it is even cleaner (otherwise it tries all drives down to z:):
CODE
peshuteject.exe /eject:x /reboot


Maybe allow it for a few seconds but most important, run it from somewhere else than the CD drive.
thesimpsons
It WORKS!!! Thanks a lot, guys. peshuteject.exe /eject:x /reboot works GREAT. Thanks again.
indy_dba
QUOTE (thesimpsons @ Apr 27 2006, 05:06 PM) *
It WORKS!!! Thanks a lot, guys. peshuteject.exe /eject:x /reboot works GREAT. Thanks again.

Good work again guys! I am so used to my BartPE being in RAM drive from the PXE boot that I forget when running from CD-ROM you need to run commands from it so it's like duhhhhhh on why Shutdown wouldn't work from the CD... I am a little blushing.gif about not remembering this...

I like the syntax of peshuteject.exe better anyway. Very cool stuff! cool.gif
peliROJO
QUOTE (indy_dba @ Apr 25 2006, 02:02 PM) *
[SourceDisksFiles]
choice.exe=2
shutdown.exe=2



Do the choice and shutdown files have to be added to BartPE somehow, or are they called up on a remote share? Also, what is the reason for "=2" ?
indy_dba
QUOTE (peliROJO @ Apr 28 2006, 10:04 AM) *
QUOTE (indy_dba @ Apr 25 2006, 02:02 PM) *

[SourceDisksFiles]
choice.exe=2
shutdown.exe=2

Do the choice and shutdown files have to be added to BartPE somehow, or are they called up on a remote share? Also, what is the reason for "=2" ?

If you want these files available for use in a .BAT or .CMD script then you need to tell PEBuilder to include them when you make a BartPE build. The =2 tells PEBuilder to put them in the System32 directory if I remember correctly. See the "directories ID table" in the online help for BartPE at http://www.nu2.nu/pebuilder/help/english/p...inntDirectories
peliROJO
thanks for the link^

What I mean to ask is; Will pebuilder know where to grab these files or is there a directory that they must be in (that pebuilder looks in by default?)

--- well, i guess they would be on the source disk, and that is needed everytime you "Build" with pebuilder. so maybe that's the answer.---
indy_dba
QUOTE (peliROJO @ Apr 28 2006, 02:05 PM) *
thanks for the link^

What I mean to ask is; Will pebuilder know where to grab these files or is there a directory that they must be in (that pebuilder looks in by default?)

--- well, i guess they would be on the source disk, and that is needed everytime you "Build" with pebuilder. so maybe that's the answer.---

Correct these files come from the I386 directory from the source disk/directory and PEBuilder grabs them from there.
peliROJO
Thanks!
Djé
I just found why in some situations I couln't get peshuteject to work properly (it could eject but not reboot):
In those situations I was launching it by dble-clicking a .cmd file in the A43 file browser.
But if I just call the .cmd file from a CMD window, it works ok.
So it seems that to have peshuteject running properly, A43 should be closed. This may also be necesary with some other progs, beware.
pugsley42
Here's something I've been tearing my hair out over the last couple of days: Trying to get BartPE to eject the CD, pause, then reboot the PC. I have gotten this to somewhat work with peshuteject.exe, and was hoping for some help. To start with, I have a "reboot.cmd" file I created that will change directories to the RAM drive, release the IP, then reboot. Since peshuteject, I've modified it to read (B: is the RAMDRIVE):

=========================
b:
ipconfig /release
@echo off
copy %SystemDrive%\Programs\Reboot\peshuteject.exe b:\
b:\peshuteject.exe /eject:%systemdrive%
cls
@echo.
@echo.
@echo. Please remove BartPE from the drive and press SPACE to reboot
@echo.
@echo.
pause
b:\peshuteject.exe /reboot
=========================

I have the reboot.cmd file set to copy to the RAMDRIVE on bootup, and put the %ramdrv% in the PATH statement of pebuilder.inf so the reboot.cmd can be run from anywhere. When it fails, it hangs immediately after ejecting the CD. I can do the "peshuteject.exe /eject:%systemdrive% /reboot", but that doesn't give the tech enough time to remove the CD before the PC reboots and yanks it back in.

Help!
Method101
Sorry for digging up such an old thread, but its the best info Ive found...

My source disk doesnt contain choice.exe - how can I specify the custom.inf file to look in another location for it?

Or

Can I simply build an ISO image and then use an ISO image editor to add choice.exe to the i386\system32 directory later? (I have tried this, however when choice.exe is executed it appears to lock up, nothing happens. I havent tried copying choice.exe to the folder that contains the batch file, but from testing on my own (XP Build) machine I have found it wont work unless the file is called from the system32 directory - edit: also i have tried running choice.exe from the bart cd's system32 directory however it doesnt work)..

Any ideas? Thanks smile.gif
Method101
Ive been playing around with this choice.exe problem.

Choice.exe works when stored in the same directory as the batch file. The batch file executable commands had to contain the full path to choice.exe as I created a menu item in nu2menu.xml. So all my problems are solved. Sweet.
cuts
hello this thead has really helped me a lot. 2 days ago I was using dos/ghost8.exe now i'm using bartpe/ghost32 and able to use batch file with to automate the whole restore process.

Here is issue i'm having right now and it's probably simple but can't get it to work.

I would like to create a menu.bat that will launch and give users choice of which image to restore, I just need a simple batch file to this with echo commands. I ahve the batch file in that ini file, but when I bartpe finish mapping network drives, etc. I see the batch file appear and disappear real quick, so i'm not albe to see the menu, can anyone let me know what command to use, so the dos box does not disappear?

here is code i have

cls
@ECHO off
PROMPT
T:
cd T:\images\scripts
ECHO Enter appropriate PC type to image:

ECHO D530SP - SYSPREP for D530
ECHO ghost600 - SYSPREP for VL600
ECHO ghost600 - SYSPREP for VL400

ECHO 600 - VL600 std build
ECHO 400 - VL400 std build

ECHO farm600 - VL600 Farm Build
ECHO farm600 - VL400 Farm Build


Thanks for all your help, nuff respect.
uid0
All your script does is echo some text, that's why it closes quickly.

CODE
:_start
ECHO A D530
ECHO B VL600
SET /P Choice=Please select:
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
IF /I '%Choice%'=='A' GOTO _labelA
IF /I '%Choice%'=='B' GOTO _labelB
ECHO "%Choice%" is not valid.
ECHO.
GOTO _start

:_labelA
ghost32.exe ...
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.