ref http://ngs6428.pixnet.net/blog/post/6076343
http://technet.microsoft.com/zh-tw/library/dd125468.aspx#EHAA
http://technet.microsoft.com/en-us/library/cc709665%28WS.10%29.aspx
http://itsjustanotherlayer.com/
Vista 下的 Windows PE 2.0 光碟的製作,而現在 Windows 7 上市,相對應地也推出了 Windows PE 3.0 版本。
首先,我們必須下載安裝新版本的 Windows Automated Installation Kit (Windows AIK)。
Microsoft 下載中心 – Windows 7 的 Windows 自動化安裝套件 (AIK)
新的 Windows 7 的 Windows 自動化安裝套件 (AIK) 才能安裝、自訂以及部署 Microsoft Windows 7 和 Windows Server 2008 R2 系列的作業系統。
此外,也可以使用 Windows AIK 來自動化 Windows 安裝、使用 ImageX 擷取 Windows 影像、使用部署映像服務與管理 (DISM) 設定和修改影像、建立 Windows PE 影像,以及利用使用者狀態移轉工具 (USMT) 移轉使用者設定檔和資料。Windows AIK 還包括磁碟區啟用管理工具 (VAMT),讓 IT 專業人員可以使用多重啟用金鑰 (MAK) 自動化並集中管理磁碟區啟用程序。
支援的作業系統
* Windows 7
* Windows Server 2008
* Windows Server 2008 R2
* Windows Vista SP1
* Windows Server 2003 with Service Pack 2
請注意,此版本已不再支援 Windows XP 了!代表接下來的幾年,我可能同時要存在二套工具,一份處理 Windows XP,一份處理 Windows 7。
再安裝完 Windows AIK 後,接下來就直接實做,做一張 Windows PE 的開機光碟:
1. 依序點按「開始」→「所有程式」→「Microsoft Windows AIK」,再「部署工具命令提示字元」上按滑鼠右鍵,選擇「以系統管理員身分執行」。
2. 首先,建立支援建置 Windows PE 映像的必要目錄結構,輸入:copype.cmd x86 d:\winpe_x86
copype.cmd
可以是 x86、amd64 或 a64
是計劃使用的工具資料夾位置
3. 將基礎映像複製到工作資料夾的 ISO \ sources 子資料下,並重新命名為 Boot.wim。輸入:copy c:\winpe_x86\winpe.wim d:\winpe_x86\ISO\sources\boot.wim
4. 將 ImageX 新增至 Windows PE 映像中;輸入 copy “C:\program files\Windows AIK\Tools\x86\imagex.exe" d:\winpe_x86\iso\
copy “C:\program files\\Tools\\imagex.exe" C:\winpe_x86\iso\
可以是 Windows OPK 或 Windows AIK
可以是 x86、amd64 或 a64。
而 ImageX 是在部署案例過程中,用來擷取和套用映像的工具。
5. 建立可開機光碟,輸入 oscdimg -n -bD:\winpe_x86\etfsboot.com d:\winpe_x86\ISO d:\winpe_x86\winpe_x86.iso
6. 將映像 (.iso) 燒錄到 CD-ROM 或 DVD-ROM。
接下來我們可以使用它來開機,擷取和部署 Windows 7 了。
可是只有cmd console
Step 1: Set up a Windows PE Build Environment
In this step, you create a required directory structure that supports building a Windows PE image.
1. On your technician computer, click Start, point to All Programs, point to Windows OPK or Windows AIK, and then click Windows PE Tools Command Prompt.
The menu shortcut opens a Command Prompt window and automatically sets environment variables to point to all the necessary tools. By default, all tools are installed at C:\Program Files\version\Tools, where version can be Windows OPK or Windows AIK.
2. At the command prompt, run the Copype.cmd script. The script requires two arguments: hardware architecture and destination location. For example,
copype.cmd
where can be x86, amd64, or ia64 and is a path to the local directory. For example,
copype.cmd x86 c:\winpe_x86
The script creates the following directory structure and copies all the necessary files for that architecture. For example,
\winpe_x86
\winpe_x86\ISO
\winpe_x86\mount
Step 2: Mount the Base Windows PE Image
In this step, you mount the base image to a local directory so that you can add or remove packages.
* At the command prompt, mount the base Windows PE image (Winpe.wim) to the \Mount directory by using ImageX. For example,
imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount
Step 3: Add Additional Packages
By using the Peimg tool, you install Windows features by using the /install option. Windows features are included with the base image (Winpe.wim) but are not installed. You can also import packages and add drivers and language packs. For more information, see Windows PE Customization How-To Topics.
1. Add a Windows feature to the base image by using the peimg /install command. For example,
peimg /install= c:\winpe_x86\mount\Windows
where denotes the package name. A list of available packages and their names can be obtained by using the /list command. You can use wildcards to specify a package name. Any packages with matching names will be installed. For example,
peimg /install=WinPE-HTA-Package c:\winpe_x86\mount\Windows
-or-
peimg /install=*HTA* c:\winpe_x86\mount\Windows
where wildcards denote any package with HTA in the package name.
Windows PE 2.0 provides the following Windows features referred to as packages.
Package Name Description
WinPE-FONTSupport–Packages
Additional font support for ja-jp, ko-kr, zh-cn, zh-hk, and zh-tw.
WinPE-HTA-Package
HTML application support
WinPE-MDAC-Package
Microsoft Data Access Component support
WinPE-Scripting-Package
Windows Script Host support
WinPE-SRT-Package
Windows Recovery Environment component (available only on the Windows OPK)
WinPE-WMI-Packages
Windows Management Instrumentation (WMI) support
WinPE-XML-Package
Microsoft XML (MSXML) parser support
2. Repeat Step 1 for each package.
3. Verify that the packages were installed by using the peimg /list command to view all packages in the current image. For example,
peimg /list c:\winpe_x86\mount\Windows
In the INS column, (+) denotes installed packages and (-) denotes not installed.
Step 4: (Optional) Add Additional Customizations
This step is optional but recommended. You can add applications and scripts to your Windows PE image that you might need while working in Windows PE. The following is a list of common tools to include in your Windows PE image.
* ImageX
A command-line tool for capturing and applying images during deployment scenarios. For example, at a command prompt,
copy “c:\program files\\Tools\x86\imagex.exe” c:\winpe_x86\iso\
* Package Manager (Pkgmgr.exe)
A tool for servicing Windows image (.wim) files offline. You must copy the entire \Servicing folder and MSXML6 binaries. Offline servicing requires ImageX. For example,
xcopy “c:\program files\\Tools\\Servicing” c:\winpe_x86\iso\Servicing /s
copy %windir%\system32\msxml6*.dll c:\winpe_x86\iso\Servicing
where can be Windows OPK or Windows AIK and can be x86, amd64 or ia64. In both previous examples, the tools are not loaded into memory during a Windows PE RAM boot. The media must be available to access the tools.
To load the tools into memory along with Windows PE, copy the source files into the mounted \Windows directory. For example,
c:\winpe_x86\mount\Windows
ImportantImportant
Adding files to the \Windows directory will increase the size of your Windows PE RAM image. Ensure that your computer has sufficient memory to boot Windows PE and to run various applications.
Step 5: Prepare the Image
In this step, you prepare the image by using the peimg /prep command. This operation removes any non-installed packages from the final image. This operation reduces the overall image size. For example,
peimg /prep c:\winpe_x86\mount\Windows
The /prep option cannot be reverted, and after the /prep option is run, the /install, /uninstall, /import, and /list options will not function, while the /lang and /inf options will continue to function. The Peimg tool prompts you to confirm the command. To suppress this prompt for scripting, add the /f option.
Step 6: Commit Changes to the Image
In this step, you commit the changes to the original image file (Winpe.wim) by using the ImageX /unmount option with the /commit option. For example,
imagex /unmount c:\winpe_x86\mount /commit
Step 7: Replace the Default Boot.wim File
In this step, you replace the default Boot.wim in the \ISO directory with your new customized image. The image must be called Boot.wim. For example,
copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim
Next Step
You now have a customized Windows PE RAM disk image that you can place on bootable media, like a CD-ROM or a UFD.
To create a bootable CD-ROM
1. On your technician computer, at a command prompt, create an .iso file by using Oscdimg. For example,
oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso
For IA-64 architecture, replace Etfsboot.com with Efisys.bin.
2. Burn the image (Winpe_x86.iso) to a CD-ROM.
To create a bootable UFD
1. During a running Windows Vista operation system or a Windows PE session, insert your UFD device.
2. At a command prompt, use Diskpart to format the device as FAT32 spanning the entire device, setting the partition to active. For example,
diskpart
select disk 1
clean
create partition primary size=
select partition 1
active
format fs=fat32
assign
exit
where the value of disk 1 is equal to UFD.
3. On your technician computer, copy all the content in the \ISO directory to your UFD device. You can manually create the directory structure or use the xcopy command to automatically build and copy the appropriate files from your technician computer to your UFD device. For example,
xcopy c:\winpe_x86\iso\*.* /s /e /f f:\
where c is the letter of your technician computer hard disk and f is the letter of your UFD device.
You can further customize your Windows PE image by adding language packs, customized scripts, and drivers. For more information, see Windows PE Customization How-To Topics.
CustomEmulexWinPE.cmd – Run this to create a bootable ISO that will install the Emulex WinPE utilities & drivers and then attempt to upgrade the 10G CNA & LPe12000 cards in the system.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
call "C:\Program Files\Windows AIK\Tools\PETools\pesetenv.cmd"
call copype x86 EmulexWinPE
imagex /mountrw Winpe.wim 1 mount
mkdir mount\Emulex
xcopy "setupElxAll-x86.exe" mount\Emulex\
xcopy /s "Firmware" mount\Emulex\
del mount\Windows\System32\startnet.cmd
xcopy "startnet.cmd" mount\Windows\System32\startnet.cmd
peimg /prep mount\Windows
imagex /unmount mount /commit
copy winpe.wim ISO\sources\boot.wim
oscdimg -n -betfsboot.com ISO EmulexWinPE.iso
|
startnet.cmd – This runs on boot and will attempt to update the 10G CNA & the Emulex LPe12000 cards in the system.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
wpeinit
\Emulex\setupElxAll-x86.exe /q
cd "\Program Files\Emulex\Util\elxApp"
winlpcfg download a=lpe12000-m8 i=\emulex\lpe12000\ud111a5.all
winlpcfg download a=lpe12000-m8 i=\emulex\lpe12000\ub202a2.prg
winlpcfg download n=1 i=\emulex\oce10102\s1462001.ufi
winlpcfg download n=2 i=\emulex\oce10102\s1462001.ufi
winlpcfg download n=3 i=\emulex\oce10102\s1462001.ufi
winlpcfg download n=4 i=\emulex\oce10102\s1462001.ufi
winlpcfg listhba
winlpcfg listbios n=1
|
Once this script is done running you’ll have a EmulexWinPE.iso that you can mount and boot off of. It will automatically run and upgrade the firmware of the Emulex devices.
This basic setup should allow you to do anything scripting wise you need to do in a Windows environment to update the hardware configuration or run various diagnostics tests outside of ESXi.
Download Locations:
setupElxAll-x86.exe
Windows AIK
Emulex Firmware – Download as needed and update the location you copy it to your WinPE ISO file in the Startnet.cmd and in the CustomEmulexWinPE.cmd.
若用新版windows 7 xpe windows AIK
DISM replaces several Windows AIK tools including PEImg, Intlcfg, and Package Manager.
PEimg is not supported in Windows 7 WAIK.
run as administrator
call "C:\Program Files\Windows AIK\Tools\PETools\pesetenv.cmd"
call copype x86 EmulexWinPE
copy winpe.wim ISO\sources\boot.wim
Dism /Mount-Wim /WimFile:ISO\sources\boot.wim /index:1 /MountDir:mount
mkdir mount\Emulex
xcopy "setupElxAll-x86.exe" mount\Emulex\
xcopy /s "Firmware" mount\Emulex\
dism /unmount-Wim /mountDir:mount /Commit
oscdimg -n -betfsboot.com ISO EmulexWinPE.iso
|