Jump to content











Photo
- - - - -

Optimize (minimize) WinPE 3 and lots more...


  • Please log in to reply
13 replies to this topic

#1 allanf

allanf

    Gold Member

  • .script developer
  • 1256 posts

Posted 09 July 2011 - 02:00 PM

.

#2 Rui Paz

Rui Paz

    Frequent Member

  • Advanced user
  • 201 posts
  •  
    Portugal

Posted 09 July 2011 - 02:52 PM

Hi Allanf,

You script includes hard-coded paths like "C:\Users\John\Desktop\WIMTest\Optimize_Profile.txt" this will not work out of the box for other users.

Thanks for the script.

#3 peetx

peetx

    Newbie

  • Members
  • 10 posts

Posted 12 July 2011 - 08:45 PM

sounds realy interesting, that interesting that a wrapper would make sense, wouldn't it?

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 13 July 2011 - 04:17 PM

If I may, the batch may be (of course only slightly) optimized, the one thing I would suggest would be to remove the actual REM's and replace them with just :: (leaving the actual REM's only to those settings that need to be REMmed UNREMmed, so that it becomes more readable).
A nice tool (instead of the HTA) could be Wizard's Apprentice.
Why is checkver.vbs something we should manually build?
or we could change this:
REM Requires the following VB Script saved as CheckVer.vbs in the same

REM directory as this batch file. (Copy/paste, and remove the "REM"s.)

REM

REM Set objFSO = CreateObject("Scripting.FileSystemObject")

REM Wscript.Echo objFSO.GetFileVersion(wscript.arguments(0)
to:
ECHO Set objFSO = CreateObject("Scripting.FileSystemObject")>CheckVer.vbs

ECHO Wscript.Echo objFSO.GetFileVersion(wscript.arguments(0))>>CheckVer.vbs
and be done with it?

How is Optimize_Profile.txt originally generated?

What does this mean?

The encoding of the file is UCS-2 Little Endian.


:smiling9:
Wonko

#5 wimb

wimb

    Platinum Member

  • Developer
  • 2682 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 14 July 2011 - 04:36 AM

The following optimization file will bring the size of the winpe3.1 WIM file down to 39.5 MB (with only default=Fast/Xpress compression).

The size is impressive, but what is the functionality e.g. what Portable programs can run from PStart menu ?
It would be nice if you have some GUI support and that Filemanager as explorer++ or FreeCommander are working.
Also Disk Management and Ghost support for Imaging and Restore would be nice ....

After booting with this PE3, Is it possible to launch Setup and Format Target Drive and Install Windows 7 ?
Or can we make use of WinNTSetup2_x86.exe to prepare Target Drive for Install of Windows 7 ?

Can you give us some insight in the functionality ?

:cheers:

#6 wimb

wimb

    Platinum Member

  • Developer
  • 2682 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 14 July 2011 - 06:57 AM

DVD > boot.wim > setup.exe > install.wim > prepares Target Drive > Reboot > Install of Windows 7

Instead of DVD I can use 130 MB boot.wim of MINimal version made with Make_PE3 - pe3_x86_X.iso = 155 MB
so that I have BS Explorer Shell with GUI support - PStart - Ghost - 7-Zip - LAN - Device and Disk Management
(winsxs and Fonts reduced with PE3_del_folders.txt taking Keep_PE.txt into account - see folder Make_PE3\PE3_mod\Optimize\x86)

:cheers:

#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 14 July 2011 - 10:53 AM

@allanf
The :: should work everywhere BUT inside brackets, where a REM is needed anyway.
THe difference is that whilst the :: line is skipped, the REM one is parsed anyway, in a longish file with lots of comments this will slow execution in some cases noticeably.

I still don't get the whole "encoding" bit, it seems to me like what you posted are plain .txt files :cheers:, on the other hand IF a particular encoding is needed, it is pointless to post their contents as .txt ;) .

Why don't you attach them (as opposed to copy/paste)?

What about changing:
:: check required files

IF NOT EXIST "%HASHDEEP%" ECHO ERROR: "%HASHDEEP%" is missing.

IF NOT EXIST "%HASHDEEP%" GOTO :_end

IF NOT EXIST "%BASEWIM%" ECHO ERROR: "%BASEWIM%" is missing.

IF NOT EXIST "%BASEWIM%" GOTO :_end

IF NOT EXIST "%IMAGEX%" ECHO ERROR: "%IMAGEX%" is missing.

IF NOT EXIST "%IMAGEX%" GOTO :_end

IF NOT EXIST "%DISM%" ECHO ERROR: "%DISM%" is missing.

IF NOT EXIST "%DISM%" GOTO :_end

IF NOT EXIST "%OSCDIMG%" ECHO ERROR: "%OSCDIMG%" is missing.

IF NOT EXIST "%OSCDIMG%" GOTO :_end
to:
:: check required files

FOR %%A IN (

"%HASHDEEP%"

"%BASEWIM%"

"%IMAGEX%"

"%DISM%"

"%OSCDIMG%"

) DO  IF NOT EXIST %%A ECHO ERROR: %%A is missing!&SET missing=1

IF %missing%.==1. GOTO :_end
(this way you get a list of missing files on first run and it is easier to modify the list of required files)

:cheers:
Wonko

#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 14 July 2011 - 01:15 PM

I'll cleanup my previous posts and update them with your recommendations (if that's OK with you).

