With that you've exhausted my assumptions. Any tweaks that might have broken something with regards to running scripts? There is a Protection Policy against executing PowerShell scripts, there is also one for Batch Scripts. I don't remember at the moment. There was a time that I disabled the Null service and the scripts were crap, I don't even know if they worked or not. I just remember that all the errors that occurred while running the Toolkit were displayed on the screen. It took me some time to find out which Tweak I had applied that gave this. Code: rem value 1 Default "Null" - Note: Disabling this Service causes CLI and Scripts issues reg.exe add "HKLM\TK_SYSTEM\ControlSet001\Services\Null" /v "Start" /t REG_DWORD /d "1" /f >nul 2>&1 I left the line of this tweak commented so I never forget it, hehehehe
WindowsDefender error. Code: 20348.1.210507-1500.FE_RELEASE_SERVERSTANDARD_OEMRET_X64FRE_EN-US.iso\install.wim Results: Microsoft Windows [Version 10.0.19041.1] (c) 2019 Microsoft Corporation. All rights reserved. C:\Program Files\PowerRun>C:\ToolKitHelper.exe D:\ WindowsDefender MSMG ToolKit Commandline Helper Version: 1.1.1404.0 Image Version: 10.0.20348.1 Component : WindowsDefender Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... --------------------------- --------------------------- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at (Object , String ) at .(Object , String , ) at ..(String , String ) at .(String , String , ) at ..(String , String ) at .(String , String , ) at ..Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at _._.___() --------------------------- OK ---------------------------
WindowsDefender error. Code: 20348.1.210507-1500.FE_RELEASE_SERVERSTANDARD_OEMRET_X64FRE_EN-US.iso\install.wim Microsoft Windows [Version 10.0.19041.1] (c) 2019 Microsoft Corporation. All rights reserved. C:\Program Files\PowerRun>C:\ToolKitHelper.exe D:\ WindowsDefender MSMG ToolKit Commandline Helper Version: 1.1.1296.0 Image Version: 10.0.20348.1 Component : WindowsDefender Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... --------------------------- --------------------------- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at (Object , String ) at .(Object , String , ) at ..(String , String ) at .(String , String , ) at ..(String , String ) at .(String , String , ) at ..Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at _._.___() --------------------------- OK ---------------------------
Man, the Path is long. You have to run all commands as admin. You have to learn how to mount a wim image. * forum research You have to learn how to mount the registry images with the command: reg.exe load When you are going to mount a registry image, you will give a name to the image that was mounted, this mounted image is called "hive", in this case I put your Nick. So you will have to adapt your registry file to be imported properly. You have to know the path of the registry images inside the mounted wim image. Code: reg.exe load HKLM\NathanIT_COMPONENTS "%~1\Windows\System32\config\COMPONENTS" >nul reg.exe load HKLM\NathanIT_DEFAULT "%~1\Windows\System32\config\default" >nul reg.exe load HKLM\NathanIT_NTUSER "%~1\Users\Default\ntuser.dat" >nul reg.exe load HKLM\NathanIT_SOFTWARE "%~1\Windows\System32\config\SOFTWARE" >nul reg.exe load HKLM\NathanIT_SYSTEM "%~1\Windows\System32\config\SYSTEM" >nul where %~1 is the mount point you set. For w11 boot.wim Bypass TPM (Hardware Requisites), you must mount index 2 and mount the hive reg.exe load HKLM\NathanIT_SYSTEM "%~1\Windows\System32\config\SYSTEM" >nul So, you integrate your reg file. You have to use the command: reg.exe import filename.reg. Finally, you have to unmount the hive with the command: reg.exe unload Code: for %%h in ( COMPONENTS DRIVERS DEFAULT NTUSER SCHEMA SOFTWARE SYSTEM ) do ( reg.exe unload HKLM\NathanIT_%%h ) >nul 2>&1 or: Code: for /F "tokens=* delims=" %%h in ('reg.exe query "HKLM" ^| findstr.exe "{"') do reg.exe unload "%%h" >nul 2>&1 reg.exe unload HKLM\NathanIT_COMPONENTS >nul 2>&1 reg.exe unload HKLM\NathanIT_DEFAULT >nul 2>&1 reg.exe unload HKLM\NathanIT_NTUSER >nul 2>&1 reg.exe unload HKLM\NathanIT_SOFTWARE >nul 2>&1 reg.exe unload HKLM\NathanIT_SYSTEM >nul 2>&1 Same thing. More information about reg.exe open cmd and: reg.exe /? For each index that you want to apply to your files you have to repeat these steps. That said: You already have where to start studying. But the easiest way is to use the tools, open them with notepad++ and read the sequence of commands. After all, a script is nothing more than putting in a text the commands that we use via the command line, and taking advantage of the resource of making them executable.
Within the script, the MSMG code uses the mount point to remove components at each index. Code: "%ToolKitHelper%" "%InstallMount%\%%i" "%Components%" "%ToolKitHelper%" "%InstallMount%\%%i" "%RemovePkgsList%" %InstallMount% is ".\Toolkit\Mount\Install\" so: Code: .\Toolkit\Mount\Install\1 .\Toolkit\Mount\Install\2 .\Toolkit\Mount\Install\3 .\Toolkit\Mount\Install\4 .\Toolkit\Mount\Install\5 It would be interesting to put the mount point to see if it gives a different result. And, also test, running with nSudo, since the Toolkit still uses nSudo. Another thing, are you running it as ThrustedInstaller or running just the command from the PowerRun folder?
WindowsDefender error. Code: Microsoft Windows [Version 10.0.19041.1] (c) 2019 Microsoft Corporation. All rights reserved. C:\Program Files\PowerRun>C:\ToolKitHelper.exe D:\ WindowsDefender MSMG ToolKit Commandline Helper Version: 1.1.1080.0 Image Version: 10.0.20348.1 Component : WindowsDefender Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... --------------------------- --------------------------- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at (Object , String ) at .(Object , String , ) at ..(String , String ) at .(String , String , ) at ..(String , String ) at .(String , String , ) at ..Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at _._.___() --------------------------- OK ---------------------------
It's not mount point or command. Code: 19041.1.191206-1406.VB_RELEASE_CLIENTCORE_OEMRET_X64FRE_EN-US.iso\install.wim Microsoft Windows [Version 10.0.19041.1] (c) 2019 Microsoft Corporation. All rights reserved. C:\Program Files\PowerRun>C:\ToolKitHelper.exe D:\ WindowsDefender MSMG ToolKit Commandline Helper Version: 1.1.1080.0 Image Version: 10.0.19041.1 Component : WindowsDefender Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. C:\Program Files\PowerRun>
Code: Windows ServerStandard x64 Step-[1] Dism /Image:D:\ /Disable-Feature /FeatureName:Windows-Defender Step-[2] Microsoft Windows [Version 10.0.19041.1] (c) 2019 Microsoft Corporation. All rights reserved. C:\Program Files\PowerRun>C:\ToolKitHelper.exe D:\ C:\Components.txt MSMG ToolKit Commandline Helper Version: 1.1.1404.0 Image Version: 10.0.20348.1 Component : EdgeChromium Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : InternetExplorer Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : GameExplorer Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : LockScreenBackground Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : ScreenSavers Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SnippingTool Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SoundThemes Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SpeechRecognition Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : Wallpapers Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsMediaPlayer Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsPhotoViewer Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsThemes Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsTIFFIFilter Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WinSAT Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : OfflineFiles Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : OpenSSH Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : RemoteDesktopClient Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : RemoteDifferentialCompression Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SimpleTCPIPServices Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : TelnetClient Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : TFTPClient Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WalletService Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsMail Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : CEIP Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : FaceRecognition Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : KernelDebugging Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : LocationService Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : PicturePassword Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : PinEnrollment, not found... Component : UnifiedTelemetryClient Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WiFiNetworkManager, not found... Component : WindowsErrorReporting Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsInsiderHub Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : HomeGroup Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : MultiPointConnector Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : RemoteAssistance, not found... Component : RemoteDesktopServer Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : RemoteRegistry Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WorkFoldersClient, not found... Component : AccessibilityTools Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : DeviceLockdown, not found... Component : EaseOfAccessCursors Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : EaseOfAccessThemes Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : EasyTransfer Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : FileHistory, not found... Component : Magnifier Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : Narrator Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : OnScreenKeyboard Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : Paint Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : ProjFS Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SecurityCenter, not found... Component : StepsRecorder Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : StorageSpaces Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SystemRestore, not found... Component : WindowsBackup, not found... Component : WindowsFirewall Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsSubsystemForLinux Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsToGo Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : AADBrokerPlugin Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : AccountsControl Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : AddSuggestedFoldersToLibraryDialog Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : AppResolverUX Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : AsyncTextService Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : BioEnrollment Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : CapturePicker Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : CBSPreview Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : ContentDeliveryManager, not found... Component : CredDialogHost Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : ECApp Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : EdgeDevToolsClient, not found... Component : FileExplorer Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : FilePicker Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : LockApp Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : MapControl Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : NarratorQuickStart Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : OOBENetworkCaptivePortal Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : OOBENetworkConnectionFlow Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : ParentalControls, not found... Component : PeopleExperienceHost Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : PinningConfirmationDialog Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : PrintDialog Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : RetailDemoContent, not found... Component : SearchApp Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SkypeORTC Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : SmartScreen Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WebcamExperience Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : Win32WebViewHost Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsMixedReality, not found... Component : WindowsReaderPDF Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : WindowsStoreClient Removing Package files... Modifying Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. Component : XboxClient, not found... Component : XboxGameCallableUI, not found... Component : XGpuEjectDialog Removing Package files... Loading Image Registry... Modifying Package Registry... Unloading Image Registry... The operation completed successfully. .
We can temporarily replace these lines: from: Code: echo.------------------------------------------------------------------------------- echo.####Removing Windows Components################################################ echo.------------------------------------------------------------------------------- if "%Components%" neq "" ( for /l %%i in (1, 1, %ImageCount%) do ( if exist "%InstallMount%\%%i" ( echo. if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================ if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================ echo. :: Removing Windows Components "%ToolKitHelper%" "%InstallMount%\%%i" "%Components%" ) ) ) to: Code: echo.------------------------------------------------------------------------------- echo.####Removing Windows Components################################################ echo.------------------------------------------------------------------------------- if "%Components%" neq "" ( for /l %%i in (1, 1, %ImageCount%) do ( if exist "%InstallMount%\%%i" ( echo. if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================ if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================ echo. :: Disabling Windows Defender Feature if "!C_WindowsDefender!" equ "-" call :DisableFeature "%InstallMount%\%%i", "Windows-Defender" :: Removing Windows Components "%ToolKitHelper%" "%InstallMount%\%%i" "%Components%" ) ) ) @MSMG, from: Code: call :EnableFeature "%InstallMount%\%%i" %%z to: Code: call :EnableFeature "%InstallMount%\%%i", "%%z" from: Code: call :DisableFeature "%InstallMount%\%%i" %%z to: Code: call :DisableFeature "%InstallMount%\%%i", "%%z"
HKEY_CURRENT_USER & HKEY_USERS: use any key(COMPONENTS; DEFAULT; NTUSER) in the side key you bring on ?
If I'm not mistaken, you can add both to DEFAULT and NTUSER. Correct me if I'm wrong. But even so, be careful what you add to DEFAULT. NTUSER is .\Users\Default\ntuser.dat DEFAULT is .\Windows\System32\config\default Note: this "default", as well as the others that are inside that "config" folder, without extension, are not folders. They are all files.
save as Remove_Failure_MountDir.cmd and clean up the existing mount points. Code: @echo OFF if exist "%SystemROOT%\SysWOW64" (set "HostArchitecture=x64") else (set "HostArchitecture=x86") ::=================================================================== :: Getting Admin Rights by Run Script as Trusted Installer with nSudo rem >nul 2>&1 KTMutil.exe || ( >nul 2>&1 reg.exe query HKU\S-1-5-19 || ( title Run "%~nx0" Script as Trusted Installer with nSudo... if exist "Bin\%HostArchitecture%\nSudo.exe" ( start /b "" "Bin\%HostArchitecture%\nSudo.exe" -U:T -P:E "%~f0" ) else ( echo. echo. echo.Execute o script "%~nx0" da pasta da Toolkit. echo. pause ) exit ) @setlocal DisableDelayedExpansion @echo off set _args= set _args=%* if not defined _args goto :NoProgArgs for %%A in (%_args%) do ( if /i "%%A"=="-wow" set _rel1=1 if /i "%%A"=="-arm" set _rel2=1 ) :NoProgArgs set "_cmdf=%~f0" if exist "%SystemRoot%\Sysnative\cmd.exe" if not defined _rel1 ( setlocal EnableDelayedExpansion start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" -wow " exit /b ) if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 if not defined _rel2 ( setlocal EnableDelayedExpansion start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" -arm " exit /b ) set "_Null=1>nul 2>nul" set "SysPath=%SystemRoot%\System32" if exist "%SystemRoot%\Sysnative\reg.exe" (set "SysPath=%SystemRoot%\Sysnative") set "Path=%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\" reg.exe query HKU\S-1-5-19 %_Null% || (echo.&echo Este script requer privilégios de administrador.&goto :TheEnd) set "xOS=%PROCESSOR_ARCHITECTURE%" if /i %PROCESSOR_ARCHITECTURE%==x86 (if defined PROCESSOR_ARCHITEW6432 set "xOS=%PROCESSOR_ARCHITEW6432%") set "_key=HKLM\SOFTWARE\Microsoft\WIMMount\Mounted Images" set regKeyPathFound=1 set wowRegKeyPathFound=1 reg.exe query "HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots" /v KitsRoot10 %_Null% || set wowRegKeyPathFound=0 reg.exe query "HKLM\Software\Microsoft\Windows Kits\Installed Roots" /v KitsRoot10 %_Null% || set regKeyPathFound=0 if %wowRegKeyPathFound% equ 0 ( if %regKeyPathFound% equ 0 ( goto :precheck ) else ( set regKeyPath=HKLM\Software\Microsoft\Windows Kits\Installed Roots ) ) else ( set regKeyPath=HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots ) for /f "skip=2 tokens=2*" %%i in ('reg.exe query "%regKeyPath%" /v KitsRoot10') do set "KitsRoot=%%j" set "DandIRoot=%KitsRoot%Assessment and Deployment Kit\Deployment Tools" if exist "%DandIRoot%\%xOS%\DISM\dism.exe" ( set "Path=%DandIRoot%\%xOS%\DISM;%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\" cd \ ) :precheck echo. echo. choice /C YN /N /M "Detectar e limpar qualquer pasta montada? [y/n]: " if errorlevel 2 goto :eof if errorlevel 1 goto :ALL :ALL @cls for /f "tokens=3*" %%a in ('reg.exe query "%_key%" /s /v "Mount Path" 2^>nul ^| findstr /i /c:"Mount Path"') do (set "_mount=%%b"&call :CLN) rem dism.exe /English /Cleanup-Wim rem dism.exe /English /Cleanup-Mountpoints dism.exe /Cleanup-Wim dism.exe /Cleanup-Mountpoints goto :TheEnd :CLN rem dism.exe /English /Image:"%_mount%" /Get-Packages %_Null% rem dism.exe /English /Unmount-Wim /MountDir:"%_mount%" /Discard dism.exe /Image:"%_mount%" /Get-Packages %_Null% dism.exe /Unmount-Wim /MountDir:"%_mount%" /Discard if exist "%_mount%\" rmdir /s /q "%_mount%\" %_Null% if exist "%_mount%" ( mkdir %_drv%\_del286 %_Null% robocopy %_drv%\_del286 "%_mount%" /MIR /R:1 /W:1 /NFL /NDL /NP /NJH /NJS %_Null% rmdir /s /q %_drv%\_del286\ %_Null% rmdir /s /q "%_mount%" %_Null% ) exit /b :TheEnd echo. echo Digite qualquer tecla para sair. pause >nul goto :eof script from abbodi1406 and inTerActionVRI.