[PR]子育てママさんへ:3年毎に15万円うけとれる保険?

The Microsoft Windows Preinstallation Edition (Windows PE) Guide for Serious Nerds


NEW Updated (a little): 7-23-03

This page will probably be moving soon. Bookmark www.NetAddiction.org to always be able to find this page.

The purpose of the page is to (hopefully) show you how to configure Windows PE with a shell and some useful tools to assist in the deployment of PCs. This document assumes a working knowledge of Windows XP and VMWare Workstation. I won' t be explaining what CHARMAP.EXE is or helping you install VMWare. It also assumes you are running Windows XP Pro to perform the process.

I will be updating the page as needed. Feel free to send me any useful Info/SFW Links/Hacks you may have (corrections too). If I include them I will give you credit. Send your submissions here.

Don't ask me for Windows PE. This guide is for legally licensed users only. Use at your own risk.

This guide covers version 1.0 (No SP1). I will try to update it for 1.1 at some point.

Getting Started

CD Build Tools

Windows Preinstallation Edition (Windows PE)
Microsoft says, “Microsoft Windows Preinstallation Environment (Windows PE) is a minimal operating system based on the Windows XP kernel. Windows PE functionally replaces DOS and contains the minimum functionality needed to run Windows Setup, scripts, or custom installation and imaging applications. With Windows PE you can automate the preinstallation of Windows to your workstations and servers.” If you are an OEM or Software Assurance customer you can get it from Microsoft otherwise you are out of luck (for now). I have read on the Internet that Windows PE is used to install the Longhorn BETA.

Windows XP Professional
Microsoft says, “Windows XP Professional delivers the new standard in reliability and performance. This operating system is designed for businesses of all sizes and for users who demand the most from their computing experience”.

NEW
Bart's PE Builder v2
For those of you that don't have access to the OEM WinPE this should allow you create a reasonable facsimile of the bootable WinPE CDROM (requires a Windows XP CD). It has a nice little menu system for WinPE. In order to use networking you will need some files from the OEM WinPE. If you do and it will support the Remote Desktop client too. He also has a great WindowsPE forum that I like to lurk on. Cmon Linux!

Update July 24 – Microsoft has AGAIN asked Bart to remove PE Builder (can they make up their mind?). Too bad Bart can't tell them to screw off. I don't think M$ has a legal leg to stand on here but they certainly have enough lawyers to make your life miserable. Someone might want to post how to build WinPE manually, for informational purposes only of course.

VMWare Workstation 4
It allows you to easily emulate an x86 PC. A great feature is the ability to assign a CDROM to an ISO image. I have been making extensive use of the it to test my ISO images before I burn them to CDROM. I highly recommend it for this sort of project. It's a great product.

NoteTab Lite
NoteTab is a leading-edge text and HTML editor. Winner of software industry awards since 1998, this application does it all: it easily handles a stack of huge files; lets you format text to your heart's content; does system-wide searches, and multi-line global replacements. It even corrects your spelling mistakes. Build document templates, add bookmarks, convert text to HTML on-the-fly, and take charge of your code. Use a simple, power-packed scripting language to create anything from a text macro to a mini-application

AutoIt
AutoIt is a freeware Windows automation language. It can be used to script most simple Windows-based tasks (great for PC rollouts or home automation).

ATool
A freeware tool to enhance AutoIt with graphical elements like radio buttons as well as other useful stuff.

7-Zip
7-Zip is an Open Source file archiver with SFX capability. They also claim to have the best compression ratio.

Building the WindowsPE CD