Sure ;) - as always - they fall under the provisions of my Careware license :cheers::
http://jaclaz.alterv...s/careware.html

:cheers:
Wonko

#9 wimb

wimb

    Platinum Member

  • Developer
  • 2682 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 15 July 2011 - 06:21 AM

The only real benefit of the batch was the optimization file generated.

Optimization Profile can also be generated with pe3_x86 type ISO made with Make_PE3 when NO Reduce Size is selected

Optimize and Reduce Size
The difference between 7pe and pe3
- 7pe is made without using AIK and is made from Recovery boot image winre.wim on Win 7 drive or from boot.wim on DVD
- pe3 is made using AIK for Win7 and is made from winpe.wim boot image present in AIK
- 7pe contains Recovery software in folder sources which is missing in pe3
- pe3 option NO Reduce of size has /Enable-profiling which allows to make Optimization profile (see WinPE.chm help in WAIK)
This filelist of all used files in PE is saved by command

wpeutil saveprofile E:\Optimize_Profile.txt "Image Optimization Profile"

Such optimization filelist of NEEDED files can be used to remove files from next build when you want to reduce size of the ISO.
But you need to do first all operations in PE that you want to use and keep .....


http://www.911cd.net...showtopic=23931

:thumbsup:

#10 wimb

wimb

    Platinum Member

  • Developer
  • 2682 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 15 July 2011 - 10:54 AM

I didn't know that your project used profiling. Thanks for the info.

Yes, the work of Xiaopang will certainly be of interest to you.

I agree that for pe3_x86 the option of /Enable-profiling is a bit hidden, but available for developpers.
Instead of /Apply-Profiles I use my own routine to remove files and folders, see Make_PE3\PE3_mod\Optimize\x86
Apply-Profiles has disadvantage of removing (not yet being used) files that are however required for functionality.

I used UltraCompare to compare filelist of pe3 with the (modified) required list produced by Enable-profiling.

:thumbsup:

#11 peetx

peetx

    Newbie

  • Members
  • 10 posts

Posted 15 July 2011 - 06:12 PM

hi all, yes allanf you#re right i was thinkin about a gui or autoit wrapper :dubbio:

nice thread realy, iw ill check out wonkos work later tonight, but i guess the result is clear by now:

you too should get this thing ported to winbuilder and combine power and knowhow to handy gui and well known handling

i can't wait to see that thing workin in winbuilder :dubbio:

peet

#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 July 2011 - 02:45 PM

Nice. :)

Due to the known possible issues with copy/paste, can you additionally attach the thingy as a file (in a .zip archive)? :unsure:

May I ask you why you are "nesting" the "IF's"? :w00t:
IF %waoutnum%==0 (

SET SELECTEDWIM=%TESTWIM%

) ELSE (

IF %waoutnum%==1 (

SET SELECTEDWIM=%CAPTUREDWIM%

) ELSE (

IF %waoutnum%==2 (

SET SELECTEDWIM=%COMMITTEDWIM%

) ELSE (

IF %waoutnum%==3 (

SET SELECTEDWIM=%UNMOUNTEDWIM%

) ELSE (

IF %waoutnum%==4 (

SET SELECTEDWIM=%PROFILEWIM%

) ELSE (

IF %waoutnum%==5 (

SET SELECTEDWIM=%OPTIMIZEDWIM%

) ELSE (

IF %waoutnum%==6 (

SET SELECTEDWIM=%BOOTWIM%

)

)

)

)

)

)

)

