Jump to content

Make_PE3 Program to Create Portable Windows 7 PE


wimb

Recommended Posts


Thanks for the Update,

I had also some problems with Make_PE3 with French language, here are some modification i made to the script Make_PE.au3:

missing & in the following msgbox

MsgBox(48, "ERROR - OverFlow on Target Drive", " Image Size = " & $BTIMGSize & " MB" & @CRLF _

& " Free Space = " & $TargetSpaceAvail & " MB" & @CRLF & @CRLF _

& " Skip Install of " & $image_file & " on Target " & $IMG_Path)

I added in the routine _w7_selfol for copying AIK tools to folder Make_PE3 first time

If Not FileExists($AIK_Tools & "\" & $PArch & "\imagex.exe") Then

MsgBox(48,"ERROR - File imagex.exe is missing ", $AIK_Tools & "\" & $PArch & "\imagex.exe is Missing " & @CRLF & @CRLF _

& "First Install AIK for Windows 7 ")

DisableMenus(0)

GUICtrlSetState($Win7_Select, $GUI_FOCUS)

Return

Endif

If Not FileExists(@ScriptDir & "\AIK_Tools\" & $PArch & "\imagex.exe") Then DirCopy($AIK_Tools & "\" & $PArch, @ScriptDir & "\AIK_Tools\" & $PArch, 1)

If Not FileExists(@ScriptDir & "\AIK_Tools\" & $PArch & "\imagex.exe") Then

MsgBox(48,"ERROR - File imagex.exe is missing ",
@ScriptDir & "\AIK_Tools\"
& $PArch & "\imagex.exe is Missing " & @CRLF & @CRLF _

& "First Install AIK for Windows 7 ")

DisableMenus(0)

GUICtrlSetState($Win7_Select, $GUI_FOCUS)

Return

Endif

few lines modified for allways use imagex from the folder Make_PE3\Aik_Tools. I use imagex from WAIK 2.0, because i have some issue with imagex from WAIK 3.0 and the last version takes too long

$val = RunWait(@ComSpec & " /c imagex.exe /unmount " & @ScriptDir & "\mnt7_inst >nul", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

;if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /unmount /mnt7_inst return with error code : " & $val)

$val = RunWait(@ComSpec & " /c imagex.exe /mount " & $WimSourceDrive & "\sources\install.wim 1 " & @ScriptDir & "\mnt7_inst", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /mount install.wim return with error code : " & $val)

$val = RunWait(@ComSpec & " /c imagex.exe /unmount " & @ScriptDir & "\mnt7_inst", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /unmount \mnt7_inst return with error code : " & $val)

$val = RunWait(@ComSpec & " /c imagex.exe /unmount " & @ScriptDir & "\mnt7_inst", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /unmount \mnt7_inst return with error code : " & $val)

$val = RunWait(@ComSpec & " /c imagex.exe /unmount " & $PEWork & "\mount >nul", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

;if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /unmount \mount return with error code : " & $val)

$val = RunWait(@ComSpec & " /c imagex.exe /mountrw " & $PEWork & "\ISO\sources\boot.wim 1 " & $PEWork & "\mount", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /mountrw boot.wim return with error code : " & $val)

$val= RunWait(@ComSpec & " /c imagex.exe /unmount /commit " & $PEWork & "\mount", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /unmount \mount return with error code : " & $val)

$val=RunWait(@ComSpec & " /c imagex.exe /export " & $PEWork & "\iso\sources\boot.wim 1 " & $PEWork & "\iso\sources\boot2.wim /compress maximum", @ScriptDir & "\AIK_Tools\" & $PArch, @SW_HIDE)

if $val <> 0 then MsgBox(48, "Error imagex", "Imagex /export boot.wim return with error code : " & $val)

_Aiklang Routine to detect the language of AIK. smaller change for winpe-wmi_ & AikLang

Global $Arch = @OSArch, $Lang = "en-US", $Timezone = "Pacific Standard Time", $DistLang = "en-US", $AikLang = "en-US"

Func _AikLang()

If FileExists($PETools & "\WinPE_FPs\en-US\winpe-wmi_en-us.cab") Then $AikLang = "en-US"

If FileExists($PETools & "\WinPE_FPs\ar-SA\winpe-wmi_ar-SA.cab") Then $AikLang = "ar-SA"

If FileExists($PETools & "\WinPE_FPs\bg-BG\winpe-wmi_bg-BG.cab") Then $AikLang = "bg-BG"

If FileExists($PETools & "\WinPE_FPs\cs-CZ\winpe-wmi_cs-CZ.cab") Then $AikLang = "cs-CZ"

If FileExists($PETools & "\WinPE_FPs\da-DK\winpe-wmi_da-DK.cab") Then $AikLang = "da-DK"

If FileExists($PETools & "\WinPE_FPs\de-DE\winpe-wmi_de-DE.cab") Then $AikLang = "de-DE"

If FileExists($PETools & "\WinPE_FPs\el-GR\winpe-wmi_el-GR.cab") Then $AikLang = "el-GR"

If FileExists($PETools & "\WinPE_FPs\es-ES\winpe-wmi_es-ES.cab") Then $AikLang = "es-ES"

If FileExists($PETools & "\WinPE_FPs\et-EE\winpe-wmi_et-EE.cab") Then $AikLang = "et-EE"

If FileExists($PETools & "\WinPE_FPs\fi-FI\winpe-wmi_fi-FI.cab") Then $AikLang = "fi-FI"

If FileExists($PETools & "\WinPE_FPs\fr-FR\winpe-wmi_fr-FR.cab") Then $AikLang = "fr-FR"

If FileExists($PETools & "\WinPE_FPs\he-IL\winpe-wmi_he-IL.cab") Then $AikLang = "he-IL"

If FileExists($PETools & "\WinPE_FPs\hr-HR\winpe-wmi_hr-HR.cab") Then $AikLang = "hr-HR"

If FileExists($PETools & "\WinPE_FPs\hu-HU\winpe-wmi_hu-HU.cab") Then $AikLang = "hu-HU"

If FileExists($PETools & "\WinPE_FPs\it-IT\winpe-wmi_it-IT.cab") Then $AikLang = "it-IT"

If FileExists($PETools & "\WinPE_FPs\ja-JP\winpe-wmi_ja-JP.cab") Then $AikLang = "ja-JP"

If FileExists($PETools & "\WinPE_FPs\ko-KR\winpe-wmi_ko-KR.cab") Then $AikLang = "ko-KR"

If FileExists($PETools & "\WinPE_FPs\lt-LT\winpe-wmi_lt-LT.cab") Then $AikLang = "lt-LT"

If FileExists($PETools & "\WinPE_FPs\lv-LV\winpe-wmi_lv-LV.cab") Then $AikLang = "lv-LV"

If FileExists($PETools & "\WinPE_FPs\nb-NO\winpe-wmi_nb-NO.cab") Then $AikLang = "nb-NO"

If FileExists($PETools & "\WinPE_FPs\nl-NL\winpe-wmi_nl-NL.cab") Then $AikLang = "nl-NL"

If FileExists($PETools & "\WinPE_FPs\pl-PL\winpe-wmi_pl-PL.cab") Then $AikLang = "pl-PL"

If FileExists($PETools & "\WinPE_FPs\pt-BR\winpe-wmi_pt-BR.cab") Then $AikLang = "pt-BR"

If FileExists($PETools & "\WinPE_FPs\pt-PT\winpe-wmi_pt-PT.cab") Then $AikLang = "pt-PT"

If FileExists($PETools & "\WinPE_FPs\ro-RO\winpe-wmi_ro-RO.cab") Then $AikLang = "ro-RO"

If FileExists($PETools & "\WinPE_FPs\ru-RU\winpe-wmi_ru-RU.cab") Then $AikLang = "ru-RU"

If FileExists($PETools & "\WinPE_FPs\sk-SK\winpe-wmi_sk-SK.cab") Then $AikLang = "sk-SK"

If FileExists($PETools & "\WinPE_FPs\sl-SI\winpe-wmi_sl-SI.cab") Then $AikLang = "sl-SI"

If FileExists($PETools & "\WinPE_FPs\sr-Latn-CS\winpe-wmi_sr-Latn-CS.cab") Then $AikLang = "sr-Latn-CS"

If FileExists($PETools & "\WinPE_FPs\sv-SE\winpe-wmi_sv-SE.cab") Then $AikLang = "sv-SE"

If FileExists($PETools & "\WinPE_FPs\th-TH\winpe-wmi_th-TH.cab") Then $AikLang = "th-TH"

If FileExists($PETools & "\WinPE_FPs\uk-UA\winpe-wmi_uk-UA.cab") Then $AikLang = "uk-UA"

If FileExists($PETools & "\WinPE_FPs\zh-CN\winpe-wmi_zh-CN.cab") Then $AikLang = "zh-CN"

If FileExists($PETools & "\WinPE_FPs\zh-HK\winpe-wmi_zh-HK.cab") Then $AikLang = "zh-HK"

If FileExists($PETools & "\WinPE_FPs\zh-TW\winpe-wmi_zh-TW.cab") Then $AikLang = "zh-TW"

EndFunc ;==> _AikLang

_AikLang()

Local $aik_files[5] = [$AIK_Tools & "\" & $PArch & "\Servicing\Dism.exe", $AIK_Tools & "\" & $PArch & "\imagex.exe", _

$PETools & "\WinPE_FPs\winpe-wmi.cab", $PETools & "\WinPE_FPs\" & $AikLang & "\winpe-wmi_" & $AikLang & ".cab", _

$AIK_Tools & "\" & $PArch & "\oscdimg.exe"]

_AikLang()

If FileExists($PETools & "\WinPE_FPs\" & $DistLang & "\winpe-wmi_" & $DistLang & ".cab") Then

_GUICtrlStatusBar_SetText($hStatus," Dism is Adding winpe-wmi_" & $DistLang & ".cab - wait .... ", 0)

$val = ShellExecuteWait('"' & $Dism & '"', "/image:" & $PEWork & "\mount /Add-Package /PackagePath:" & '"' & $PETools & "\WinPE_FPs\" & $DistLang & "\winpe-wmi_" & $DistLang & ".cab" & '"', "", "open", @SW_HIDE)

ElseIf FileExists($PETools & "\WinPE_FPs\" & $AikLang & "\winpe-wmi_" & $Lang & ".cab") Then

_GUICtrlStatusBar_SetText($hStatus," Dism is Adding winpe-wmi_" & $AikLang & ".cab - wait .... ", 0)

$val = ShellExecuteWait('"' & $Dism & '"', "/image:" & $PEWork & "\mount /Add-Package /PackagePath:" & '"' & $PETools & "\WinPE_FPs\" & $AikLang & "\winpe-wmi_" & $AikLang & ".cab" & '"', "", "open", @SW_HIDE)

Else

If FileExists($PETools & "\WinPE_FPs\en-us\winpe-wmi_en-us.cab") Then

_GUICtrlStatusBar_SetText($hStatus," Dism is Adding winpe-wmi_en-us.cab - wait .... ", 0)

$val = ShellExecuteWait('"' & $Dism & '"', "/image:" & $PEWork & "\mount /Add-Package /PackagePath:" & '"' & $PETools & "\WinPE_FPs\en-us\winpe-wmi_en-us.cab" & '"', "", "open", @SW_HIDE)

EndIf

EndIf

Here you can find the modified script to see my changes Make_PE3.au3

I am working on windows 7 x64, for working autoit i must compile the script in x64 version. Maybe it is nice to have the two versions in the package, Make_PE3_x86.exe and Make_PE3_x64.exe.

Thanks for all, it works well for me.

Edited by ChrisR
Link to comment
Share on other sites

@ChrisR

Thanks for your reply with feedback info and improvements for Make_PE3.au3

Allways using imagex from the folder Make_PE3\Aik_Tools is a good idea

since it offers to use a preferred imagex version.

_Aiklang Routine to detect the language of AIK is also a good improvement.

Then you are sure to find the right language version of winpe-wmi_DistLang.cab file.

The next version of Make_PE3 will be Updated accordingly.

The present version of Make_PE3.exe will run in both x32 and x64 OS environment.

I prefer to have one version of Make_PE3.exe instead of having a separate version for x64 OS.

I hope you can confirm that the present program is running in x64 OS.

By the way, have you made pe3_amd64.iso with Explorer Shell support

and is it working for you ? Is MMC working ?

May be some extra registry is needed to make pe3_amd64.iso working with Explorer Shell and MMC,

but I don't have at the moment access to x64 Windows 7

I am interested to know how to improve the PE3_reg\amd64 registry files.

Edited by wimb
Link to comment
Share on other sites

@Wimb,

My computer is a Windows 7 64 bit platetform and I use Make_PE3 with a source Windows 7 x86 (install.wim).

I prefer to build Make_PE3 with a x86 source for more compatibility.

Sorry, but I did not try to build pe3_amd64.iso to test and investigate Explorer Shell and MMC.

Make_PE3 script was complied using the 32bit compiler and work fine on 32 bit machines but fails to work on 64 bit machines (dircopy, filexist, ...)

I anderstand your choice to have only one version of Make_PE3, i test it, it doesn't work for 64bit machines.

I am not a specialist of autoit and I don't find a solution on internet to build an only version of Make_PE3 for the 2 platetforms.

I am at the beginning of my tests on Make_pe3, to work on a French version or other language, do i have to modified things in Optimize_explor.txt, Optimize_Profile.txt, WIN7_add_explor.txt, WIN7_add_files.txt

Example:

\windows\winsxs\manifests\x86_microsoft.windows.c..-controls.resources_6595b64144ccf1df_5.82.7600.16385_en-us_020378a8991bbcc2.manifest (exist)

\windows\winsxs\manifests\x86_microsoft.windows.c..-controls.resources_6595b64144ccf1df_5.82.7600.16385_fr-fr_a4864b8b8c14c4c9.manifest (exist)

\Windows\System32\en-US\accessibilitycpl.dll.mui (don't exist)

\Windows\System32\fr-FR\accessibilitycpl.dll.mui (exist)

...

Link to comment
Share on other sites

@Wimb,

Make_PE3 script was complied using the 32bit compiler and work fine on 32 bit machines but fails to work on 64 bit machines (dircopy, filexist, ...)

Is it only not functioning for dircopy or does the program not run at all in x64 OS ?

I will test again on x64 OS to look for errors ,but Make_PE3.exe was running in x64 OS environment.

I am at the beginning of my tests on Make_pe3, to work on a French version or other language, do i have to modified things in Optimize_explor.txt, Optimize_Profile.txt, WIN7_add_explor.txt, WIN7_add_files.txt

For other languages such as French, you don't have to modify WIN7_add_explor.txt, WIN7_add_files.txt

The program will detect the Distribution Language of the source and find the files as specified by using your DistLang.

The INCL Optimize files and EXCLude files PE3_del_files.txt and PE3_del_folders.txt are recorded and specified for en-US only.

So these files need to be adapted to the files present in your pe3_x86.iso

You can make and use as source a dirlist of all files and folders present in boot.wim

You can use manual commands like this:

imagex.exe /mountrw C:\winpe3_x86\ISO\sources\boot.wim 1 C:\winpe3_x86\mount

dir /ad /b /on /s >x86_Fol_boot.txt

dir /b /on /s >x86_Fil_boot.txt

imagex.exe /unmount C:\winpe3_x86\mount

Edited by wimb
Link to comment
Share on other sites

@ChrisR

There shouldn't be a problem with Make-PE3 under x64 OS.

A minor thing for your _AikLang() func:

$PETools is a local variable inside _Go_PE3() func, so all FileExists return failure.

$PETools may should be set as global variable, thought.

Link to comment
Share on other sites

@wimb

Is it only not functioning for dircopy or does the program not run at all in x64 OS ?

I will test again on x64 OS to look for errors ,but Make_PE3.exe was running in x64 OS environment.

the program Make_PE3.exe seems to work fine in x64 but some functions will not run properly (dircopy maybe other).

for example, files for Internet Explorer does not copy in the folder Make_PE3\PE3_mod\WIN7_add\x86\Program Files\Internet Explorer

@jfx_

yes i put $PETools in global variable

; Setting variables
Global $w7drive="C:", $TargetDrive="", $ProgressAll, $Paused, $g4d_vista=0, $mk_bcd=0, $ntfs_bs=1, $bs_valid=0, $PETools

Edited by ChrisR
Link to comment
Share on other sites

@wimb

For other languages such as French, you don't have to modify WIN7_add_explor.txt, WIN7_add_files.txt

The program will detect the Distribution Language of the source and find the files as specified by using your DistLang.

The INCL Optimize files and EXCLude files PE3_del_files.txt and PE3_del_folders.txt are recorded and specified for en-US only.

So these files need to be adapted to the files present in your pe3_x86.iso

OK, thanks for the tips

Edited by ChrisR
Link to comment
Share on other sites

will it work without need to install aik or opk if we put the files in scriptdir aik folder? also a directory that has packages in it can be usefull. forexample makepe3dir\WinPE_FPs\winpe-wmi.cab and makepe3dir\WinPE_FPs\??-??\winpe-wmi_en-us.cab. and packages that are with *.* not with exact names. it can integarate whatever package it find in that directory. users can select the packages and put which they need. prefer not to install all aik for it to work. can backup needed files from an installed aik and use later with makepe3

Edited by Kullenen_Ask
Link to comment
Share on other sites

yes i put $PETools in global variable

Yep, but at the time the func is called it's only local defined ;)

Local $PETools = $AIK_Tools & "\PETools\" & $Arch
_AikLang()

Link to comment
Share on other sites

Kullenen_Ask

will it work without need to install aik or opk if we put the files in scriptdir aik folder? also a directory that has packages in it can be usefull. forexample makepe3dir\WinPE_FPs\winpe-wmi.cab and makepe3dir\WinPE_FPs\??-??\winpe-wmi_en-us.cab

This interests me also with boot.wim from windows 7 source, it is ok for imagex, DISM ?

Link to comment
Share on other sites

it can work with boot.wim of setup dvd but there are 2 images in boot.wim. first image hasnt got boot flag. need export one of them. also it will have pre installed packages in it. need mount and delete setup packages in wim. after can be used like boot.wim fo aik. makepe3 can be modified to use setup dvd instead of aik. setupdvd has dism in it. it can be used intagrate packages. and wims has already integrated packages. people wont need to install aik then. build time can decrease because will not spend time for integrating packages. better for international support.

Edited by Kullenen_Ask
Link to comment
Share on other sites

will it work without need to install aik or opk if we put the files in scriptdir aik folder? also a directory that has packages in it can be usefull. forexample makepe3dir\WinPE_FPs\winpe-wmi.cab and makepe3dir\WinPE_FPs\??-??\winpe-wmi_en-us.cab. and packages that are with *.* not with exact names. it can integarate whatever package it find in that directory. users can select the packages and put which they need. prefer not to install all aik for it to work. can backup needed files from an installed aik and use later with makepe3

The PETools folder with the packages is almost 1 GB and is the main part of the AIK.

To collect just the needed packages requires at least once to Install the AIK.

I never tried to use the packages and Dism without having AIK installed.

It might work, but I don't think it is very usefull. It is not so handy anymore.

For Chinese, Japanese and Korean you need the large fontsupport packages.

The WAIK for Windows 7 is a free download available for everyone.

Not everyone has access to a Windows 7 setup DVD ....

Edited by wimb
Link to comment
Share on other sites

what about using setup dvd and boot.wim of it? only extra packages you will need is pppoe and wireless hotfix. post #102

i use dism without install from setup dvd. only problem is it should work from command line of its own folder.

Chinese, Japanese and Korean large fontsupport packages should be probably integrated in their boot.wim of setup dvd. same for other nations too.

Not everyone has access to a Windows 7 setup DVD .... :D

dont be funny. they can build from installed system but at least they need setup dvd to install that system.

if they can download 1gb aik they can download 2.5gb windows 7 enterprise trial too. more usefull

Edited by Kullenen_Ask
Link to comment
Share on other sites

what about using setup dvd and boot.wim of it? only extra packages you will need is pppoe and wireless hotfix. post #102

i use dism without install from setup dvd. only problem is it should work from command line of its own folder.

Chinese, Japanese and Korean large fontsupport packages should be probably integrated in their boot.wim of setup dvd. same for other nations too.

You will miss wmi package required to integrate WLAN hotfix with Dism.

Using Setup DVD only as source has disadvantage of extra time to mount install.wim

I think just downloading and install of WAIK of Windows 7 is most simple and effective solution for everyone available.

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