I am happy that there are 2 unlikes for my scripts . If somebody unlikes the scripts then must write a comment why he unliked it & for what function of script he didn't like. but as there's nobody who has posted negative comments about the scripts what to say ?
Uploaded & Updated Link to Download Windows 10 LTSC Debloater With SystemApps Removal & Some More Changes Too. Enjoy Your LTSC Debloated ISO too From Now Onwards.
Completed debloated Offline Script with disabled Telemetry using offline Registry Hive Load then apply Registry Hives to HKLM\SOFTWARE , HKLM\SYSTEM and HKCU via NTUSER.dat then Unload & create a fully final Debloated plus Removed Telemetry ISO of Win10. Won't Upload it in Public as its for my own personal Use.
Updated Win10 Online Tweaker With Some More Powershell Function & Remove Logs Directories Plus Log Files Win10 Tweaker by Mydigitallife User
idk why people dont comment after they dislike the script & if they have any suggestion will be considered at priority.
@mdl052020 , I really liked that site that you put in your main post (download the scripts), if I knew that page (privacy sexy) a few months ago it would have saved me a lot of time. heheheh Basically I went hunting for what I needed and added the privacy options to CustomToolkit. I organized the application code of the customized Tweaks to make it easier for anyone who wants to edit. A suggestion: that I also sent to the MSMG. And, I already put it in the CustomToolkit, but like the reorganization of the tweaks, this change also does not affect functionality. So, I'm not going to upgrade yet since I will just reduce the code. The suggestion is based on a very good command, seen in the abbodi1406 scripts. It is very interesting to reduce tons of characters. Maybe you like it! I'm looking at "create_virtual_editions.cmd" and saw a simple and interesting variable. Great idea from abbodi1406. I named the variable as asteriskline but you can put a smaller name, that was what came to mind. set "asteriskline=*****************************************************************" So I replaced all the lines: echo ***************************************************************** for echo %asteriskline% It reduces a ton of characters. For example: Code: set "asteriskline=*****************************************************************" echo. echo %asteriskline% echo * Offline Win10 Wim Servicing Batch Script * echo * (c) 2020 by Mydigitallife User * echo * This Project Works Only on 64Bit Host OS * echo * Please Disable Your Antivirus * echo %asteriskline% echo. echo %asteriskline% echo * Getting Admin Privileges echo %asteriskline% REM --> Check for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges... goto UACPrompt) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /B :gotAdmin echo %asteriskline% echo. & color 02 echo %asteriskline% echo * Extracting ISO Image with Name Win10 to Script Path echo %asteriskline% I agree with @Tiger-1. There will always be haters. They will not make constructive criticisms. Still, those who criticize have some concern to see the business progress. The haters are envious. And, your initiative @mdl052020, is very top!
Thanks a lot brother . your comment means a lot to me . i have done it as advised by you to use env variable rather using echo then equal sign everywhere . if you can help me in export- windowsimage option as i want user to select the edition of his choice from grid view & after user will press ok the same edition which user has selected will export. i havent found anything on this anywhere . if you can help me on this will be very thankfull.
Another suggestion: An opening note informing the first steps, such as: making sure that the iso is in the script folder, etc. Spoiler: now it works Code: @echo off & title Offline Windows 10 Pro or LTSC Image Servicing by MyDigitalLife User set "asteriskline=*****************************************************************" echo. & color 01 echo %asteriskline% echo * Offline Win10 Wim Servicing Batch Script echo * (c) 2020 by MyDigitalLife User echo * This Project Works Only on 64Bit Host OS echo * Please Disable Your Antivirus echo. echo Project Started at & Powershell -Command "Get-Date" echo %asteriskline% echo * Get Admin Privileges echo %asteriskline% if not "%1"=="am_admin" powershell start -verb runas '%0' am_admin & exit /b call :RemovingAllCreatedDirectoriesandFilesofProject echo %asteriskline% echo. & color 02 echo %asteriskline% echo --- Extracting ISO to Script Path and Creating Mount Directory echo %asteriskline% cd %~dp0 set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 1 Project\7z.exe x -y -o"Win10" "*.iso" md "Mount" echo %asteriskline% echo. & color 03 echo %asteriskline% set Flag= set Edition= set SourceTitle= set SourceName= echo. echo. [1] Windows 10 Home echo. echo. [2] Windows 10 Pro echo. echo. [3] Windows 10 Enterprise LTSC echo. echo. echo %asteriskline% choice /C:123 /N /M "Enter Your Choice :" if errorlevel 3 ( set "Flag=Enterprise" set "Edition=Enterprise LTSC" set "SourceTitle=Windows 10 LTSC" set "SourceName=Windows 10 Enterprise LTSC" ) if errorlevel 2 ( set "Flag=Pro" set "Edition=Professional" set "SourceTitle=Windows 10 Pro" set "SourceName=Windows 10 Pro" ) if errorlevel 1 ( set "Flag=Core" set "Edition=Home" set "SourceTitle=Windows 10 Home" set "SourceName=Windows 10 Home" ) echo %asteriskline% echo. & color 75 echo %asteriskline% PowerShell -Command "Get-WindowsImage -ImagePath 'Win10\sources\install.wim' | Select-Object -Property ImageName,ImageIndex" echo %asteriskline% set IndexChoice= set /p IndexChoice=##### Enter Single Image Index Number You Want to Export ###### : echo %asteriskline% echo. echo %asteriskline% echo. & color 06 echo %asteriskline% echo --- Export Windows 10 Single Index of Your Choice to Script Path echo %asteriskline% Powershell -Command "Export-WindowsImage -SourceImagePath 'Win10\sources\install.wim' -SourceName %IndexChoice% -DestinationImagePath 'install.wim'" echo %asteriskline% echo. & color 17 echo %asteriskline% echo --- Moving Back Exported WIM Image to its Source Path echo %asteriskline% move /y "install.wim" "Win10\sources\install.wim" echo %asteriskline% echo. & color 20 echo %asteriskline% echo --- Mounting Exported Single Selected Index WIM image to Mount Directory echo %asteriskline% Powershell -Command "Mount-WindowsImage -ImagePath 'Win10\sources\install.wim' -Index 1 -Path 'Mount'" call :SelectandRemoveProvisionedWindowsApps call :SelectandRemoveSystemApps call :SelectandRemoveScheduledTasks call :SelectandDisableUnNeededWindowsFeatures call :SelectandRemoveUnNeededWindowsCapabilitiesandWindowsPackages call :RemoveOneDrive goto :FinalTasks :SelectandRemoveProvisionedWindowsApps echo %asteriskline% echo. & color 24 echo %asteriskline% echo --- Select and Remove Provisioned Windows Apps echo %asteriskline% Powershell -Command "Get-AppXProvisionedPackage -Path 'Mount' | Out-GridView -PassThru -Title 'Select Windows AppX Provisioned Packages to Remove' | Remove-AppxProvisionedPackage -Path 'Mount'" rem Powershell -Command "Get-AppXProvisionedPackage -Path 'Mount' | Out-GridView -PassThru -Title 'Select Windows Apps to Remove' | Remove-AppxProvisionedPackage -Path 'Mount'" goto :EOF :SelectandRemoveSystemApps echo %asteriskline% echo. & color 27 echo %asteriskline% echo --- Select and Remove System Apps echo %asteriskline% echo. echo [SystemApps SaFe For Removal] echo. echo FileExplorer echo FilePicker echo AddSuggestionFoldersToLibraryDialog echo AADBrokerPlugin echo BioEnrollment echo ECApp echo LockApp echo EdgeDevToolsClient echo Edge echo Win32WebViewHost echo AppRep.ChxApp echo AssignedAccessLockApp echo CallingShellApp echo CapturePicker echo ContentDeliveryManager echo ParentalControls echo PeopleExperienceHost echo XboxGameCallableUI echo XgpuEjectDialog echo CbsPreview echo. reg load "HKLM\OfflineSOFTWARE" "Mount\Windows\System32\config\SOFTWARE" call :TakeKeyOwnership "HKLM\OfflineSOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\InboxApplications" -y Powershell -Command "Get-ChildItem -Path 'HKLM:\OfflineSOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\InboxApplications' | Out-GridView -PassThru -Title 'Select System Apps to Remove' | Remove-Item -Force -Confirm:$False" reg unload "HKLM\OfflineSOFTWARE" goto :EOF :SelectandRemoveScheduledTasks echo %asteriskline% echo --- Select and Remove Scheduled Tasks echo %asteriskline% reg load "HKLM\OfflineSOFTWARE" "Mount\Windows\System32\config\SOFTWARE" call :TakeKeyOwnership "HKLM\OfflineSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule" -y Powershell -Command "Get-ChildItem -Path 'HKLM:\OfflineSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows' | Out-GridView -PassThru -Title 'Select Scheduled Tasks to Remove' | Remove-Item -Recurse -Force -Confirm:$False" reg unload "HKLM\OfflineSOFTWARE" goto :EOF :SelectandDisableUnNeededWindowsFeatures echo %asteriskline% echo. & color 30 echo %asteriskline% echo --- Select and Disable UnNeeded Windows Features echo %asteriskline% Powershell -Command "Get-WindowsOptionalFeature -Path 'Mount' | Where-Object {$_.State -eq 'Enabled' } | Out-GridView -PassThru -Title 'Select Windows Optional Features to Disable' | Disable-WindowsOptionalFeature -Path 'Mount'" goto :EOF :SelectandRemoveUnNeededWindowsCapabilitiesandWindowsPackages echo %asteriskline% echo. & color 34 echo %asteriskline% echo --- Select and Remove UnNeeded Windows Capabilities [Packages] echo %asteriskline% Powershell -Command "Get-WindowsCapability -Path 'Mount' | Where-Object {$_.State -eq 'Installed' } | Out-GridView -PassThru -Title 'Select Windows Capabilities to Disable' | Remove-WindowsCapability -Path 'Mount'" echo. echo %asteriskline% echo --- Select and Remove Windows Packages (Not Recommended If Unsure) echo %asteriskline% Powershell -Command "Get-WindowsPackage -Path 'Mount' | Where-Object {$_.PackageState -eq 'Installed' } | Out-GridView -PassThru -Title 'Select Windows Packages to Remove' | Remove-WindowsPackage -Path 'Mount'" goto :EOF :RemoveOneDrive echo %asteriskline% echo. & color 53 echo %asteriskline% echo --- Remove OneDrive echo %asteriskline% echo --- Removing OneDrive Package Using Tweaker by Legolash2o echo. "Project\tweaker.exe" /p Mount /c "Microsoft-Windows-OneDrive" /r echo. echo --- Removed OneDrive Package goto :EOF :FinalTasks echo %asteriskline% echo. & color 60 echo %asteriskline% echo --- Clearing Winsxs Components and Reset Base echo %asteriskline% DISM /Image:Mount /Cleanup-Image /StartComponentCleanup /ResetBase echo %asteriskline% echo. & color 70 echo %asteriskline% echo --- Optimizing Offline WIM Image and Checking Health echo %asteriskline% echo --- Optimizing Tweaked Image Powershell -Command "Optimize-WindowsImage -Path "Mount" -OptimizationTarget "WIMBoot"" echo. echo --- Checking Health Status of Tweaked Image Powershell -Command "Repair-WindowsImage -Path "Mount" -CheckHealth" echo %asteriskline% echo. & color 72 echo %asteriskline% echo --- Saving and Unmounting Final Debloated Image echo %asteriskline% Powershell -Command "Dismount-WindowsImage -Path 'Mount' -Save -CheckIntegrity" echo %asteriskline% echo. & color 75 echo %asteriskline% echo --- Exporting Final Image Again to Script Path to clear stale [Deleted] directory created inside Final Image echo %asteriskline% Powershell -Command "Export-WindowsImage -SourceImagePath 'Win10\sources\install.wim' -SourceIndex 1 -DestinationImagePath 'install.wim' -CompressionType Max" echo %asteriskline% echo. echo %asteriskline% echo --- Moving Back Exported Image to its Source Path echo %asteriskline% move /y "install.wim" "Win10\sources\install.wim" echo %asteriskline% echo. echo %asteriskline% echo --- Creating Updated %SourceTitle% ISO echo %asteriskline% cd "%~dp0Win10" %~dp0Project\oscdimg.exe -o -m -u2 -udfver102 -bootdata:2#p0,e,b".\boot\etfsboot.com"#pEF,e,b".\efi\microsoft\boot\efisys.bin" "%~dp0Win10" "%~dp0W10-%Edition%_Debloated[%date%].iso" call :RemovingAllCreatedDirectoriesandFilesofProject goto :Stop :RemovingAllCreatedDirectoriesandFilesofProject echo %asteriskline% echo. echo %asteriskline% echo --- Removing All Created Directories and Files of Project echo %asteriskline% cd %~dp0 Powershell -Command "Clear-WindowsCorruptMountPoint" 1>nul 2>nul DISM /Cleanup-Wim 1>nul 2>nul rmdir /s /q "Win10" rmdir /s /q "Project" rmdir /s /q "%~dp0Mount" del /f /q "%~dp0SOFTWAREBKP" rem rmdir /s /q "%tmp%\WPF" goto :EOF :Stop set IndexChoice= set SourceName= set SourceTitle= set Edition= set Flag= echo %asteriskline% echo. & color 02 echo %asteriskline% echo --- Finished Offline Image Servicing. echo ------ Enjoy Debloated ISO Using a Single Script. echo ------------ Special thanks to @AveYo @BAU for Compressed2TxT Script echo ------------------ https://github.com/AveYo/Compressed2TXT echo ------------------------ https://pastebin.com/u/AveYo echo Project Completed at & Powershell -Command "Get-Date" echo %asteriskline% pause :bat2file: Compressed2TXT v6.2 $k='.,;{-}[+](/)_|^=?O123456789ABCDeFGHyIdJKLMoN0PQRSTYUWXVZabcfghijklmnpqrstuvwxz!@#$&~E<*`%\>'; Add-Type -Ty @' using System.IO; public class BAT91 {public static void Dec (ref string[] f, int x, string fo, string key) { unchecked { byte[] b91=new byte[256]; int n=0,c=255,v=91,q=0,z=f[x].Length; while (c>0) b91[c--]=91; while(c<91) b91[key[c]]=(byte)c++; using (FileStream o=new FileStream(fo,FileMode.Create)) { for (int i=0; i != z; i++) { c=b91[ f[x][i] ]; if (c == 91) continue; if (v == 91) {v = c;} else {v += c * 91; q |= v << n; if ((v & 8191) > 88) {n += 13;} else {n += 14;} v = 91; do {o.WriteByte((byte)q); q >>= 8; n -= 8;} while (n>7);} } if (v != 91) o.WriteByte((byte)(q | v << n)); } }}} '@; cd -lit (Split-Path $env:0); function X([int]$x=1) {[BAT91]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force} :bat2file:[ Project :bat2file:] :TakeKeyOwnership %1:regpath[ex:"HKCU\Console"] %2:_recurse[optional, default:"-n", "-y"] %3:_sid[optional, default:"S-1-5-32-545"] set "s10=function TakeKeyOwnership { param($regp, $all, $owner); $recurse=($all -eq '-y'); $RP=($regp -split '\\',2); $key=$RP[1];" set "s11= switch -regex ($RP[0]) { 'HKLM|HKEY_LOCAL_MACHINE' {$HK='LocalMachine'};'HKCC|HKEY_CURRENT_CONFIG' {$HK='CurrentConfig'};" set "s12= 'HKCR|HKEY_CLASSES_ROOT' {$HK='ClassesRoot'};'HKU|HKEY_USERS' {$HK='Users'};'HKCU|HKEY_CURRENT_USER' {$HK='CurrentUser'}" set "s13= }; $rootKey=$HK; if ($owner -eq '') {$owner='S-1-5-32-545'}; [System.Security.Principal.SecurityIdentifier]$sid=$owner;" set "s14= $import='[DllImport("ntdll.dll")] public static extern int RtlAdjustPrivilege(ulong a, bool b, bool c, ref bool d);';" set "s15= $ntdll=Add-Type -Member $import -Name NtDll -PassThru; $privileges=@{ SeTakeOwnership=9; SeBackup=17; SeRestore=18 };" set "s16= foreach ($i in $privileges.Values) { $null=$ntdll::RtlAdjustPrivilege($i, 1, 0, [ref]0) };" set "s17= function Take-KeyPermissions { param($rootKey, $key, $sid, $recurse, $recurseLevel=0);" set "s18= $regKey=[Microsoft.Win32.Registry]::$rootKey.OpenSubKey($key, 'ReadWriteSubTree', 'TakeOwnership');" set "s19= $acl=New-Object System.Security.AccessControl.RegistrySecurity; $acl.SetOwner($sid); $regKey.SetAccessControl($acl);" set "s20= $acl.SetAccessRuleProtection($false, $false); $regKey.SetAccessControl($acl);" set "s21= if ($recurseLevel -eq 0) { $regKey=$regKey.OpenSubKey('', 'ReadWriteSubTree', 'ChangePermissions');" set "s22= $rule=New-Object System.Security.AccessControl.RegistryAccessRule($sid,'FullControl','ContainerInherit','None','Allow');" set "s23= $acl.ResetAccessRule($rule); $regKey.SetAccessControl($acl) };" set "s24= if ($recurse) { foreach($subKey in $regKey.OpenSubKey('').GetSubKeyNames()) {" set "s25= Take-KeyPermissions $rootKey ($key+'\'+$subKey) $sid $recurse ($recurseLevel+1) } };" set "s26= }; $ErrorActionPreference='Continue'; Take-KeyPermissions $rootKey $key $sid $recurse }" for /l %%# in (10,1,26) do call set "ps_TakeKeyOwnership=%%ps_TakeKeyOwnership%%%%s%%#:"=\"%%" powershell.exe -c "%ps_TakeKeyOwnership%; try { TakeKeyOwnership '%~1' '%~2' '%~3' } catch {}" I removed that line: "echo. & color 53" because there was another one setting another color next. I left the color that was in that same position, in the other script (echo. & Color 60). The implementation of the choice follows the same directive that I did in the menu for the choice of launching the Toolkit, Toolkit_Beta, CustomToolkit and CustomToolkit_Beta. In the 3 Scripts I saw a lot that was updated in some, but not in others. I merged the 3. Someone suggested replacing SourceName with SourceIndex, but I don't know if that was in the command or elsewhere in the code. So I didn't touch it. Attached is a merged version for you to test. The Toolkit launcher file is also in the package. I removed the compressed binary part to text. Code: :bat2file:[ Project . . . :bat2file:] You have to put it again. I was not able to attach was accusing it as too large file. Edit: I put all the changes I made in SPOILER. I leave it there only for new ideas.
What i was asking to you is if you have any idea of exporting user choice index from wim indexes menu but you havent suggested me that rather you are suggesting me other things that wont do any change in script as usual . Edit : Even you could suggest me try wimlib or M$ imagex but havent . i know how to use both of them but dont want to use them cuz i need Powershell to First Get Out-GridView of Wim Indexes then whichever index is selected by user will be exported to script path.
Oh, right! I don't understand that part that you are mentioning, hehehe! Maybe I won't be able to help you with that. Edit 2020-10-22 - I started to understand this Out-GridView scheme, I was able to generate output and use it as an input in the image export command. I am enjoying learning about it.
Updated Offline Win10 ISO Debloater with Many New Functions. See Chengelog. Edit : Next Update Will Include $OEM$ Inside Project Directory to be Extracted at Sources Directory of ISO for Telemetery Tweaks Upon Installation Plus AutoUnattended.xml too to be extracted at source ISO Root.
Can be. But here, the "choice" and "if" commands are not necessary, as this section of the code is after the unmount. Then a command brings the information of the image already finished and unmounted, then the command "set / p" will pause so that, with the information, the user only enters the desired INDEX number. So, I deduce that the export command will save only the selected index. That, if I understood correctly what you meant. But since I don't understand the use of "%%i", I can't deduce much more than that. The modified file I sent earlier was buggy, I corrected the parts I suggested and organized it in another way that I see as more generic for future implementations, but it was not working 100%. At least to work the parts I suggested, everything is fine. But when I finished, you had already released the new version that was very top. Nice that the idea of "IndexNumber", now "IndexChoice", worked. With this new version that you posted I really understood that there is no need to put a menu with a choice for editions. Only the information of the image indexes that are not being shown. Another suggestions: After selecting the index, identify the Edition to be placed in the ISO name. Save the final iso outside the project folder, because if you run the script again you will lose the ISO already made. Maybe that scheme of choosing to save to another drive or create an ISO folder inside the script folder, which is permanent (free from the cleaning process). Forcing unmount at the beginning of the script can avoid some problems.
Below the red part I was already talking about the new version. Edit: I downloaded the new version again and was trying to use it as an example to make the previous version that I was working on, work... I found some typo and managed to work!