1. n3ro97

    n3ro97 MDL Member

    Oct 17, 2018
    105
    63
    10
  2. mhussain

    mhussain MDL Senior Member

    Oct 1, 2012
    368
    144
    10
    hi,
    does dism cleanly remove packages?
    will this cbs thingy make it so i will be able to bulk purge hyper-v from my machine?
    i'm currently rocking srv2022
    have a care when using this tool
     
  3. mhussain

    mhussain MDL Senior Member

    Oct 1, 2012
    368
    144
    10
    doo ms hide any packages in server sku?
     
  4. sergey130270

    sergey130270 MDL Senior Member

    May 15, 2014
    275
    295
    10
    #22825 sergey130270, Jun 9, 2022
    Last edited: Jun 9, 2022
    Thank you dear
    inTerActionVRI
    for your help, everything worked out in the ways, this part of the script is processed perfectly, but it doesn’t work to go to the second part of the script, the script stops working, could you fix the script for me?

    :: First part of the script
    @echo OFF
    Color 1f

    :: GotAdmin
    pushd "%CD%"
    CD /D "%~dp0"

    Setlocal enabledelayedexpansion

    :: Detect [OS Architecture]
    IF Exist %WinDir%\SysWOW64 (set "arch=x64") Else (set "arch=x86")

    :: Getting Admin Rights by Run Script as Trusted Installer with RunAsTI
    IF /I NOT "%USERNAME%"=="SYSTEM" "Tools\%arch%\RunAsTI_%arch%.exe" "%~f0" %* & exit

    :: TITLE Integration for the installation image
    :: Setting environment path variables
    SET "MOUNT=%~dp0Mount"
    SET "InstallMount=%~dp0Mount\Install"
    SET "WinREMount=%~dp0Mount\WinRE"
    SET "WinRE=%~dp0Mount\Install\Windows\System32\Recovery"
    SET "WIM=%~dp0DVD\sources\install.wim"
    SET "WIMTemp=%~dp0DVD\sources\install_temp.wim"
    SET "Tweaks=%~dp0Tweaks"
    SET "ImageDefaultLanguage="

    SET /a _t=0
    SET /a _c=0
    if exist "Addons\%arch%\Temp" rd /q /s "Addons\%arch%\Temp"
    if not exist "Addons\%arch%\Temp" md "Addons\%arch%\Temp"
    if exist "Addons\%arch%\*.WA" for /f "delims=" %%# in ('dir /b /os Addons\%arch%\*.WA') do call set /a _t+=1
    if %_t% equ 0 exit /b
    for /f "delims=" %%# in ('dir /b /os Addons\%arch%\*.WA') do (set "addon=%%#"&set "dest=Temp\%%~n#"&call :prepare)

    :prepare
    if exist "Addons\%arch%\%dest%" (
    if exist "Addons\%arch%\%dest%\Registry\NSudoC.exe" (exit /b) else (rd /s /q "Addons\%arch%\%dest%")
    )
    set /a _c+=1
    echo %_c%/%_t%: Addons\%arch%\Addons\%addon%
    echo.
    "Tools\%arch%\7z.exe" x "Addons\%arch%\%addon%" -o"Addons\%arch%\%dest%" * -r >nul
    if not exist "Addons\%arch%\%dest%\Tasks.txt" rd /s /q "Addons\%arch%\%dest%"&exit /b
    md "Addons\%arch%\%dest%\Registry\"
    copy /y "Tools\%arch%\NSudo.exe" "Addons\%arch%\%dest%\Registry\" >nul
    copy /y "Tools\%arch%\Integrator.cmd" "Addons\%arch%\%dest%\" >nul
    copy /y "Tools\%arch%\Reg2Wim.cmd" "Addons\%arch%\%dest%\" >nul
    pushd "Addons\%arch%\%dest%\"
    findstr /i ".dll" Tasks.txt >nul && for /f "tokens=1,2 delims=:" %%a in ('findstr /i ".dll" Tasks.txt') do (
    if not exist "Files\%%b" md "Files\%%b"
    move /y "%%a" "Files\%%b\" >nul
    )
    for /f "tokens=1,2 delims=:" %%a in ('findstr /i ":" Tasks.txt ^|findstr /i /v ".dll"') do (
    if not exist "Files\%%b" md "Files\%%b"
    move /y "%%a" "Files\%%b\" >nul
    )
    for /f "delims=" %%# in ('dir /b *.reg') do call Reg2Wim.cmd %%#
    move /y *.reg Registry\ >nul
    del /f /q Reg2Wim.cmd Tasks.txt
    popd
    exit /b

    :: Second part of the script
    :: Mounting installation image
    SET ImageCount=1
    IF EXIST "%InstallMount%" rd /q /s "%InstallMount%"
    IF NOT EXIST "%InstallMount%" mkdir "%InstallMount%"
    FOR /F "tokens=2 delims=: " %%i in ('start "" /b "Tools\%arch%\DISM\dism.exe" /English /Get-WimInfo /WimFile:"%WIM%" ^| findstr /i Index') do (set ImageCount=%%i)
    FOR /L %%i in (1, 1, %ImageCount%) do (
    "Tools\%arch%\DISM\Dism.exe" /Get-WimInfo /WimFile:"%WIM%" /index:%%i
    "Tools\%arch%\DISM\dism.exe" /Mount-Wim /WimFile:"%WIM%" /index:%%i /MountDir:"%InstallMount%"
    )
     
  5. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    49,668
    103,496
    450
    [code]code here[/code]?
    =
    Code:
    code here
     
  6. Bira

    Bira MDL Senior Member

    Oct 4, 2017
    286
    164
    10
    #22827 Bira, Jun 9, 2022
    Last edited: Jun 9, 2022
    above all where you want to say a code, for example, to be sure, put it above @echo off => code in square brackets so that your code is right, for those who can help you understand

    Code:
    :: First part of the script
    @echo OFF
    Color 1f
    
    :: GotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
    
    Setlocal enabledelayedexpansion
    
    :: Detect [OS Architecture]
    IF Exist %WinDir%\SysWOW64 (set "arch=x64") Else (set "arch=x86")
    
    :: Getting Admin Rights by Run Script as Trusted Installer with RunAsTI
    IF /I NOT "%USERNAME%"=="SYSTEM" "Tools\%arch%\RunAsTI_%arch%.exe" "%~f0" %* & exit
    
    :: TITLE Integration for the installation image
    :: Setting environment path variables
    SET "MOUNT=%~dp0Mount"
    SET "InstallMount=%~dp0Mount\Install"
    SET "WinREMount=%~dp0Mount\WinRE"
    SET "WinRE=%~dp0Mount\Install\Windows\System32\Recovery"
    SET "WIM=%~dp0DVD\sources\install.wim"
    SET "WIMTemp=%~dp0DVD\sources\install_temp.wim"
    SET "Tweaks=%~dp0Tweaks"
    SET "ImageDefaultLanguage="
    
    SET /a _t=0
    SET /a _c=0
    if exist "Addons\%arch%\Temp" rd /q /s "Addons\%arch%\Temp"
    if not exist "Addons\%arch%\Temp" md "Addons\%arch%\Temp"
    if exist "Addons\%arch%\*.WA" for /f "delims=" %%# in ('dir /b /os Addons\%arch%\*.WA') do call set /a _t+=1
    if %_t% equ 0 exit /b
    for /f "delims=" %%# in ('dir /b /os Addons\%arch%\*.WA') do (set "addon=%%#"&set "dest=Temp\%%~n#"&call :prepare)
    
    :prepare
    if exist "Addons\%arch%\%dest%" (
    if exist "Addons\%arch%\%dest%\Registry\NSudoC.exe" (exit /b) else (rd /s /q "Addons\%arch%\%dest%")
    )
    set /a _c+=1
    echo %_c%/%_t%: Addons\%arch%\Addons\%addon%
    echo.
    "Tools\%arch%\7z.exe" x "Addons\%arch%\%addon%" -o"Addons\%arch%\%dest%" * -r >nul
    if not exist "Addons\%arch%\%dest%\Tasks.txt" rd /s /q "Addons\%arch%\%dest%"&exit /b
    md "Addons\%arch%\%dest%\Registry\"
    copy /y "Tools\%arch%\NSudo.exe" "Addons\%arch%\%dest%\Registry\" >nul
    copy /y "Tools\%arch%\Integrator.cmd" "Addons\%arch%\%dest%\" >nul
    copy /y "Tools\%arch%\Reg2Wim.cmd" "Addons\%arch%\%dest%\" >nul
    pushd "Addons\%arch%\%dest%\"
    findstr /i ".dll" Tasks.txt >nul && for /f "tokens=1,2 delims=:" %%a in ('findstr /i ".dll" Tasks.txt') do (
    if not exist "Files\%%b" md "Files\%%b"
    move /y "%%a" "Files\%%b\" >nul
    )
    for /f "tokens=1,2 delims=:" %%a in ('findstr /i ":" Tasks.txt ^|findstr /i /v ".dll"') do (
    if not exist "Files\%%b" md "Files\%%b"
    move /y "%%a" "Files\%%b\" >nul
    )
    for /f "delims=" %%# in ('dir /b *.reg') do call Reg2Wim.cmd %%#
    move /y *.reg Registry\ >nul
    del /f /q Reg2Wim.cmd Tasks.txt
    popd
    exit /b
    
    :: Second part of the script
    :: Mounting installation image
    SET ImageCount=1
    IF EXIST "%InstallMount%" rd /q /s "%InstallMount%"
    IF NOT EXIST "%InstallMount%" mkdir "%InstallMount%"
    FOR /F "tokens=2 delims=: " %%i in ('start "" /b "Tools\%arch%\DISM\dism.exe" /English /Get-WimInfo /WimFile:"%WIM%" ^| findstr /i Index') do (set ImageCount=%%i)
    FOR /L %%i in (1, 1, %ImageCount%) do (
    "Tools\%arch%\DISM\Dism.exe" /Get-WimInfo /WimFile:"%WIM%" /index:%%i
    "Tools\%arch%\DISM\dism.exe" /Mount-Wim /WimFile:"%WIM%" /index:%%i /MountDir:"%InstallMount%"
    )
     
  7. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60

    Added:
    SET "TOOLS=%~dp0Tools\%arch%"
    SET "Addons=%~dp0Addons\%arch%"
    and
    SET "DISM=%Tools%\DISM\dism.exe"
    SET "DISM=%DISM% /English /NoRestart"

    SET "WinReWim=Windows\System32\Recovery\winre.wim"
    You will use this with %InstallMount%\IndexNumber\%WinReWim% to mount into %WinREMount%
    You just need to assemble the WinRE of an index only. I put it to choose Pro Edition Index. Then just save this changed WinRE to the Temp folder and before saving the indexes copy. "Temp\WinRe.wim" for each index on the following path: "%InstallMount%\IndexNumber\%WinReWim%".


    I made some changes:
    Code:
    :: First part of the script
    @echo OFF
    Color 1f
    
    :: GotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
    
    :: Detect [OS Architecture]
    IF Exist %WinDir%\SysWOW64 (set "arch=x64") Else (set "arch=x86")
    
    SET "TOOLS=%~dp0Tools\%arch%"
    SET "Addons=%~dp0Addons\%arch%"
    
    :: Getting Admin Rights by Run Script as Trusted Installer with RunAsTI
    IF /I NOT "%USERNAME%"=="SYSTEM" "%Tools%\RunAsTI_%arch%.exe" "%~f0" %* & exit
    
    :: TITLE Integration for the installation image
    :: Setting environment path variables
    SET "MOUNT=%~dp0Mount"
    SET "InstallMount=%MOUNT%\Install"
    SET "WinREMount=%MOUNT%\WinRE"
    SET "WinReWim=Windows\System32\Recovery\winre.wim"
    SET "WinRE=%MOUNT%\Install\Windows\System32\Recovery"
    SET "WIM=%~dp0DVD\sources\install.wim"
    SET "WIMTemp=%~dp0DVD\sources\install_temp.wim"
    SET "Tweaks=%~dp0Tweaks"
    SET "ImageDefaultLanguage="
    SET "DISM=%Tools%\DISM\dism.exe"
    SET "DISM=%DISM% /English /NoRestart"
    
    Setlocal enabledelayedexpansion
    
    SET /a _t=0
    SET /a _c=0
    if exist "%Addons%\Temp" rd /q /s "%Addons%\Temp"
    if not exist "%Addons%\Temp" md "%Addons%\Temp"
    if exist "%Addons%\*.WA" for /f "delims=" %%# in ('dir /b /os %Addons%\*.WA') do call set /a _t+=1
    if %_t% equ 0 exit /b
    for /f "delims=" %%# in ('dir /b /os %Addons%\*.WA') do (set "addon=%%#"&set "dest=Temp\%%~n#"&call :prepare)
    
    :prepare
    if exist "%Addons%\%dest%" (
       if exist "%Addons%\%dest%\Registry\NSudoC.exe" (exit /b) else (rd /s /q "%Addons%\%dest%")
    )
    set /a _c+=1
    echo %_c%/%_t%: %Addons%\Addons\%addon%
    echo.
    "%Tools%\7z.exe" x "%Addons%\%addon%" -o"%Addons%\%dest%" * -r >nul
    if not exist "%Addons%\%dest%\Tasks.txt" rd /s /q "%Addons%\%dest%"&exit /b
    md "%Addons%\%dest%\Registry\"
    copy /y "%Tools%\NSudo.exe" "%Addons%\%dest%\Registry\" >nul
    copy /y "%Tools%\Integrator.cmd" "%Addons%\%dest%\" >nul
    copy /y "%Tools%\Reg2Wim.cmd" "%Addons%\%dest%\" >nul
    pushd "%Addons%\%dest%\"
    findstr /i ".dll" Tasks.txt >nul && for /f "tokens=1,2 delims=:" %%a in ('findstr /i ".dll" Tasks.txt') do (
       if not exist "Files\%%b" md "Files\%%b"
       move /y "%%a" "Files\%%b\" >nul
    )
    for /f "tokens=1,2 delims=:" %%a in ('findstr /i ":" Tasks.txt ^|findstr /i /v ".dll"') do (
       if not exist "Files\%%b" md "Files\%%b"
       move /y "%%a" "Files\%%b\" >nul
    )
    for /f "delims=" %%# in ('dir /b *.reg') do call Reg2Wim.cmd %%#
    move /y *.reg Registry\ >nul
    del /f /q Reg2Wim.cmd Tasks.txt
    popd
    exit /b
    
    :: Second part of the script
    :: Mounting installation image
    rem SET ImageCount=1
    FOR /F "tokens=2 delims=: " %%i in ('%DISM% /Get-ImageInfo /ImageFile:"%WIM%" ^| findstr /i Index') do (set ImageCount=%%i)
    FOR /L %%i in (1 1 %ImageCount%) do (
       IF EXIST "%InstallMount%\%%i\" rd /q /s "%InstallMount%\%%i"
       IF NOT EXIST "%InstallMount%\%%i\" mkdir "%InstallMount%\%%i"
       %DISM% /Get-ImageInfo /ImageFile:"%WIM%" /index:%%i
       %DISM% /Mount-Image /ImageFile:"%WIM%" /index:%%i /MountDir:"%InstallMount%\%%i"
    )
    
     
  8. lurkingaroundagain

    lurkingaroundagain MDL Novice

    Oct 14, 2021
    7
    0
    0
    OBS and several other applications keeps giving me an error with Svchost.exe, The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
    Did I remove something I shouldn't or is this a problem with 11? 10 didn't have any issues after debloating.
    Using 22621.1 debloated with latest tools.
     
  9. raptorddd

    raptorddd MDL Addicted

    Aug 17, 2019
    732
    281
    30
    #22830 raptorddd, Jun 9, 2022
    Last edited: Jun 9, 2022
    can anyone please help
    to download windows update. i mean if i want to integrate latest update to iso windows 10 21H2
    i know i can get it on microsoft update catalog.
    i just done know where to find the information of wich KB i need to download and on microsoft update catalog i just need to type the KB.?
    thank you
     
  10. sergey130270

    sergey130270 MDL Senior Member

    May 15, 2014
    275
    295
    10
    #22831 sergey130270, Jun 9, 2022
    Last edited: Jun 9, 2022
    Hello dear InterActionVRI! I added the path variables to the script that you indicated, everything is the same, it comes to exit /b , the command closes and nothing happens, the image is not mounted, what else can I do? There must be a reason.
    The first part of the script works fine, but the second one doesn't want to work.
    Thank you very much for yuo a lot of helping so much.
     
  11. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    move exit /b line to the end of the script.

    The :: Second part of the script is part of
    Code:
    :Prepare
    label
     
  12. sergey130270

    sergey130270 MDL Senior Member

    May 15, 2014
    275
    295
    10
    Moved exit /b to the end of the script, only the second part of the script works, and the first one does not work.
     
  13. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    #22834 inTerActionVRI, Jun 9, 2022
    Last edited: Jun 9, 2022
    Missing this:
    goto :MountSourceIndexes
    Then put the label in that part:
    :: Second part of the script
    :: Mounting installation image
    :MountSourceIndexes

    The changed code, below:
    Code:
    for /f "delims=" %%# in ('dir /b /os %Addons%\*.WA') do (set "addon=%%#"&set "dest=Temp\%%~n#"&call :prepare)
    goto :MountSourceIndexes
    
    :prepare
    if exist "%Addons%\%dest%" (
       if exist "%Addons%\%dest%\Registry\NSudoC.exe" (exit /b) else (rd /s /q "%Addons%\%dest%")
    )
    set /a _c+=1
    echo %_c%/%_t%: %Addons%\Addons\%addon%
    echo.
    "%Tools%\7z.exe" x "%Addons%\%addon%" -o"%Addons%\%dest%" * -r >nul
    if not exist "%Addons%\%dest%\Tasks.txt" rd /s /q "%Addons%\%dest%"&exit /b
    md "%Addons%\%dest%\Registry\"
    copy /y "%Tools%\NSudo.exe" "%Addons%\%dest%\Registry\" >nul
    copy /y "%Tools%\Integrator.cmd" "%Addons%\%dest%\" >nul
    copy /y "%Tools%\Reg2Wim.cmd" "%Addons%\%dest%\" >nul
    pushd "%Addons%\%dest%\"
    findstr /i ".dll" Tasks.txt >nul && for /f "tokens=1,2 delims=:" %%a in ('findstr /i ".dll" Tasks.txt') do (
       if not exist "Files\%%b" md "Files\%%b"
       move /y "%%a" "Files\%%b\" >nul
    )
    for /f "tokens=1,2 delims=:" %%a in ('findstr /i ":" Tasks.txt ^|findstr /i /v ".dll"') do (
       if not exist "Files\%%b" md "Files\%%b"
       move /y "%%a" "Files\%%b\" >nul
    )
    for /f "delims=" %%# in ('dir /b *.reg') do call Reg2Wim.cmd %%#
    move /y *.reg Registry\ >nul
    del /f /q Reg2Wim.cmd Tasks.txt
    popd
    exit /b
    
    :: Second part of the script
    :: Mounting installation image
    :MountSourceIndexes
    rem SET ImageCount=1
    FOR /F "tokens=2 delims=: " %%i in ('%DISM% /Get-ImageInfo /ImageFile:"%WIM%" ^| findstr /i Index') do (set ImageCount=%%i)
    FOR /L %%i in (1 1 %ImageCount%) do (
       IF EXIST "%InstallMount%\%%i\" rd /q /s "%InstallMount%\%%i"
       IF NOT EXIST "%InstallMount%\%%i\" mkdir "%InstallMount%\%%i"
       %DISM% /Get-ImageInfo /ImageFile:"%WIM%" /index:%%i
       %DISM% /Mount-Image /ImageFile:"%WIM%" /index:%%i /MountDir:"%InstallMount%\%%i"
    )
    
    Retain the exit /b where it was before.

    When the last "call : prepare" is executed, it will goto to next line and will go through "prepare label" again, without any setted variable and will exit the script.
    So, there is needed one line to indicate what to do.
    goto :anywhereinthescript
     
  14. sergey130270

    sergey130270 MDL Senior Member

    May 15, 2014
    275
    295
    10
    You are my savior!!! Everything turned out great. You are a true friend. Thank you very much))))))
     
  15. graver.x

    graver.x MDL Senior Member

    Jan 18, 2020
    347
    484
    10
  16. haris_mdlf69

    haris_mdlf69 MDL Addicted

    Oct 23, 2018
    575
    970
    30
  17. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210