Phase One – Creating the Initial Development Environment
其の1、初期の開発環境を作る。

  1. Copy the WinPE directory from the Windows PE CDROM to C:\ (in our example)
    WinPEフォルダをC:\にコピー

  2. Create the following directories:
    3つのフォルダを作る。

    C:\WinPE\System32 – Will hold our OS tools(OS標準ツールを入れる。)
    C:\WinPE\SFW – Will hold our add-on tools(アドオンツールを入れる。)
    C:\WinPE\SFW\Scripts – Will hold our scripts
    (これから作るスクリプトを入れる)

  3. Copy the following files from your Windows XP installation to the C:\WinPE\System32 directory
    C:\WinPE\System32に以下のファイルをコピー

    append.exe

    freecell.exe

    label.exe

    replace.exe

    taskkill.exe

    attrib.exe

    fsutil.exe

    makecab.exe

    reset.exe

    tasklist.exe

    cacls.exe

    ftp.exe

    mem.exe

    route.exe

    taskman.exe

    calc.exe

    getuname.dll

    mshearts.exe

    routemon.exe

    telnet.exe

    cards.dll

    hostname.exe

    pathping.exe

    sc.exe

    tracert.exe

    charmap.exe

    htrn_jis.dll

    ping.exe

    shell32.dll

    winmine.exe

    expand.exe

    hypertrm.chm

    progman.exe

    smbios.exe


    fc.exe

    hypertrm.dll

    recover.exe

    sol.exe


    find.exe

    hypertrm.exe

    reg.exe

    spider.exe


    findstr.exe

    hypertrm.hlp

    regini.exe

    subst.exe


  4. Edit the MKIMG.CMD:
    MKIMG.CMDを編集

    Here is where we will be copying our additional components into the CD Image.


    Place the code between the bold text as shown below.

    echo Successfully created WinPE directory in %WINPEDESTDIR%
    )


    :: Begin
    echo.
    Echo.
    echo Copy any files that you want to add to %WINPEDESTDIR%
    echo.
    echo and then Press Any Key to continue
    pause>nul
    echo.
    echo Adding Other Support Files....
    xcopy .\sfw\*.* %WINPEDESTDIR%\Sfw /s /e /v /i
    xcopy .\system32\*.* %WINPEDESTDIR%\%PLATEXT%\System32 /s /e /v /i
    echo Done Adding Files....
    echo.
    :: End

    REM
    echo Copy the WinSxS directory also (for the time being)
    REM

  1. Create a script in C:\WinPE to automate MKIMG.CMD called BUILDIMG.CMD (G: is the CDROM Drive in this example)
    C:\WinPE に BUILDIMG.CMDと呼ばれるautomate MKIMG.CMD を作る

    IF Exist C:\WinPE_CDROM rd /s /q C:\WinPE_CDROM
    IF Exist C:\WinPE_CDROM.ISO del C:\WinPE_CDROM.ISO
    MKIMG.CMD G: C:\WinPE_CDROM C:\WinPE_CDROM.ISO

  2. Create a script in C:\WinPE that does nothing but create the ISO image called MakeImageOnly.cmd. This makes it easy to update the raw image without having to regenerate it each time.
    以下のスクリプトを作る。これはMakeImageOnly.cmdと呼ばれる物で毎回CDイメージを作る事をしなくて済むようにする。
    IF Exist C:\WinPE_CDROM.ISO del C:\WinPE_CDROM.ISO
    oscdimg.exe -n -betfsboot.com C:\WinPE_CDROM C:\WinPE_CDROM.ISO
    pause

  3. Insert your Windows XP Professional CDROM into drive G: (Your CD Drive)
    XPプロのCDを入れる。

  4. Run BUILDIMG.CMD and press a key when prompted (we aren't going to copy any additional files this way, this really for last second additions should you want to do that) .
    BUILDIMG.CMDを走らせる。

  5. Install VMWare and configure a Windows XP Professional virtual machine. Point the CDROM in the VM to the ISO image (C:\WinPE_CDROM.ISO). You don't have to use VMWare but it will require a lot of rebooting and re-burning. ;-)
    WINVMがあると作ったイメージをテストできます。


Phase Two – Setting up Program Manager
プログラムの組み込み方

This process is fairly straightforward if not repetitive and quite boring. You will be creating your program groups and icons for the few items we have available in the System32 directory. This will serve as an example on how to configure Program Manager for Windows PE. Later we'll be adding third party apps which you will probably want to create more icons for.
以下はprogmanをPEに登録する手順です。

  1. Open a Command Prompt
    コマンドプロンプトを開く

  2. Run SUBST W: C:\WinPE_CDROM

  3. Run CD /D W:\

  4. Run Progman.exe

  5. Select File -> New

  6. Select Common Program Group (always create Common program groups) and click OK.

  7. Enter Main in the Description field and click OK.

  8. Select File -> New

  9. Select Program Item and click OK.

  10. Create an icon for RegEdit:

    Note: Paths are ALWAYS relative to the ROOT

    Description: RegEdit
    Command Line: REGEDIT.EXE
    Working Directory: \I386\SYSTEM32

    Click OK

  11. Repeat as you see fit for the apps in \I386\SYSTEM32.

  12. Arrange your windows and icons.

  13. Select Options -> Save Settings Now
         

  14. Insert a floppy disk in drive A: 
                               

  15. Open RegEdit and Export the “HKEY_LOCAL_MACHINE\SOFTWARE\Program Groups” key to A:\Progman.Reg

  16. Copy A:\Progman.Reg to C:\WinPE_CDROM\SFW\Scripts

  17. Edit C:\WinPE_CDROM\I386\SYSTEM32\STARTNET.CMD

    regsvr32 /s netcfgx.dll
    factory -minint
    netcfg -v -winpe
    net start dhcp
    net start nla
    REM a:\floppy.cmd
    REGEDIT /S \SFW\SCRIPTS\PROGMAN.REG
    START /W PROGMAN.EXE

  18. At this point you may want to customize some of the installation files:

CONFIG.INF – You can customize the initial load screen with your own text. Look for the the line below:

loaderprompt=txtsetup.sif,setupdata,"Starting Windows XP Preinstallation Environment..."

Replace “Starting Windows XP Preinstallation Environment...” with your own text. Watch the line length.

WINPE.BMP – This the desktop wallpaper. Replace it with your own. It should be 800x600x24bit. Or delete it to save RAM.

  1. Run MakeImageOnly.cmd

  2. You should now have an ISO image of Windows PE running Program Manager

  3. Boot it in VMWare to test.

Phase Three – Tweaking the System
其の3、システムのカスタマイズ。
Change the Screen Resolution
Don't like the default 800x600 resolution? You don't have to put up with it! You can choose from at least 640x480 through 1280x1024 on the fly! (Assuming your hardware supports it)

  1. Download SetRes by Ian Sharpe at www.iansharpe.com

  2. Extract SetRes.exe to \SFW\SetRes
    \SFW\SetResに解凍する

  3. Create icons in Program Manager for each resolution:
    アイコンをプログラムマネージャに登録
    640x480 16bit Color - \SFW\SetRes\SetRes.exe h640 v480 b16
    800x600 16bit Color - \SFW\SetRes\SetRes.exe h800 v600 b16
    1024x768 16bit Color - \SFW\SetRes\SetRes.exe h1024 v768 b16
    1280x1024 16bit Color - \SFW\SetRes\SetRes.exe h1280 v1024 b16


Add a RAM Drive(RAMドライブを作る)
This has to done before you run MKIMG.CMD. Download the Microsoft Ramdisk.sys Sample Driver for Windows 2000 (Q257405) and install it per the Q article instructions in a Windows XP VM or on your machine. Set the drive letter to B:. The maximum size is 30.9MB.
これはMKIMG.CMDを実行する前にしなければならない。http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B257405
をダウンロード。
NEW If you'd like a better alternative (and no error) try the AR RAM Disk
or Christiaan Ghijselinck's RAMDisk (also based on the MS code). The basic instructions provided below should work with little modification for these products as well.

Note: If you do not have at least 192MB RAM the RAMDisk will probably not be created at runtime
メモリ192MB未満の場合うまくいかないかもよ。.

  1. RAMDRIVE.SYSC:\WinPE\DRIVERSにコピー

  2. RAMDISK.INFC:\WinPE\INFにコピー

  3. Regeditを開いてHKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Ramdisk to C:\WinPE\SFW\SCRIPTS\RAMDISK.REG をエクスポート。

  4. Using Load Hive in RegEdit load the C:\WinPE\SetupReg.hiv as HKEY_USERS\SetupRegHiv

  5. Edit C:\WinPE\SFW\SCRIPTS\RAMDISK.REG search and replace HKEY_LOCAL_MACHINE\SYSTEM for HKEY_USERS\SetupRegHiv and save the file.

  6. Run REGEDIT /S C:\WinPE\SFW\SCRIPTS\RAMDISK.REG (You can delete RAMDISK.REG or keep it)

  7. Using Unload Hive in RegEdit unload HKEY_USERS\SetupRegHiv

  8. The RAMDISK settings should now be in C:\WinPE\SetupReg.hiv

  9. Unfortunately there seems to be an issue (for me anyway). I get Incorrect Function when I try to use the RAMDisk. In order to get around the problem do the following:

    1. Create a text file at C:\WinPE\SFW\SCRIPTS\N.TXT containing N and a Carriage Return/Line Feed

    2. Add the following line to the beginning of the STARTNET.CMD

      FORMAT B: /FS:NTFS /V:RAMDisk < \SFW\N.TXT >NUL

  10. Run C:\WinPE\BUILDIMG.CMD



Add a Web Browserウェブブラウザーをインストール
This is great to download those last minute patches.

  1. Download K-Meleon from kmeleon.sourceforge.net

  2. Install it to the RAMDisk (B:\Browser)

  3. Make any adjustment you'd like (except the proxy, we deal with that later), save and exit.

  4. Use 7-Zip to compress the Browser directory and create a Console based self-extracting executable at C:\WinPE\SFW\Browser.exe

  5. I used AutoIt to create an EXE to take care of the logic to extract and run the Browser. I also added the touch of configuring a proxy (if necessary). The source code is here.

  6. Create an icon in Program Manager (See above)



NEW Virus Scanning
I use the console version of McAfee VirusScan 4.x.

  1. Apply the latest virus signatures from their site.

  2. Create the C:\WinPE\SFW\Scan32 directory and copy the following files into it:

avparam.dll

MCSCAN32.DLL

rwabs16.dll

SCAN.EXE

BOOTSCAN.EXE

MCTOOL.EXE

rwabs32.dll

SCANPM.EXE

CLEAN.DAT

MESSAGES.DAT

SCAN86.EXE


LICENSE.DAT

NAMES.DAT

SCAN.DAT




  1. Create an icon in Program Manager:

    Command-line:
    SCAN.EXE /ADL /ALL /ANALYZE /CLEAN /HTML B:\ScanReport.html /MANALYZE /PANALYZE /PROGRAM /SUB /UNZIP&PAUSE

    Working Directory:
    \SFW\SCAN32

    Read the Help provided by McAfee to determine the meaning of the switches.

NEW Defrag your Hard Drives (and floppies)
デフラグ
VoptXP is a good little defragger that has been around in one form or another for many years.

  1. Install VoptXP.

  2. Run it and configure it to your liking. You won't be able to change it in WinPE.

  3. Copy all the installation files to \SFW\VoptXP

  4. In addition, copy MSVBVM60.dll and msvcp60.dll from your System32 directory to \SFW\VoptXP

  5. Open REGEDIT and export “HKEY_LOCAL_MACHINE\SOFTWARE\Golden Bow Systems” to \SFW\VoptXP\Vopt.reg

  6. Add the following line to the beginning of STARTNET.CMD:

    REGEDIT /S \SFW\VoptXP\Vopt.reg

  7. Create an icon in Program Manager:

    Command-line:
    VoptXP.exe

    Working Directory:
    \SFW\VoptXP


Other Applications
Here are some of the other applications I have added to my disk. I will create installation instructions as I have time.

NetStatLive - NSL is a small, easy to use TCP/IP protocol monitor which can be used to see your exact throughput on both incoming and outgoing data - whether you're using a modem, cable modem, DSL, or even local network! NSL doesn't just stop there, it lets you see how quickly your data goes from your computer to another computer on the internet; it even will tell you how many other computers your data must go through to get there!

Servant Salamander - A small and fast two-pane file manager with open plug-in architecture. The ability to view content of files (text, html, over 40 picture formats, mp3), support for archives (zip, rar, arj, cab, tar/gzip, etc.) and intuitive user interface that is easier to learn and use, makes it widely popular substitute for Windows Explorer. Version 1.52 is FREE.

The Final Product

This is what I have so far.




Windows PE Files of InterestPEに含まれる興味深いファイル

STARTNET.CMD – This is the default shell. This is where the network gets started.

WINPESYS.INF – You can change the shell (UNTESTED). Look for the line below:
シェルを変える。(未確認)以下の太字に注目

HKLM,"Setup","CmdLine",,"cmd.exe /k startnet.cmd"

Replace, “cmd.exe /k startnet.cmd” with your shell of choice. Note that the path is relative to the \i386\system32 directory.

WPEMSCLI.INF – Here is where the services get defined. You can adjust the behavior of the installed services or add your own.

WPENB.INF – NetBIOS installation and configuration

WPETCPIP.INF – TCP/IP installation and configuration

SETUPREG.HIV – Contains some of the initial HKEY_LOCAL_MACHINE\SYSTEM keys. You can load it in REGEDIT and make additions/changes. They will be reflected in the CD that you build.


Credits

Written by Mark Melanson (AKA Jericho Jones)
Version: 1.1
Date: 7-22-03

Thanks to the following folks that emailed me with suggestions:
koszopal
Lang Murphy
J. Mlazovsky

All copyrights belong to their respective owners. No company has endorsed the use of their products for this project.

This page was written using OpenOffice.org 1.0 (Thank you Sun Microsystems!)

Last changed: 07/26/2003, 07:38:29

[Site Meter]

[PR]三井住友海上きらめき生命:医療保険のご案内と資料請求はこちらから