Needless to say, the Win11LiteCreator tool is also a pretty interesting solution for cleaning up an image from “junk”. But unless you are a PowerShell expert, you are unlikely to be able to change anything to suit your preferences in this script. SunLion's script is not simple either, but it uses dism, which allows a user who is not very knowledgeable in programming to easily edit this script to suit their needs. In general, as they say, to each his own, who likes what. But personally I would prefer the script from SunLion, where the script code is clear to the user and quite easy to edit to your preferences, as for me - a very good script!
Hi, can you see what the reason is? 1. When executing this code, it gives an error: !RemoveUWPapp! """" is not an internal or external command, essotable program or batch fillet. Spoiler Code: echo. ECHO. ECHO ============================================================ ECHO Remove Provisioned AppxPackages ECHO ============================================================ for /f "tokens=2 delims=: " %%a in ('start "" /b "%DISM%" /English /Image:"%~dp0mount" /Get-ProvisionedAppxPackages ^| find "PackageName"') do ( Set "RemoveUWPapp=%%a" for %%u in ( DesktopAppInstaller SecHealthUI ) do ( ECHO %%a | findstr /l /i /c:"%%u" >nul 2>&1 && set RemoveUWPapp= ) If not "!RemoveUWPapp!"=="" ( ECHO !RemoveUWPapp! "%DISM11%" /english /quiet /Image:"%~dp0mount" /Remove-ProvisionedAppxPackage /PackageName:"!RemoveUWPapp!" ) ) 2. When executing this code, it gives an error: """" is not an internal or external command, essotable program or batch fillet Spoiler Code: ECHO. ECHO ==================================== ECHO Cleanup spsuperseded of install.wim ECHO ==================================== "%DISM11%" /English /Image:"%~dp0mount" /Cleanup-Image /spsuperseded 3. When executing this code, an error is generated and the Remove-Edge command is not executed: Spoiler Code: echo. echo. echo ============================================================ echo Remove-Edge echo ============================================================ "%DISM11%" /English /image:"%~dp0mount" /Remove-Edge But if you write the code like this, the Remove-Edge command will run normally. Spoiler Code: echo. echo. echo ============================================================ echo Remove-Edge echo ============================================================ Dism /Image:"%~dp0mount" /Remove-Edge Otherwise everything is fine, no errors.
Will this command also remove edge webview2? I was hoping for a command that would only remove the edge browser, leaving edge webview2.
\Windows\System32\Microsoft-Edge-WebView will be retained, but some software will only recognize this path: \Program Files (x86)\Microsoft\EdgeWebView You can just delete it like this rd /s /q "mount\Program Files (x86)\Microsoft\Edge" rd /s /q "mount\Program Files (x86)\Microsoft\EdgeCore" rd /s /q "mount\Program Files (x86)\Microsoft\EdgeUpdate"
Did you change anything in the DISM definition? This seems to be happening because of the Host OS and the configured DISM... Your Host OS is Windows 11, correct? Try changing in command from %DISM11% to %DISM10% and see if everything works... I'll test it on the Windows 11 Host OS to see what happens.
This command removes Edge and all its remnants. It does not remove WebView2. But one command blocks the installation of WebView2, as mentioned in a few topics before and as suggested by @sergey130270: https://forums.mydigitallife.net/th...ic-legacy-windows.86552/page-124#post-1873478
In the first test I ran 24H2_Integrator_10.0_Start.cmd. I ran another test, this time I ran Start10.0.cmd. Same result, no errors. I don't know what's going on there... You could try @wuliyen's suggestion above.
Got it, thanks, I'll try to experiment with this option Removes Appx Packages and Appx Provisioned Packages for All Users: Spoiler Code: DISM.exe /Image:<path_to_image_directory> [/Get-ProvisionedAppxPackages | /Add-ProvisionedAppxPackage | /Remove-ProvisionedAppxPackage | /Set-ProvisionedAppxDataFile | /StubPackageOption]
hi @wuliyen, does this ps1 script does the job or could you share yours please ? Code: # Define a function to convert wildcard patterns to regex function Convert-WildcardToRegex { param($pattern) $regex = [regex]::Escape($pattern) -replace '\\\*', '.*' return $regex } # Define paths $sourceDirectory = "C:\TEMP\scratchdir\Windows\WinSxS" $destinationDirectory = "C:\TEMP\scratchdir\Windows\WinSxS_edit" $manifestSource = Join-Path -Path $sourceDirectory -ChildPath "Manifests" $manifestDest = Join-Path -Path $destinationDirectory -ChildPath "Manifests" # Define the list of directory patterns to retain in WinSxS $dirsToCopy = @( "amd64_microsoft-windows-deployment_*", "amd64_microsoft-windows-g..ntservice.resources_*_zh-cn_*", "amd64_microsoft-windows-international-core_*", "amd64_microsoft-windows-p..ing-lpdprintservice_*", "amd64_microsoft-windows-p..ntservice.resources_*_zh-cn_*", "amd64_microsoft-windows-p..rtmonitor.resources_*_zh-cn_*", "amd64_microsoft-windows-p..ting-lprportmonitor_*", "amd64_microsoft-windows-printing-powershell_*", "amd64_microsoft-windows-security-spp-ux_*", "amd64_microsoft-windows-servicingstack_*", "amd64_microsoft-windows-shell-setup_*", "amd64_microsoft-windows-tapicore.resources_*_zh-cn_*", "amd64_microsoft-windows-tapicore_*", "amd64_microsoft-windows-unattendedjoin_*", "amd64_microsoft-windows-userdeviceregistration_*", "amd64_microsoft.vc80.*", "amd64_microsoft.vc90.*", "amd64_microsoft.windows.c..-controls.resources_*_5.82.*_zh-cn_*", "amd64_microsoft.windows.c..-controls.resources_*_6.0.*_zh-cn_*", "amd64_microsoft.windows.common-controls_*_5.82.*", "amd64_microsoft.windows.common-controls_*_6.0.*", "amd64_microsoft.windows.gdiplus_*", "amd64_microsoft.windows.i..utomation.proxystub_*", "amd64_microsoft.windows.isolationautomation_*", "wow64_microsoft-windows-printing-powershell_*", "wow64_microsoft-windows-tapicore.resources_*_zh-cn_*", "wow64_microsoft-windows-tapicore_*", "x86_microsoft.vc80.*", "x86_microsoft.vc90.*", "x86_microsoft.windows.c..-controls.resources_*_5.82.*_zh-cn_*", "x86_microsoft.windows.c..-controls.resources_*_6.0.*_zh-cn_*", "x86_microsoft.windows.common-controls_*_5.82.*", "x86_microsoft.windows.common-controls_*_6.0.*", "x86_microsoft.windows.gdiplus_*", "x86_microsoft.windows.i..utomation.proxystub_*", "x86_microsoft.windows.isolationautomation_*" ) # Define the list of file patterns to retain in WinSxS\Manifests $filesToCopy = @( "amd64_microsoft-windows-com-dtc-runtime_*", "amd64_microsoft-windows-coreos-revision_*", "amd64_microsoft-windows-deployment_*", "amd64_microsoft-windows-enhancedstorage-adm_*", "amd64_microsoft-windows-explorer_*", "amd64_microsoft-windows-g..ntservice.resources_*", "amd64_microsoft-windows-i..national-core-winpe_*", "amd64_microsoft-windows-international-core_*", "amd64_microsoft-windows-p..ing-lpdprintservice_*", "amd64_microsoft-windows-p..ntservice.resources_*", "amd64_microsoft-windows-p..rtmonitor.resources_*", "amd64_microsoft-windows-p..ting-lprportmonitor_*", "amd64_microsoft-windows-printing-powershell_*", "amd64_microsoft-windows-r..-service.deployment_*", "amd64_microsoft-windows-security-spp-ux_*", "amd64_microsoft-windows-servicingstack_*", "amd64_microsoft-windows-setup_*", "amd64_microsoft-windows-shell-setup_*", "amd64_microsoft-windows-unattendedjoin_*", "amd64_microsoft.vc80.*", "amd64_microsoft.vc90.*", "amd64_microsoft.windows.c..-controls.resources_*_5.82.*_zh-cn_*", "amd64_microsoft.windows.c..-controls.resources_*_6.0.*_zh-cn_*", "amd64_microsoft.windows.common-controls_*_5.82.*", "amd64_microsoft.windows.common-controls_*_6.0.*", "amd64_microsoft.windows.gdiplus_*_1.0.*", "amd64_microsoft.windows.gdiplus_*_1.1.*", "amd64_microsoft.windows.i..utomation.proxystub_*", "amd64_microsoft.windows.isolationautomation_*", "amd64_microsoft.windows.systemcompatible_*", "amd64_policy.8.0.microsoft.vc80.*", "amd64_policy.9.0.microsoft.vc90.*", "wow64_microsoft-windows-printing-powershell_*", "wow64_microsoft.windows.gdiplus.systemcopy_*", "x86_microsoft.vc80.*", "x86_microsoft.vc90.*", "x86_microsoft.windows.c..-controls.resources_*_5.82.*_zh-cn_*", "x86_microsoft.windows.c..-controls.resources_*_6.0.*_zh-cn_*", "x86_microsoft.windows.common-controls_*_5.82.*", "x86_microsoft.windows.common-controls_*_6.0.*", "x86_microsoft.windows.gdiplus_*_1.0.*", "x86_microsoft.windows.gdiplus_*_1.1.*", "x86_microsoft.windows.i..utomation.proxystub_*", "x86_microsoft.windows.isolationautomation_*", "x86_microsoft.windows.systemcompatible_*", "x86_policy.8.0.microsoft.vc80.*", "x86_policy.9.0.microsoft.vc90.*" ) # Convert patterns to regex for efficient matching $dirRegex = ($dirsToCopy | ForEach-Object { Convert-WildcardToRegex $_ }) -join "|" $fileRegex = ($filesToCopy | ForEach-Object { Convert-WildcardToRegex $_ }) -join "|" # Create the destination directory New-Item -Path $destinationDirectory -ItemType Directory -Force # Copy retained directories from WinSxS $sourceDirs = Get-ChildItem -Path $sourceDirectory -Directory | Where-Object { $_.Name -match $dirRegex } foreach ($sourceDir in $sourceDirs) { $destDir = Join-Path -Path $destinationDirectory -ChildPath $sourceDir.Name Write-Host "Copying $($sourceDir.FullName) to $destDir" Copy-Item -Path $sourceDir.FullName -Destination $destDir -Recurse -Force } # Create Manifests directory in the destination and copy retained files New-Item -Path $manifestDest -ItemType Directory -Force $manifestFiles = Get-ChildItem -Path $manifestSource -File | Where-Object { $_.Name -match $fileRegex } foreach ($file in $manifestFiles) { Write-Host "Copying $($file.FullName) to $manifestDest" Copy-Item -Path $file.FullName -Destination $manifestDest -Force } # Delete the original WinSxS folder Write-Host "Deleting WinSxS. This may take a while..." Remove-Item -Path $sourceDirectory -Recurse -Force # Rename the temporary directory to replace WinSxS Rename-Item -Path $destinationDirectory -NewName "WinSxS" Write-Host "Complete!"
Change this to your language code, _zh-cn_. Rename WinSxS folder New WinSxS folder Delete renamed folder after copying files
Good afternoon I don't know if you managed to solve the problem... I made some adjustments here. Try these and see if it works well for you. no password
Good day, so far I haven't been able to solve the problem. Thank you very much, I'll try your version of the script.
SunLion, I tested this version of the script, everything is fine - The operation completed successfully. Thank you very much for your efforts!