I mean either of:
IF %waoutnum%==0 SET SELECTEDWIM=%TESTWIM%

IF %waoutnum%==1 SET SELECTEDWIM=%CAPTUREDWIM%

IF %waoutnum%==2 SET SELECTEDWIM=%COMMITTEDWIM%

IF %waoutnum%==3 SET SELECTEDWIM=%UNMOUNTEDWIM%

IF %waoutnum%==4 SET SELECTEDWIM=%PROFILEWIM%

IF %waoutnum%==5 SET SELECTEDWIM=%OPTIMIZEDWIM%

IF %waoutnum%==6 SET SELECTEDWIM=%BOOTWIM%

or:
SETLOCAL ENABLEDELAYEDEXPANSION

....

SET WIM0=%TESTWIM%

SET WIM1=%CAPTUREDWIM%

SET WIM2=%COMMITTEDWIM%

SET WIM3=%UNMOUNTEDWIM%

SET WIM4=%PROFILEWIM%

SET WIM5=%OPTIMIZEDWIM%

SET WIM6=%BOOTWIM%

....

SET SELECTEDWIM=!WIM%waoutnum%!
would work allright and seem like simpler :dubbio:

Same simpler logic may applied to the "do_action"....

:cheers:
Wonko

#13 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 July 2011 - 04:44 PM

Well, of course anyone has his own "coding style" and of course the issue can be solved with a FOR loop, but the point I was trying to make that the nested IF/ELSE are needless (and if I recall right the max level of nesting is 7 so you were dangeropusly near the border)
The "proper" IMHO (in the sense of cleaner) is (just for the record):
IF %waoutnum%==0 SET SELECTEDWIM=%TESTWIM%& GOTO :Done

IF %waoutnum%==1 SET SELECTEDWIM=%CAPTUREDWIM%& GOTO :Done

IF %waoutnum%==2 SET SELECTEDWIM=%COMMITTEDWIM%& GOTO :Done

IF %waoutnum%==3 SET SELECTEDWIM=%UNMOUNTEDWIM%& GOTO :Done

IF %waoutnum%==4 SET SELECTEDWIM=%PROFILEWIM%& GOTO :Done

IF %waoutnum%==5 SET SELECTEDWIM=%OPTIMIZEDWIM%& GOTO :Done

IF %waoutnum%==6 SET SELECTEDWIM=%BOOTWIM%& GOTO :Done

:Done

or:
CALL :check_waoutnum 

....

GOTO :EOF

...

:check_waoutnum

IF %waoutnum%==0 SET SELECTEDWIM=%TESTWIM%& GOTO :EOF

IF %waoutnum%==1 SET SELECTEDWIM=%CAPTUREDWIM%& GOTO :EOF

IF %waoutnum%==2 SET SELECTEDWIM=%COMMITTEDWIM%& GOTO :EOF

IF %waoutnum%==3 SET SELECTEDWIM=%UNMOUNTEDWIM%& GOTO :EOF

IF %waoutnum%==4 SET SELECTEDWIM=%PROFILEWIM%& GOTO :EOF

IF %waoutnum%==5 SET SELECTEDWIM=%OPTIMIZEDWIM%& GOTO :EOF

IF %waoutnum%==6 SET SELECTEDWIM=%BOOTWIM%& GOTO :EOF

GOTO :EOF

Another way is:
CALL :sel_wim_%waoutnum%

...

GOTO :EOF



:sel_wim_0

SET SELECTEDWIM=%TESTWIM%

GOTO :EOF



:sel_wim_1

SET SELECTEDWIM=%CAPTUREDWIM%

GOTO :EOF

... etc.

And you don't really need DELAYED expansion :dubbio:
CALL SET SELECTEDWIM=%%WIM%waoutnum%%%
:unsure:
:)

If we consider this as a form of an "exercise in style" ( see Queneau):
http://en.wikipedia....Raymond_Queneau
http://en.wikipedia....rcises_in_Style
I will gladly attempt re-writing your small batch with "my" style, so that we will be able to easily spot the differences ... :w00t:

:cheers:
Wonko

#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 July 2011 - 05:42 PM

Maximum level of nesting is 7? I have already more than that working fine in the doACTION routine. :dubbio:

I may well be completely wrong about that, I may be confusing with something ELSE (if you pardon me the pun :)), in any case nested IF's tend to get pretty much unreadable IMHO.

:unsure:
Wonko




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users