abbodi1406's Batch Scripts Repo

Discussion in 'Scripting' started by abbodi1406, May 4, 2017.

  1. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,768
    7,709
    210
    #2501 Carlos Detweiller, Aug 8, 2023
    Last edited: Aug 8, 2023
    Move pid.txt to .\ISOFOLDER\sources, if detected in the script root. Currently, one has to think of two things when creating PPIPRO image (or similar "special" image.
    1. Make sure StartVirtual is 0. Otherwise, the script runs into an error as Teams has no virtual SKUs, causing no ISO to be generated at all. Maybe it's possible to ignore StartVirtual for PPIPRO?
    2. Make sure pid.txt with the correct key inside is in .\ISOFOLDER\sources, to skip the license screen on some SKUs, which would otherwise cause Setup to run into an error condition.

    All in all, when the script moves pid.txt to .\ISOFOLDER\sources, it also can automatically ignore StartVirtual=1, as pid.txt predetermines the SKU installed, anyway.

    Just my thoughts. I'm the weak link here, as I usually forget to make one of the changes, or even both.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    Why PPIPro need pid.txt specifically though?
     
  3. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,768
    7,709
    210
    You will get an error that the license files can't be found. Thus, pid.txt is required as it skips that license screen (and thus the error).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    http://put.nu/files/2qQKOcB.zip

    - copy pid.txt if detected with UUP files, or the script root (it's the user responsibility to contain correct key)

    - if the ISO to be created only include PPIPro edition:
    turn off StartVirtual
    create sources\pid.txt with KD72Y key (overwrite existing pid.txt if any)
     
  5. adric

    adric MDL Expert

    Jul 30, 2009
    1,385
    1,498
    60
    #2505 adric, Aug 10, 2023
    Last edited: Aug 10, 2023
    Any idea why I can't use the .NET48 .cab? Works ok if I use the .msu
    If you need a debug log I will rerun.
    Code:
    ======================= W10UI v10.25 ==========================
    [1] Target (x64): "u:\$W0\$0_WUI\x64\_LTSC_21H2\LTSC+08.wim"
    
    [2] Updates: "u:\$W0\$0_WUI\x64\_LTSC_21H2\Repo-Dir\Base"
    
    [3] DISM: "Host OS"
    
    [4] Enable .NET 3.5: YES
    
    [5] Cleanup System Image: YES      [6] Reset Image Base: YES
    
    [M] Mount Directory: "d:\W10UImount_30356"
    
    [E] Extraction Directory: "d:\cab_32705"
    
    ============================================================
    Change a menu option, press 0 to start the process, or 9 to exit: 0
    
    ============================================================
    Running W10UI v10.25
    ============================================================
    12:08
    
    ============================================================
    Extracting .cab files from .msu files...
    ============================================================
    12:08
    
    1/2: Windows10.0-KB5003791-x64_21H2_EnaP.msu
    2/2: windows10.0-kb5029244-x64-LCU-08.msu
    
    ============================================================
    Extracting files from update cabinets (.cab)...
    *** This will require some disk space, please be patient ***
    ============================================================
    
    1/10: Windows10.0-KB0000000-x64-Basic-de-de.cab
    2/10: Windows10.0-KB0000000-x64-Handwriting-de-de.cab
    3/10: Windows10.0-KB0000000-x64-OCR-de-de.cab
    4/10: Windows10.0-KB0000000-x64-Speach-de-de.cab
    5/10: Windows10.0-KB0000000-x64-TextToSpeach-de-de.cab
    6/10: Windows10.0-KB5003791-x64_PSFX.cab [Enablement]
    7/10: windows10.0-kb5007401-x64-DU_NET35-11.cab
    8/10: windows10.0-kb5027389-x64-DU_SafeOS-06.cab [SafeOS DU]
    NET48-08.cab was unexpected at this time.
    
    Code:
    ======================= W10UI v10.25 ==========================
    [1] Target (x64): "u:\$W0\$0_WUI\x64\_LTSC_21H2\LTSC+08.wim"
    
    [2] Updates: "u:\$W0\$0_WUI\x64\_LTSC_21H2\Repo-Dir\Base"
    
    [3] DISM: "Host OS"
    
    [4] Enable .NET 3.5: YES
    
    [5] Cleanup System Image: YES      [6] Reset Image Base: YES
    
    [M] Mount Directory: "d:\W10UImount_30356"
    
    [E] Extraction Directory: "d:\cab_32705"
    
    ============================================================
    Change a menu option, press 0 to start the process, or 9 to exit: 0
    
    ============================================================
    Running W10UI v10.25
    ============================================================
    12:35
    
    ============================================================
    Extracting .cab files from .msu files...
    ============================================================
    12:35
    
    1/3: Windows10.0-KB5003791-x64_21H2_EnaP.msu
    2/3: windows10.0-kb5028951-x64_9114a09b1109bc362c795efe4e321b820d4c1716.msu
    3/3: windows10.0-kb5029244-x64-LCU-08.msu
    
    ============================================================
    Extracting files from update cabinets (.cab)...
    *** This will require some disk space, please be patient ***
    ============================================================
    
    1/10: Windows10.0-KB0000000-x64-Basic-de-de.cab
    2/10: Windows10.0-KB0000000-x64-Handwriting-de-de.cab
    3/10: Windows10.0-KB0000000-x64-OCR-de-de.cab
    4/10: Windows10.0-KB0000000-x64-Speach-de-de.cab
    5/10: Windows10.0-KB0000000-x64-TextToSpeach-de-de.cab
    6/10: Windows10.0-KB5003791-x64_PSFX.cab [Enablement]
    7/10: windows10.0-kb5007401-x64-DU_NET35-11.cab
    8/10: windows10.0-kb5027389-x64-DU_SafeOS-06.cab [SafeOS DU]
    9/10: Windows10.0-KB5028951-x64.cab [NetFx]
    10/10: Windows10.0-KB5029244-x64.cab [Combined]
    11/12: Windows10.0-KB5028380-x64_inout.cab [SSU]
    12/12: Windows10.0-KB5029244-x64_inout.cab [LCU]
    
    
     
  6. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    What's the cab name? Windows10.0-KB5028951-x64-NET48-08.cab
     
  7. adric

    adric MDL Expert

    Jul 30, 2009
    1,385
    1,498
    60
    #2507 adric, Aug 10, 2023
    Last edited: Aug 10, 2023
    Windows10.0-kb5028951-x64-(R)NET48-08.cab

    I think it doesn't like the (R) in the name. I didn't think about that. I will change it.
     
  8. Paul Mercer

    Paul Mercer MDL Expert

    Apr 6, 2018
    1,941
    4,164
    60
    I suddenly remembered that PSFX MSU Maker is extracts SSU, shouldn't it be updated with dpx.dll workaround?
    nvm, WIM LCU should be enough
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. adric

    adric MDL Expert

    Jul 30, 2009
    1,385
    1,498
    60
    Changing the .NET cab name without the ( ) chars avoids the issue.
    Code:
    ============================================================
    Extracting files from update cabinets (.cab)...
    *** This will require some disk space, please be patient ***
    ============================================================
    
    1/10: Windows10.0-KB0000000-x64-Basic-de-de.cab
    2/10: Windows10.0-KB0000000-x64-Handwriting-de-de.cab
    3/10: Windows10.0-KB0000000-x64-OCR-de-de.cab
    4/10: Windows10.0-KB0000000-x64-Speach-de-de.cab
    5/10: Windows10.0-KB0000000-x64-TextToSpeach-de-de.cab
    6/10: Windows10.0-KB5003791-x64_PSFX.cab [Enablement]
    7/10: windows10.0-kb5007401-x64-DU_NET35-11.cab
    8/10: windows10.0-kb5027389-x64-DU_SafeOS-06.cab [SafeOS DU]
    9/10: Windows10.0-kb5028951-x64-NET48_CU-08.cab [NetFx]
    10/10: Windows10.0-KB5029244-x64.cab [Combined]
    11/12: Windows10.0-KB5028380-x64_inout.cab [SSU]
    12/12: Windows10.0-KB5029244-x64_inout.cab [LCU]
    
    
     
  10. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    KMS_VL_ALL ReadMe:
    -----
    In general, Windows batch scripts do not work well with unusual folder paths and files name, which contain non-ascii and unicode characters, long paths and spaces, or some of these special characters ` ~ ; ' , ! @ % ^ & ( ) [ ] { } + =

    By default, even explorer context menu option "Run as administrator" will fail to execute on some of those paths.
    In order to fix that, open command prompt as administrator, then copy/paste and execute these commands:
    Code:
    set _r=^%SystemRoot^%
    reg add HKLM\SOFTWARE\Classes\batfile\shell\runas\command /f /v "" /t REG_EXPAND_SZ /d "%_r%\System32\cmd.exe /C \"\"%1\" %*\""
    reg add HKLM\SOFTWARE\Classes\cmdfile\shell\runas\command /f /v "" /t REG_EXPAND_SZ /d "%_r%\System32\cmd.exe /C \"\"%1\" %*\""
    
     
  11. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    Updated - PSFX MSU Maker

    although, since we don't have install.wim, dpx.dll will be extracted only if DesktopDeployment.cab exist
    then, it would be used to create DesktopDeployment_x86.cab from SSU

    or, you can provide dpx.dll with the required files (LCU psf + LCU cab + SSU cab)
    then it would be used to create both DesktopDeployment from SSU
     
  12. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    uup-converter v93

    - Fixed "AppsLevel" option for values 2,3,4 (thanks to @dback for reporting and testing)

    - Updated apps list: OutlookForWindows, DolbyAudioExtensions, Teams, DevHome

    - Continue updating process if the random Error 1726 (The remote procedure call failed) occur

    - Changed Remove_Failure_MountDir.cmd with Remove_Failure_MountDir_TempDir.cmd

    - Copy ei.cfg if detected with UUP files, or the script root

    - Copy pid.txt if detected with UUP files, or the script root (it's the user responsibility to contain correct key)

    - If the ISO to be created only include PPIPro edition (Windows Team):
    "StartVirtual" option will be turned OFF
    sources\pid.txt will be created with KD72Y key
     
  13. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    WHD-W81UI v7.3

    - Fixed installing latest servicing stack update for images without KB2919355 (thanks to @fch1993 for reporting)
     
  14. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,768
    7,709
    210
    #2515 Carlos Detweiller, Aug 14, 2023
    Last edited: Aug 14, 2023
    There seems to be an issue with UUP Converter v93. Running in Debug Mode, the script closes with the following error at the end of the debug log:

    Code:
    =A==PPIPro was unexpected at this time.
    
    >if 1 neq 1 if 0 leq 1 if /i A=A==PPIPro (set StartVirtual=0)
    
    Trying to convert the latest Dev (AIO).

    @abbodi1406
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    Fixed.

    i always forget there are more than one scenario to check
     
  16. SunLion

    SunLion MDL Addicted

    May 11, 2011
    676
    1,669
    30
    Hello @abbodi1406

    I'm trying to extract the Windows11.0-KB5029251-x64.msu package files with the commands below, but it's not working...

    set MSU=Windows11.0-KB5029251-x64
    mkdir %MSU%
    echo.
    echo Extracting MSU files . . .
    echo.
    expand %MSU%.msu -F:* %MSU% || exit /b 1


    Am I doing something wrong?

    Thanks for the help!
     
  17. KleineZiege

    KleineZiege MDL Expert

    Dec 11, 2018
    1,850
    2,105
    60
  18. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    for builds 25336 and later, LCU msu file is wim file

    you need dism, 7-zip or wimlib-imagex to extract it

    example:
    Code:
    wimlib-imagex.exe extract %MSU%.msu 1 * --dest-dir=%MSU%
    
    7z.exe e %MSU%.msu -o"%MSU%" *
    
    dism.exe /English /Apply-Image /ImageFile:"%MSU%.msu" /Index:1 /ApplyDir:"%MSU%" /NoAcl:all
    p.s. you should not extract the msu file for integration
    add it directly using dism.exe
     
  19. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,204
    90,762
    340
    W10MUI v23

    - Code improvements and fixes (mainly to reduce duplicated commands)
    - Added Remove_Failure_MountDir_TempDir.cmd
    - Added aria2_uupdump.cmd to easily download multiple files from uupdump.net



    W8MUI v5 - W7MUI v2

    - Backported W10MUI code improvements