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
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? Spoiler: 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 repare) repare 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%" )
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%" )
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" )
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.
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
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.
move exit /b line to the end of the script. The :: Second part of the script is part of Code: :Prepare label
Moved exit /b to the end of the script, only the second part of the script works, and the first one does not work.
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