@echo off

::------------------------------------------------------------------------------
:: MSMG ToolKit v13.7
:: Copyright (c) 2013-2024 MSMG. All rights reserved.
::------------------------------------------------------------------------------
::
:: Credits: CREDITS.TXT
:: License: LICENSE.TXT
:: 3rd Party License: <Bin\LICENSES>
::
::-------------------------------------------------------------------------------------------

title MSMG Toolkit v13.7

:: Set default console background and foreground color
color 1f
set ConsoleBackColor=Blue
set ConsoleForeColor=White

cd /D "%~dp0" >nul
set "ROOT=%cd%"
cd /D "%ROOT%\" >nul

if not "%cd%"=="%cd: =%" (
	echo.=========================================================
	echo.Current Toolkit directory contains spaces in its path.
	echo.Please move or rename the directory to one not containing
	echo.spaces.
	echo.=========================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	color 00
	endlocal
	exit
)

reg add "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v "ScreenBufferSize" /t REG_DWORD /d "0x23290050" /f >nul
reg add "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v "WindowSize" /t REG_DWORD /d "0x190050" /f >nul

reg add "HKU\.DEFAULT\Console" /v "FaceName" /t REG_SZ /d "Consolas" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontFamily" /t REG_DWORD /d "0x36" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontSize" /t REG_DWORD /d "0x100000" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontWeight" /t REG_DWORD /d "0x190" /f >nul
reg add "HKU\.DEFAULT\Console" /v "ScreenBufferSize" /t REG_DWORD /d "0x23290050" /f >nul

setlocal EnableExtensions EnableDelayedExpansion

:: Setting Toolkit environment path variables
set "Bin=%ROOT%\Bin"
set "Custom=%ROOT%\Custom"
set "Drivers=%ROOT%\Drivers"
set "DVD=%ROOT%\DVD"
set "ISO=%ROOT%\ISO"
set "Logs=%ROOT%\Logs"
set "Mount=%ROOT%\Mount"
set "Packs=%ROOT%\Packs"
set "Temp=%ROOT%\Temp"
set "Updates=%ROOT%\Updates"
set "WHD=%ROOT%\WHD"

:: Setting Host OS version, architecture and language variables
set HostArchitecture=
set HostBuild=
set HostReleaseVersion=
set HostDisplayVersion=
set HostEdition=
set HostInstallationType=
set HostOSName=
set HostServicePackBuild=
set HostVersion=
set HostUILanguage=
set HostLanguage=
set HostPartiallyLocalized=
set HostLanguageFallback=

if exist "%WinDir%\SysWOW64" (set "HostArchitecture=x64") else (set "HostArchitecture=x86")
for /f "tokens=3 delims= " %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild" ^| find "REG_SZ"') do (set HostBuild=%%i)
for /f "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /f "ReleaseId" ^| find "REG_SZ"') do (set /A HostReleaseVersion=%%j & if "%%j" lss "2004" set /A HostDisplayVersion=%%j)
if "%HostDisplayVersion%" equ "" for /f "tokens=3 delims= " %%k in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "DisplayVersion" ^| find "REG_SZ"') do (set "HostDisplayVersion=^(%%k^)")
for /f "tokens=3 delims= " %%l in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID" ^| find "REG_SZ"') do (set HostEdition=%%l)
for /f "tokens=3 delims= " %%m in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "InstallationType" ^| find "REG_SZ"') do (set HostInstallationType=%%m)
for /f "tokens=7 delims=[]. " %%r in ('ver 2^>nul') do (set /A HostServicePackBuild=%%r)
for /f "tokens=4-5 delims=[]. " %%s in ('ver 2^>nul') do (set "HostVersion=%%s.%%t" & set "HostOSVersion=%%s")
if "%HostVersion%" equ "6.1" set "HostOSVersion=7 SP1"
if "%HostVersion%" equ "6.3" set "HostOSVersion=8.1"
if "%HostVersion%" equ "10.0" if "%HostBuild%" geq "21996" set "HostOSVersion=11"
set "HostOSName=Windows %HostOSVersion% %HostEdition% %HostInstallationType%"

for /f "tokens=3 delims=\ " %%o in ('reg query "HKCU\Control Panel\International\User Profile" /s /v "Languages" ^| findstr /I "REG_ _SZ"') do (set "HostLanguage=%%o")
for /f "tokens=6 delims= " %%o in ('DISM /Online /English /Get-Intl ^| findstr /i /C:"Default system UI language"') do (set HostUILanguage=%%o)
if "%HostLanguage%" equ "" set "HostLanguage=%HostUILanguage%"
for /f "tokens=2 delims=:, " %%l in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Partially localized language"') do (set "HostPartiallyLocalized=%%l")
if "%HostPartiallyLocalized%" equ "Partially" for /f "tokens=2 delims=:" %%t in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"language fallback is"') do (set "HostLanguageFallback=%%t")
if "%HostPartiallyLocalized%" equ "Partially" if "%HostLanguageFallback%" equ "" set "HostLanguageFallback= en-US"
if "%HostLanguageFallback%" neq "" set "HostLanguageFallback=%HostLanguageFallback:~1%"

for /f "tokens=3-4 delims=:, " %%k in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Active keyboard(s)"') do (set "HostActiveKeyboard=%%k:%%l")
rem Windows Default pt-BR Layout is ABNT "0416:00000416". But popular Layout is ABNT2 "0416:00010416"
if "%HostActiveKeyboard%" equ "0416:00000416" set "HostActiveKeyboard=0416:00010416"
for /f "tokens=2 delims=:" %%f in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Default time zone"') do (set "HostTimeZone=%%f")
set "HostTimeZone=%HostTimeZone:~1%"

:: Setting WADK tools environment path variables
if "%HostVersion%" equ "6.1" set "DISM=%Bin%\%HostArchitecture%\DISM81\Dism.exe"
if "%HostVersion%" neq "6.1" set "DISM=%Bin%\%HostArchitecture%\DISM10\Dism.exe"
set "DismScratch=%Temp%\DISM"
set "DismFormat=/English /ScratchDir:%DismScratch% /LogPath:%Logs%\Dism.txt /LogLevel:3 /NoRestart"
set "Imagex=%Bin%\%HostArchitecture%\imagex.exe"
set "Oscdimg=%Bin%\%HostArchitecture%\oscdimg.exe"
set "Dvdburn=%Bin%\dvdburn.exe"
set "WimConfigFile=%Bin%\wimscript.ini"

:: Setting Source OS variables
set SelectedSourceOS=
set OSID=
set "BootWim=%DVD%\sources\boot.wim"
set "InstallWim=%DVD%\sources\install.wim"
set "InstallEsd=%DVD%\sources\install.esd"
set "WinReWim=Windows\System32\Recovery\winre.wim"
set "BootMount=%Mount%\Boot"
set "InstallMount=%Mount%\Install"
set "WinReMount=%Mount%\WinRE"

:: Setting Source Image information variables
set ImageCount=
set ImageIndexNo=
set ImageArchitecture=
set ImageName=
set ImageDescription=
set ImageFlag=
set ImageEdition=
set ImageInstallationType=
set ImageDefaultLanguage=
set ImageUILanguage=
set ImageLanguage=
set ImageMajorVersion=
set ImageMinorVersion=
set ImageBuild=
set ImageVersion=
set ImageServicePackBuild=
set ImageServicePackLevel=
set PackageBuild=
set PackageVersion=
set PackageServicePackBuild=
set DefaultIndexNo=

:: Setting Toolkit's control flag variables
set "IsSourceSelected=No"
set "IsBootImageSelected=No"
set "IsRecoveryImageSelected=No"
set "IsDialogsEnabled=Yes"
set "IsLogsEnabled=Yes"
set "IsImageRegistryLoaded=No"
set "IsW7SP1CRUSelected=No"
set "IsCustomRemovalBuild=No"

set "SourceData=Host"
set "Unattend_AutoLogon=Disabled"
set "Unattend_Theme=Dark"
set "Unattend_LocaleLanguage=%HostLanguage%"
set "Unattend_UILanguage=%HostUILanguage%"
set "Unattend_LanguageFallback=%HostLanguageFallback%"
set "Unattend_InputLocale=%HostActiveKeyboard%"
set "Unattend_TimeZone=%HostTimeZone%"
set "UnattendXML_Path=%DVD%\Autounattend.xml"

set "PreActTokens=%Custom%\ActivationTokens"
set "CustomFiles=%Custom%\Files"
set "CustomFonts=%Custom%\Fonts"
set "CustomRecoveryImage=%Custom%\RecoveryImage"
set "CustomRegistry=%Custom%\Registry"
set "CustomTerminalServer=%Custom%\TerminalServer"
set "CustomUxTheme=%Custom%\UxTheme"

:: Setting Toolkit's packs environment path variables
set "Apps=%Packs%\Apps"
set "AppLicense=%Bin%\AppLicense"
set "Braille=%Packs%\Braille"
set "DaRT=%Packs%\DaRT"
set "Dedup=%Packs%\Dedup"
set "DirectX9c=%Packs%\DirectX9c"
set "EdgeClassic=%Packs%\EdgeBrowser"
set "EdgeChromium=%Packs%\EdgeChromium"
set "EdgeWebView2=%Packs%\EdgeWebView2"
set "Games=%Packs%\Games"
set "IE11=%Packs%\IE11"
set "LanguagePacks=%Packs%\LanguagePacks"
set "MediaFeaturePack=%Packs%\MediaFeaturePack"
set "MMRC=%Packs%\MultimediaRestrictedCodecs"
set "MSPaint=%Packs%\MSPaint"
set "NET6=%Packs%\NET6"
set "NET7=%Packs%\NET7"
set "NETCore31=%Packs%\NETCore31"
set "NetFx35=%Packs%\NetFX35"
set "NetFx462=%Packs%\NetFX462"
set "NetFx48=%Packs%\NetFX48"
set "NetFx481=%Packs%\NetFX481"
set "OfficeUWP=%Packs%\OfficeUWP"
set "OpenSSH=%Packs%\OpenSSH"
set "PortableDevices=%Packs%\PortableDevices"
set "PowerShell7=%Packs%\PowerShell7"
set "RDP81=%Packs%\RDP81"
set "RSAT=%Packs%\RSAT"
set "Sidebar=%Packs%\Sidebar"
set "Skins=%Packs%\Skins"
set "SystemRestore=%Packs%\SystemRestore"
set "ThinPC=%Packs%\ThinPC"
set "ThirdPartyAppPacks=%Packs%\ThirdPartyAppPacks"
set "UAP=%Packs%\UAP"
set "VCRuntime=%Packs%\VCRuntime"
set "Win32Calc=%Packs%\Win32Calc"
set "WinToGo=%Packs%\WinToGo"
set "WMF=%Packs%\WMF"
set "WMR=%Packs%\WMR"
set "WSL=%Packs%\WSL"

:: Setting Toolkit's dependent tools environment path variables
set "Lists=%Bin%\Lists"
set "Patches=%Bin%\Patches"
set "ResourceHacker=%Bin%\ResourceHacker.exe"
set "ToolKitHelper=%Bin%\ToolKitHelper.exe"
set "EsdDecrypter=%Bin%\esddecrypt.exe"
set "WimlibImagex=%Bin%\%HostArchitecture%\wimlib-imagex.exe"
set "XCopy=xcopy.exe /E /I /H /R /Y /J"
set "XMLs=%Bin%\XMLs"
set "W7ESU=%Bin%\Patches\W7ESU"
set "W10CUFix=%Bin%\Patches\W10CUFix"
set "WMCGActTokens=%Bin%\Patches\WMCGActTokens.tpk"
set "PSFExtractor=%Bin%\PSFExtractor.exe"
set "Zip=%Bin%\%HostArchitecture%\7z.exe"

:: Setting Apps status flags
for %%i in (I_3DViewer,I_Alarms,I_AmazonAppStore,I_AV1VideoExtension,I_BingFinance,I_BingFoodDrink,I_BingHealthFitness,I_BingMaps,I_BingNews,I_BingSearch,I_BingSports,I_BingTravel,I_BingWeather,I_Calculator,I_Camera,I_ClientWebExperience,I_Clipchamp,I_CommunicationsApps,I_Cortana,I_D3DMappingLayers,I_DesktopAppInstaller,I_DevHome,I_DirectXRuntime,I_DolbyAudioExtensions,I_Family,I_FeedbackHub,I_GamingApp,I_GetHelp,I_Getstarted,I_HEIFImageExtension,I_HelpAndTips,I_HEVCVideoExtension,I_Journal,I_Maps,I_Messaging,I_MicrosoftDefender,I_MicrosoftPowerBI,I_MinecraftEducationEdition,I_MixedRealityPortal,I_MPEG2VideoExtension,I_Notepad,I_OfficeHub,I_OfficeOneNote,I_OneConnect,I_OutlookForWindows,I_Paint,I_Paint3D,I_People,I_Photos,I_PowerAutomateDesktop,I_Print3D,I_QuickAssist,I_RawImageExtension,I_Reader,I_ReadingList,I_Scan,I_ScreenSketch,I_SkypeApp,I_SolitaireCollection,I_SoundRecorder,I_StickyNotes,I_StorePurchaseApp,I_Teams,I_Terminal,I_Todos,I_VP9VideoExtensions,I_Wallet,I_WebMediaExtensions,I_WebpImageExtension,I_Whiteboard,I_WindowsDefender,I_WindowsStore,I_WindowsSubsystemForAndroid,I_WindowsSubsystemForLinux,I_Xbox,I_XboxGameOverlay,I_XboxGamingOverlay,I_XboxIdentityProvider,I_XboxLiveGames,I_XboxSpeechToTextOverlay,I_XboxTCUI,I_YourPhone,I_ZuneMusic,I_ZuneVideo,I_AMDLink,I_HPSupportAssistant,I_IntelGraphicsCommandCenter,I_IntelThunderboltController,I_KillerControlCenter,I_NVIDIAControlPanel,I_RealtekAudioControl,I_WavesMaxxAudioProforDell) do (
	set "%%i=-"
)

:: Setting Components status flags
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_LiveCaptions,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_VoiceAccess,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2Runtime,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_PaintApp,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	set "%%i=+"
)

:: Setting Components Compatibility status flags
for %%i in (CC_AdobeInstallers,CC_ApplicationGuardContainers,CC_Biometric,CC_Hyper-V,CC_MicrosoftGames,CC_MicrosoftOfice,CC_MicrosoftStore,CC_ModernAppSupport,CC_OOBE,CC_Printing,CC_Recommended,CC_ShellSearch,CC_TouchScreenDevices,CC_VisualStudio,CC_WindowsUpdate,CC_WindowsUpgrade,CC_XboxApp) do (
	set "%%i=+"
)

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - EULA
::-------------------------------------------------------------------------------------------
cls

echo.===============================================================================
echo.########################## MSMG ToolKit - EULA ################################
echo.===============================================================================
echo.
echo.
echo. The MSMG Toolkit is basically a tool to service, customize, add or remove
echo. features and components, enable or disable features to Windows operating
echo. system.
echo.
echo. The MSMG Toolkit is intended to be used with licensed Microsoft Windows
echo. operating systems only.
echo.
echo. This MSMG Toolkit is provided 'as-is', without any express or implied warranty.
echo. In no event will the author be held liable for any damages arising from the
echo. use of this script.
echo.
echo. The MSMG Toolkit uses various 3rd party tools to accomplish some of it's
echo. tasks.
echo.
echo. MSMG ToolKit, Windows are registered trademarks of their respective authors
echo. or companies.
echo.
echo.
echo.===============================================================================
choice /C:AR /N /M "###########################[ 'A'ccept / 'R'eject ]############################"
if errorlevel 2 (
	reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

	color 00
	endlocal

	exit
)

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Startup function
::-------------------------------------------------------------------------------------------
cls

echo.
echo.Performing Toolkit pre-cleanup operation, please wait...
call :Cleanup >nul
cls
echo.===============================================================================
echo.                          MSMG ToolKit - Start Up
echo.===============================================================================
echo.
echo.Reading Host OS Information...
echo.
echo.%HostOSName% %HostDisplayVersion% - v%HostVersion%.%HostBuild%.%HostServicePackBuild% %HostArchitecture% %HostLanguage%

:: Setting DOS character codepage
if "%HostUILanguage%" equ "en-GB" chcp 437 >nul
if "%HostUILanguage%" equ "en-US" chcp 437 >nul
if "%HostUILanguage%" equ "zh-CN" chcp 936 >nul

echo.
echo.Setting Toolkit and WADK tools environment path variables...
echo.
echo.DISM.exe           =  %DISM%
call :CreateFolder "%DismScratch%"
set "DISM=%DISM% %DismFormat%"
echo.Imagex.exe         =  %Imagex%
echo.Oscdimg.exe        =  %Oscdimg%
echo.Dvdburn.exe        =  %Dvdburn%
echo.7zip.exe           =  %Zip%
echo.EsdDecrypt.exe     =  %EsdDecrypter%
echo.ToolKitHelper.exe  =  %ToolKitHelper%
echo.ResourceHacker.exe =  %ResourceHacker%
echo.WimlibImagex.exe   =  %WimlibImagex%
echo.
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Main Menu
::-------------------------------------------------------------------------------------------
:MainMenu

cls
echo.===============================================================================
echo.                           MSMG ToolKit - Main Menu
echo.===============================================================================
echo.
echo.                             [1]   Source
echo.
echo.                             [2]   Integrate
echo.
echo.                             [3]   Remove
echo.
echo.                             [4]   Customize
echo.
echo.                             [5]   Unattended
echo.
echo.                             [6]   Apply
echo.
echo.                             [7]   Target
echo.
echo.                             [8]   Tools
echo.
echo.                             [X]   Quit
echo.
echo.===============================================================================
choice /C:12345678X /N /M "Enter Your Choice : "
if errorlevel 9 goto :Quit
if errorlevel 8 goto :ToolsMenu
if errorlevel 7 goto :TargetMenu
if errorlevel 6 goto :ApplyMenu
if errorlevel 5 goto :UnattendedMenu
if errorlevel 4 goto :CustomizeMenu
if errorlevel 3 goto :RemoveMenu
if errorlevel 2 goto :IntegrateMenu
if errorlevel 1 goto :SourceMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Select Source Menu
::-------------------------------------------------------------------------------------------
:SourceMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - Source Menu
echo.===============================================================================
echo.

:: Checking whether Source OS is selected
if "%IsSourceSelected%" equ "Yes" (
	echo.Source OS has already been selected...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.Source OS Image Registry is loaded, please do unload it using Tools-^>Options..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

echo.  [1]   Select Source from ^<DVD^> Folder
echo.
echo.  [2]   Copy Source from DVD Drive
echo.
echo.  [3]   Extract Source from DVD ISO Image
echo.
echo.  [4]   Extract Source from OEM IMG Image
echo.
echo.  [5]   Extract Source from Store ESD Image
echo.
echo.  [6]   Extract Source from MCT or Custom ESD Image
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123456X /N /M "Enter Your Choice : "
if errorlevel 7 goto :MainMenu
if errorlevel 6 goto :ExtractSourceESD
if errorlevel 5 goto :ExtractSourceStoreESD
if errorlevel 4 goto :ExtractSourceIMG
if errorlevel 3 goto :ExtractSourceISO
if errorlevel 2 goto :CopySourceDVD
if errorlevel 1 goto :SelectSourceDVD
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Menu
::-------------------------------------------------------------------------------------------
:IntegrateMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - Integrate Menu
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceSelected%" equ "No" (
	echo.Source OS is not selected, please do select source from "Source" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.Source OS Image Registry is loaded, please do unload it using Tools-^>Options..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

echo.  [1]   Windows Language Packs
echo.
echo.  [2]   Windows Drivers
echo.
echo.  [3]   Windows Features
echo.
echo.  [4]   Windows Updates
echo.
if "%SelectedSourceOS%" neq "w7" echo.  [5]   Windows Inbox Apps
if "%SelectedSourceOS%" equ "w7" echo.  [5]   Windows Custom Features
echo.
if "%SelectedSourceOS%" neq "w7" echo.  [6]   Windows Custom Features
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123456X /N /M "Enter Your Choice : "
if errorlevel 7 goto :MainMenu
if "%SelectedSourceOS%" neq "w7" if errorlevel 6 goto :IntCustomFeaturesMenu
if "%SelectedSourceOS%" equ "w7" if errorlevel 5 goto :IntCustomFeaturesMenu
if "%SelectedSourceOS%" neq "w7" if errorlevel 5 goto :IntInboxAppsMenu
if errorlevel 4 goto :IntUpdatesMenu
if errorlevel 3 goto :IntFeaturesMenu
if errorlevel 2 goto :IntDriversMenu
if errorlevel 1 goto :IntLanguagePacksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Windows Features Menu
::-------------------------------------------------------------------------------------------
:IntFeaturesMenu

cls
echo.===============================================================================
echo.                MSMG ToolKit - Integrate Windows Features Menu
echo.===============================================================================

:: Checking whether the selected Source OS is a Windows 7 Client/Embedded
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" neq "Server" (
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Internet Explorer 11
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [J]   Windows Media Feature Pack
	echo.  [K]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [L]   Windows PowerShell 7 ^| Depends on Windows Management Framework 5.1
	echo.  [M]   Windows Thin PC Add-on Features
	echo.  [N]   Remote Server Administration Tool ^(RSAT^)
	echo.  [O]   Microsoft DaRT 7.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "Enter Your Choice : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntThinPcPkgs
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntWMF
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntRDP81
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntIE11
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows Server 2008 R2 Core/Non Core Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" if "%ImageInstallationType%" neq "Embedded" (
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Internet Explorer 11
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [J]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [K]   Windows PowerShell 7 ^| Depends on Windows Management Framework 5.1
	echo.  [L]   Windows System Restore
	echo.  [M]   Microsoft DaRT 7.0 Tools
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft Games
	echo.  [P]   Windows Sidebar
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "Enter Your Choice : "
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntSystemRestore
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntWMF
	if errorlevel 9  goto :IntRDP81
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntIE11
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows 8.1 RT (ARM)
if "%SelectedSourceOS%" equ "w81" if "%ImageArchitecture%" equ "arm" (
	echo.
	echo.  [1]   Microsoft .NET Framework 4.8
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :IntegrateMenu
	if errorlevel 1 goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows 8.1 Client Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageArchitecture%" neq "arm" if "%ImageInstallationType:~,6%" neq "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Data Deduplication
	echo.  [J]   Windows To Go Workspace
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows Management Framework ^(WMF^) 5.1
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Remote Server Administration Tool ^(RSAT^)
	echo.  [O]   Microsoft DaRT 8.1 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "Enter Your Choice : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntWMF
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Core/None Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" neq "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Management Framework ^(WMF^) 5.1
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   Microsoft DaRT 8.1 Tools
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft Games
	echo.  [N]   Windows Sidebar
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOX /N /M "Enter Your Choice : "
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWMF
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1507 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Classic Browser
	echo.  [G]   Microsoft Edge Chromium Browser
	echo.  [H]   Microsoft Win32 Calculator
	echo.  [I]   3rd Party Application Packs
	echo.  [J]   Windows To Go Workspace
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   Remote Server Administration Tool ^(RSAT^)
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar ^| Depends on : Windows Mail App
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "Enter Your Choice : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntRSAT
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1511 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Data Deduplication
	echo.  [J]   Windows To Go Workspace
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   Remote Server Administration Tool ^(RSAT^)
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "Enter Your Choice : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntRSAT
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Classic Browser
	echo.  [G]   Microsoft Edge Chromium Browser
	echo.  [H]   Microsoft Edge WebView 2
	echo.  [I]   Microsoft Win32 Calculator
	echo.  [J]   3rd Party Application Packs
	echo.  [K]   Windows Data Deduplication
	echo.  [L]   Windows To Go Workspace
	echo.  [M]   Windows Media Feature Pack
	echo.  [N]   Windows Multimedia Restricted Codecs
	echo.  [O]   Windows PowerShell 7
	echo.  [P]   Remote Server Administration Tool ^(RSAT^)
	echo.  [Q]   Microsoft DaRT 10.0 Tools
	echo.  [R]   Microsoft DirectX 9.0c
	echo.  [S]   Microsoft Games
	echo.  [T]   Windows Sidebar
	echo.  [U]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUX /N /M "Enter Your Choice : "
	if errorlevel 22 goto :IntegrateMenu
	if errorlevel 21 goto :IntVCRuntime
	if errorlevel 20 goto :IntSidebar
	if errorlevel 19 goto :IntGames
	if errorlevel 18 goto :IntDirectX9c
	if errorlevel 17 goto :IntDaRT
	if errorlevel 16 goto :IntRSAT
	if errorlevel 15 goto :IntPowerShell7
	if errorlevel 14 goto :IntMMRC
	if errorlevel 13 goto :IntMediaFeaturePack
	if errorlevel 12 goto :IntWinToGo
	if errorlevel 11 goto :IntDedup
	if errorlevel 10 goto :Int3rdPartyAppPacks
	if errorlevel 9  goto :IntWin32Calc
	if errorlevel 8  goto :IntEdgeWebView2
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1703 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Accessibility Braille
	echo.  [J]   Windows Data Deduplication
	echo.  [K]   Windows To Go Workspace
	echo.  [L]   Windows Media Feature Pack
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Remote Server Administration Tool ^(RSAT^)
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "Enter Your Choice : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntBraille
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1709 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Accessibility Braille
	echo.  [J]   Windows Data Deduplication
	echo.  [K]   Windows To Go Workspace
	echo.  [L]   Windows Media Feature Pack
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Remote Server Administration Tool ^(RSAT^)
	echo.  [O]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [P]   Microsoft DaRT 10.0 Tools
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft Games
	echo.  [S]   Windows Sidebar
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "Enter Your Choice : "
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1803 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium Browser
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Accessibility Braille
	echo.  [J]   Windows Data Deduplication
	echo.  [K]   Windows To Go Workspace
	echo.  [L]   Windows Media Feature Pack
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Remote Server Administration Tool ^(RSAT^)
	echo.  [O]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [P]   Microsoft Office Desktop UWP Apps
	echo.  [Q]   Microsoft DaRT 10.0 Tools
	echo.  [R]   Microsoft DirectX 9.0c
	echo.  [S]   Microsoft Games
	echo.  [T]   Windows Sidebar
	echo.  [U]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUX /N /M "Enter Your Choice : "
	if errorlevel 22 goto :IntegrateMenu
	if errorlevel 21 goto :IntVCRuntime
	if errorlevel 20 goto :IntSidebar
	if errorlevel 19 goto :IntGames
	if errorlevel 18 goto :IntDirectX9c
	if errorlevel 17 goto :IntDaRT
	if errorlevel 16 goto :IntOfficeUWPApps
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Classic Browser
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   Microsoft Win32 Calculator
	echo.  [I]   3rd Party Application Packs
	echo.  [J]   Windows Accessibility Braille
	echo.  [K]   Windows Data Deduplication
	echo.  [L]   Windows To Go Workspace
	echo.  [M]   Windows Media Feature Pack
	echo.  [N]   Windows Mixed Reality
	echo.  [O]   Windows Multimedia Restricted Codecs
	echo.  [P]   Windows Portable Devices
	echo.  [Q]   Windows PowerShell 7
	echo.  [R]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [S]   Microsoft Office Desktop UWP Apps
	echo.  [T]   Microsoft DaRT 10.0 Tools
	echo.  [U]   Microsoft DirectX 9.0c
	echo.  [V]   Microsoft Games
	echo.  [W]   Windows Sidebar
	echo.  [X]   Microsoft Visual C++ Runtime
	echo.  [1]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWX1 /N /M "Enter Your Choice : "
	if errorlevel 25 goto :IntegrateMenu
	if errorlevel 24 goto :IntVCRuntime
	if errorlevel 23 goto :IntSidebar
	if errorlevel 22 goto :IntGames
	if errorlevel 21 goto :IntDirectX9c
	if errorlevel 20 goto :IntDaRT
	if errorlevel 19 goto :IntOfficeUWPApps
	if errorlevel 18 goto :IntOpenSSH
	if errorlevel 17 goto :IntPowerShell7
	if errorlevel 16 goto :IntPortableDevices
	if errorlevel 15 goto :IntMMRC
	if errorlevel 14 goto :IntWMR
	if errorlevel 13 goto :IntMediaFeaturePack
	if errorlevel 12 goto :IntWinToGo
	if errorlevel 11 goto :IntDedup
	if errorlevel 10 goto :IntBraille
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1903/v1909 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Edge WebView 2
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   3rd Party Application Packs
	echo.  [H]   Windows Accessibility Braille
	echo.  [I]   Windows Data Deduplication
	echo.  [J]   Windows To Go Workspace
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows Portable Devices
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [O]   Microsoft Office Desktop UWP Apps
	echo.  [P]   Microsoft DaRT 10.0 Tools
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft Games
	echo.  [S]   Windows Sidebar
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "Enter Your Choice : "
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntOfficeUWPApps
	if errorlevel 14 goto :IntOpenSSH
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntPortableDevices
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :IntBraille
	if errorlevel 7  goto :Int3rdPartyAppPacks
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeWebView2
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v2004/v20H2/v21H1/v21H2/v22H2 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Accessibility Braille
	echo.  [J]   Windows Data Deduplication
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows Multimedia Restricted Codecs
	echo.  [M]   Windows Portable Devices
	echo.  [N]   Windows PowerShell 7
	echo.  [O]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [P]   Microsoft Office Desktop UWP Apps
	echo.  [Q]   Microsoft DaRT 10.0 Tools
	echo.  [R]   Microsoft DirectX 9.0c
	echo.  [S]   Microsoft Games
	echo.  [T]   Windows Sidebar
	echo.  [U]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUX /N /M "Enter Your Choice : "
	if errorlevel 22 goto :IntegrateMenu
	if errorlevel 21 goto :IntVCRuntime
	if errorlevel 20 goto :IntSidebar
	if errorlevel 19 goto :IntGames
	if errorlevel 18 goto :IntDirectX9c
	if errorlevel 17 goto :IntDaRT
	if errorlevel 16 goto :IntOfficeUWPApps
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntPortableDevices
	if errorlevel 12 goto :IntMMRC
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 11 v21H2 Client Edition
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   Microsoft Paint
	echo.  [H]   Microsoft Win32 Calculator
	echo.  [I]   3rd Party Application Packs
	echo.  [J]   Windows Accessibility Braille
	echo.  [K]   Windows Media Feature Pack
	echo.  [L]   Windows Portable Devices
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [O]   Microsoft DaRT 11.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "Enter Your Choice : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOpenSSH
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntPortableDevices
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntBraille
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntMSPaint
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 11 v22H2 Client Edition
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Paint
	echo.  [G]   Microsoft Win32 Calculator
	echo.  [H]   3rd Party Application Packs
	echo.  [I]   Windows Accessibility Braille
	echo.  [J]   Windows Media Feature Pack
	echo.  [K]   Windows Portable Devices
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [N]   Microsoft DaRT 11.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "Enter Your Choice : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntOpenSSH
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntPortableDevices
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntMSPaint
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1803/v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2 arm64 Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17134" if "%ImageArchitecture%" equ "arm64" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET Framework 4.8.1
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :IntegrateMenu
	if errorlevel 2 goto :IntNetFX481
	if errorlevel 1 goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2016/2019, Server v1709/v1803/v1809 Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Windows PowerShell 7
	echo.  [G]   Windows Subsystem for Linux ^(WSL^)
	echo.  [H]   Microsoft DaRT 10.0 Tools
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJX /N /M "Enter Your Choice : "
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntVCRuntime
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntWSL
	if errorlevel 6  goto :IntPowerShell7
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2016/2019 Non Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Classic Browser
	echo.  [G]   Microsoft Edge Chromium Browser
	echo.  [H]   Microsoft Edge WebView 2
	echo.  [I]   3rd Party Application Packs
	echo.  [J]   Windows Multimedia Restricted Codecs
	echo.  [K]   Windows System Restore
	echo.  [L]   Windows Subsystem for Linux ^(WSL^)
	echo.  [M]   Windows To Go Workspace
	echo.  [N]   Windows PowerShell 7
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "Enter Your Choice : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntWinToGo
	if errorlevel 12 goto :IntWSL
	if errorlevel 11 goto :IntSystemRestore
	if errorlevel 10 goto :IntMMRC
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntEdgeWebView2
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2/Windows Server LTSC 2022 Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Windows PowerShell 7
	echo.  [G]   Windows Subsystem for Linux ^(WSL^)
	echo.  [H]   Microsoft DaRT 10.0 Tools
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	choice /C:ABCDEFGHIJX /N /M "Enter Your Choice : "
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntVCRuntime
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntWSL
	if errorlevel 6  goto :IntPowerShell7
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server LTSC 2022 Non Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   3rd Party Application Packs
	echo.  [H]   Windows PowerShell 7
	echo.  [I]   Microsoft DaRT 10.0 Tools
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft Games
	echo.  [L]   Windows Sidebar
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "Enter Your Choice : "
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntSidebar
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :Int3rdPartyAppPacks
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Integrate Windows Custom Features Menu
::-------------------------------------------------------------------------------------------
:IntCustomFeaturesMenu

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate Windows Custom Features Menu
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.            MSMG ToolKit - Integrate Windows Custom Features Menu
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo.   Integrating Windows Custom Features involves patching system files and so
	echo.   the SFC can report about Windows System Files corruption, This is normal.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.   To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do You Want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate Windows Custom Features Menu
echo.===============================================================================
:: Checking whether the selected Source OS is a Windows 7 Client/Server 2008 R2 Non-Core Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" if "%ImageInstallationType%" neq "Server Core" (
	echo.
	echo.  [1]   Microsoft Terminal Server Patch
	echo.
	echo.  [2]   Custom Themes UxTheme Patch
	echo.
	echo.  [3]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [4]   Custom Default User Account Pictures
	echo.
	echo.  [5]   Custom System Files
	echo.
	echo.  [6]   Custom Fonts
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:123456X /N /M "Enter Your Choice : "
	if errorlevel 7 goto :IntegrateMenu
	if errorlevel 6 goto :IntCustomFonts
	if errorlevel 5 goto :IntCustomFiles
	if errorlevel 4 goto :IntUAP
	if errorlevel 3 goto :IntCustomRecoveryImage
	if errorlevel 2 goto :IntCustomUxTheme
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 7 Embedded Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" (
	echo.
	echo.  [1]   Microsoft Terminal Server Patch
	echo.
	echo.  [2]   Custom Themes UxTheme Patch
	echo.
	echo.  [3]   Custom Default User Account Pictures
	echo.
	echo.  [4]   Custom System Files
	echo.
	echo.  [5]   Custom Fonts
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345X /N /M "Enter Your Choice : "
	if errorlevel 6 goto :IntegrateMenu
	if errorlevel 5 goto :IntCustomFonts
	if errorlevel 4 goto :IntCustomFiles
	if errorlevel 3 goto :IntUAP
	if errorlevel 2 goto :IntCustomUxTheme
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows Server 2008 Core Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft Terminal Server Patch
	echo.
	echo.  [2]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [3]   Custom System Files
	echo.
	echo.  [4]   Custom Fonts
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 8.1 Client Non-Professioanl WMC/Server 2012 R2 Non-Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" neq "ProfessionalWMC" if "%ImageInstallationType%" neq "Server Core" (
	echo.
	echo.  [1]   Windows 8.1 Pre-Activation Data
	echo.
	echo.  [2]   Microsoft Terminal Server Patch
	echo.
	echo.  [3]   Custom Themes UxTheme Patch
	echo.
	echo.  [4]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [5]   Custom Default User Account Pictures
	echo.
	echo.  [6]   Custom System Files
	echo.
	echo.  [7]   Custom Fonts
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "Enter Your Choice : "
	if errorlevel 8 goto :IntegrateMenu
	if errorlevel 7 goto :IntCustomFonts
	if errorlevel 6 goto :IntCustomFiles
	if errorlevel 5 goto :IntUAP
	if errorlevel 4 goto :IntCustomRecoveryImage
	if errorlevel 3 goto :IntCustomUxTheme
	if errorlevel 2 goto :IntCustomTerminalServer
	if errorlevel 1 goto :IntPreActTokens
)

:: Checking whether the selected Source OS is a Windows 8.1 Professioanl WMC Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageEdition%" equ "ProfessionalWMC" (
	echo.
	echo.  [1]   Windows 8.1 Media Center Generic Activation Tokens
	echo.
	echo.  [2]   Windows 8.1 Pre-Activation Data
	echo.
	echo.  [3]   Microsoft Terminal Server Patch
	echo.
	echo.  [4]   Custom Themes UxTheme Patch
	echo.
	echo.  [5]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [6]   Custom Default User Account Pictures
	echo.
	echo.  [7]   Custom System Files
	echo.
	echo.  [8]   Custom Fonts
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	choice /C:12345678X /N /M "Enter Your Choice : "
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntCustomFonts
	if errorlevel 7 goto :IntCustomFiles
	if errorlevel 6 goto :IntUAP
	if errorlevel 5 goto :IntCustomRecoveryImage
	if errorlevel 4 goto :IntCustomUxTheme
	if errorlevel 3 goto :IntCustomTerminalServer
	if errorlevel 2 goto :IntPreActTokens
	if errorlevel 1 goto :IntWMCGActTokens
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft Terminal Server Patch
	echo.
	echo.  [2]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [3]   Custom System Files
	echo.
	echo.  [4]   Custom Fonts
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows Server Core Edition
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft Terminal Server Patch
	echo.
	echo.  [2]   Custom Windows Recovery Environment ^(WinRE^)
	echo.
	echo.  [3]   Custom System Files
	echo.
	echo.  [4]   Custom Fonts
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 10 Client/Server Non-Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType%" neq "Server Core" if "%ImageBuild%" leq "20348"  (
	echo.
	echo.  [A]   Microsoft Terminal Server Patch
	echo.  [B]   Custom Themes UxTheme Patch
	echo.  [C]   Custom Windows Recovery Environment ^(WinRE^)
	echo.  [D]   Custom Default User Account Pictures
	echo.  [E]   Custom System Files
	echo.  [F]   Custom Fonts
	echo.  [G]   Microsoft Win32Calc Metro Skin
	echo.  [H]   Windows Icons Skin
	echo.  [I]   Windows Photo Viewer Metro Skin
	echo.  [J]   Windows Media Player Metro Skin
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJX /N /M "Enter Your Choice : "
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntWMPMetroSkin
	if errorlevel 9  goto :IntWPVMetroSkin
	if errorlevel 8  goto :IntWIconsSkin
	if errorlevel 7  goto :IntWin32CalcMetroSkin
	if errorlevel 6  goto :IntCustomFonts
	if errorlevel 5  goto :IntCustomFiles
	if errorlevel 4  goto :IntUAP
	if errorlevel 3  goto :IntCustomRecoveryImage
	if errorlevel 2  goto :IntCustomUxTheme
	if errorlevel 1  goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 11 v21H2/v22H2 Client Edition
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000"  (
	echo.
	echo.  [A]   Microsoft Terminal Server Patch
	echo.  [B]   Custom Themes UxTheme Patch
	echo.  [C]   Custom Windows Recovery Environment ^(WinRE^)
	echo.  [D]   Custom Default User Account Pictures
	echo.  [E]   Custom System Files
	echo.  [F]   Custom Fonts
	echo.  [G]   Microsoft Win32Calc Metro Skin
	echo.  [H]   Windows Photo Viewer Metro Skin
	echo.  [I]   Windows Media Player Metro Skin
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIX /N /M "Enter Your Choice : "
	if errorlevel 10 goto :IntegrateMenu
	if errorlevel 9  goto :IntWMPMetroSkin
	if errorlevel 8  goto :IntWPVMetroSkin
	if errorlevel 7  goto :IntWin32CalcMetroSkin
	if errorlevel 6  goto :IntCustomFonts
	if errorlevel 5  goto :IntCustomFiles
	if errorlevel 4  goto :IntUAP
	if errorlevel 3  goto :IntCustomRecoveryImage
	if errorlevel 2  goto :IntCustomUxTheme
	if errorlevel 1  goto :IntCustomTerminalServer
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Remove Menu
::-------------------------------------------------------------------------------------------
:RemoveMenu

cls
echo.===============================================================================
echo.                          MSMG ToolKit - Remove Menu
echo.===============================================================================
echo.

:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Source OS is not selected, please do select source from "Source" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.Source OS Image Registry is loaded, please do unload it using Tools-^>Options..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether the selected Source OS is Windows 7 Source OS
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 8.1 Source OS
if "%SelectedSourceOS%" equ "w81" (
	echo.  [1]   Remove Windows Apps Using Apps List
	echo.
	echo.  [2]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 Enterprise 2015/2016 LTSB Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 Enterprise N 2015/2016 LTSB Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [1]   Remove Windows Apps Using Apps List
	echo.
	echo.  [2]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise 2019/2021 LTSC Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   Remove Windows Components
	echo.
	echo.  [2]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N 2019/2021 LTSC Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   Remove Windows Components
	echo.
	echo.  [2]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Edition
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [1]   Remove Windows Components
	echo.
	echo.  [2]   Remove Windows Apps Using Apps List
	echo.
	echo.  [3]   Remove Windows Components Using Package List
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 11 v23H2 Client
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22631" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   Remove Windows Apps Using Apps List
	echo.
	echo.  [2]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10/11 Server Edition
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" (
	echo.  [1]   Remove Windows Components Using Package List
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
:: Checking whether the selected Source OS is Windows 7 Source OS
if "%SelectedSourceOS%" equ "w7" (
	choice /C:1X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: Checking whether the selected Source OS is Windows 8.1 Source OS
if "%SelectedSourceOS%" equ "w81" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: Checking whether the selected Source OS is Windows 10 Enterprise 2015/2016 LTSB Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseS" (
	choice /C:1X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: Checking whether the selected Source OS is Windows 10 Enterprise N 2015/2016 LTSB Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseSN" (
	choice /C:1X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: Checking whether the selected Source OS is Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise 2019/2021 LTSC Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" equ "EnterpriseS" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N 2019/2021 LTSC Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" equ "EnterpriseSN" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Edition
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	choice /C:123X /N /M "Enter Your Choice : "
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 11 v23H2 Client
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22631" if "%ImageInstallationType%" equ "Client" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: Checking whether the selected Source OS is a Windows 10/11 Server Edition
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" (
	choice /C:1X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Customize Menu
::-------------------------------------------------------------------------------------------
:CustomizeMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - Customize Menu
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Source OS is not selected, please do select source from "Source" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.Source OS Image Registry is loaded, please do unload it using Tools-^>Options..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether the selected Source OS is a Windows 7/Server 2008 R2 Edition
if "%SelectedSourceOS%" equ "w7" (
	echo.This feature is not yet implemented...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

echo.  [1]   Enable Windows Features using Features List
echo.  [2]   Disable Windows Features using Features List
echo.  [3]   Import Custom Default Inbox Apps Association from XML File
echo.  [4]   Export Default Inbox Apps Association to XML File
echo.  [5]   Remove Default Inbox Apps Association XML
echo.  [6]   Import Custom StartMenu Layout from XML File
echo.  [7]   Import Custom Registry Setting from Registry File
echo.  [8]   Apply Tweaks
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:12345678X /N /M "Enter Your Choice : "
if errorlevel 9 goto :MainMenu
if errorlevel 8 goto :ApplyTweaksMenu
if errorlevel 7 goto :ImportCustomRegistry
if errorlevel 6 goto :ImportStartMenuLayout
if errorlevel 5 goto :RemoveMetroAppsAssociation
if errorlevel 4 goto :ExportMetroAppsAssociation
if errorlevel 3 goto :ImportMetroAppsAssociation
if errorlevel 2 goto :DisableFeatures
if errorlevel 1 goto :EnableFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Unattended XML Menu
::-------------------------------------------------------------------------------------------
:UnattendedMenu
cls
echo.===============================================================================
echo.                      MSMG ToolKit - Unattended XML Menu
echo.===============================================================================
echo.
echo.  [1]   Copy Personal ^<\Custom\Autounattend.xml^> file to DVD folder
echo.
echo.  [2]   Write "Autounattend.xml" getting Host or Image data to DVD folder
echo.
echo.  [3]   Validate "Autounattend.xml" file in DVD folder
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "Enter Your Choice : "
echo.
if errorlevel 4 goto :MainMenu
if errorlevel 3 (
	call :ValidateXML "!UnattendXML_Path!"

	echo.
	TIMEOUT.exe /T -1

	goto :UnattendedMenu
)
if errorlevel 2 goto :UnattendedWriter
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Personal Unattended XML
::-------------------------------------------------------------------------------------------
:UnattendedPersonalFile
cls
echo.===============================================================================
echo.                    MSMG ToolKit - Personal Unattended XML
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%Custom%\Autounattend.xml" (
	echo.Can't find your Personal "Autounattend.xml" file in ^<Custom\^> folder...
	echo.
	echo.Please copy your Personal "Autounattend.xml" file to ^<Custom\^> folder...
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :UnattendedMenu
)

echo.-------------------------------------------------------------------------------
echo.### Start Copying Personal Unattend XML file to DVD Folder ####################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Copying Personal ^<\Custom\Autounattend.xml^> file to DVD folder ...
echo.-------------------------------------------------------------------------------
copy /Y "%Custom%\Autounattend.xml" "!UnattendXML_Path!"
echo.
call :ValidateXML "!UnattendXML_Path!"
echo.
echo.-------------------------------------------------------------------------------
echo.### Finished Copying Personal Unattend XML file to DVD Folder #################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================

echo.
TIMEOUT.exe /T -1

goto :UnattendedMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Unattended XML Writer
::-------------------------------------------------------------------------------------------
:UnattendedWriter
cls
echo.===============================================================================
echo.                     MSMG ToolKit - Unattended XML Writer
echo.===============================================================================
echo.

:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Source OS is not selected, please do select source from "Source" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

echo.  [F]  ^(!SourceData!^) Source Data
echo.-------------------------------------------------------------------------------
if /I "!SourceData!" equ "Host" (
	echo.       HostLanguage                        : "%HostLanguage%"
	echo.       HostUILanguage                      : "%HostUILanguage%"
	echo.       HostLanguageFallback                : "%HostLanguageFallback%"
	echo.       HostActiveKeyboard                  : "%HostActiveKeyboard%"
	echo.       HostTimeZone                        : "%HostTimeZone%"
)
if /I "!SourceData!" equ "Image" (
	echo.       ImageLanguage                       : "!ImageLanguage!"
	echo.       ImageUILanguage                     : "!ImageUILanguage!"
	echo.       ImageLanguageFallback               : "!ImageLanguageFallback!"
	echo.       ImageActiveKeyboard                 : "!ImageActiveKeyboard!"
	echo.       ImageTimeZone                       : "!ImageTimeZone!"
)
echo.-------------------------------------------------------------------------------
echo.
echo.  [S]  Enter your Preferences for :
echo.
echo.      "MachineName - OrganizationName - AccountName - Password/Description"
echo.-------------------------------------------------------------------------------
echo.  Defined Values for "!SourceData!" Source Data :
echo.
echo.       Unattend System / User Locale            : "!Unattend_LocaleLanguage!"
echo.       Unattend UI Language                     : "!Unattend_UILanguage!"
echo.       Unattend System / User LanguageFallback  : "!Unattend_LanguageFallback!"
echo.       Active Keyboard - Input Locale           : "!Unattend_InputLocale!"
echo.
echo.       Time Zone                                : "!Unattend_TimeZone!"
echo.       Computer Name                            : "!Unattend_MachineName!"
echo.       Organization Name                        : "!Unattend_OrganizationName!"
echo.       Account Name                             : "!Unattend_AccountName!"
echo.       Password Value                           : "!Unattend_Password!"
echo.       Password Description                     : "!Unattend_PasswordDescription!"
echo.-------------------------------------------------------------------------------
if "!Unattend_Password!" neq "" (
	echo.
	if /I "!Unattend_AutoLogon!" equ "Disabled" echo.  [L]  ^(!Unattend_AutoLogon!^) Automatic Logon [Default Option]
	if /I "!Unattend_AutoLogon!" equ "Enabled" echo.  [L]  ^(!Unattend_AutoLogon!^) Automatic Logon
)
echo.
echo.  [W]  Write Autounattend.XML in Manual Setup ^<%DVD%^>
echo.
echo.  [X]  Go Back
echo.
echo.===============================================================================
echo.
choice /C:FSLWX /N /M "Enter Your Choice : "
echo.
if errorlevel  5 (
	set Unattend_MachineName=
	set Unattend_OrganizationName=
	set Unattend_AccountName=
	set Unattend_Password=
	set Unattend_PasswordDescription=
	goto :UnattendedMenu
)
if errorlevel  4 goto :UnattendedXML
if errorlevel  3 (
	if /I "!Unattend_AutoLogon!" equ "Disabled" (
		set "Unattend_AutoLogon=Enabled"
	) else (
		set "Unattend_AutoLogon=Disabled"
	)
)
if errorlevel  2 (
	rem set "Autounattend_MachineName=Machine"
	if "!Unattend_MachineName!" equ "" (
		echo.Keep it empty if you want to use this Autounattend.xml file in multiple Machines.
		echo.Empty is recommended for Computer Maintenance Technician.
		set /P "Autounattend_MachineName=Enter your Machine Name : "
	)
	rem set "Unattend_OrganizationName=dotOrg"
	if "!Unattend_OrganizationName!" equ "" set /P "Unattend_OrganizationName=Enter your Organization Name : "
	rem set "Unattend_AccountName=EveryOne"
	if "!Unattend_AccountName!" equ "" set /P "Unattend_AccountName=Enter your Account Name : "
	if "!Unattend_AccountName!" neq "" (
		rem set "Unattend_Password=windows"
		if "!Unattend_Password!" equ "" set /P "Unattend_Password=Enter your Temporary User Password : "
		if "!Unattend_Password!" neq "" (
			if "!Unattend_PasswordDescription!" equ "" (
				echo.Reminder Example: "logon through enter key". Change the Password.
				set /P "Unattend_PasswordDescription=Reminder: Enter your Reminder for "!Unattend_AccountName! User" Account Password : "
			)
		)
	)
)
if errorlevel  1 (
	if /I "!SourceData!" equ "Host" (
		set "SourceData=Image"
		set "Unattend_LocaleLanguage=!ImageLanguage!"
		set "Unattend_UILanguage=!ImageUILanguage!"
		set "Unattend_LanguageFallback=!ImageLanguageFallback!"
		set "Unattend_InputLocale=!ImageActiveKeyboard!"
		set "Unattend_TimeZone=!ImageTimeZone!"
	) else (
		set "SourceData=Host"
		set "Unattend_LocaleLanguage=%HostLanguage%"
		set "Unattend_UILanguage=%HostUILanguage%"
		set "Unattend_LanguageFallback=%HostLanguageFallback%"
		set "Unattend_InputLocale=%HostActiveKeyboard%"
		set "Unattend_TimeZone=%HostTimeZone%"
	)
)

goto :UnattendedWriter
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Apply Source Menu
::-------------------------------------------------------------------------------------------
:ApplyMenu

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Apply Source Menu
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Source OS is not selected, please do select source from "Source" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.Source OS Image Registry is loaded, please do unload it using Tools-^>Options..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

if "%IsSourceselected%" equ "Yes" if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Apply ^& Save Changes to Source Images
	echo.
	echo.  [2]   Discard Changes ^& Unmount Source Images
	echo.
	echo.
)

if "%IsSourceselected%" equ "Yes" if "%SelectedSourceOS%" neq "w7" (
	echo.  [1]   Cleanup Source Images using DISM Cleanup-Image
	echo.
	echo.  [2]   Apply ^& Save Changes to Source Images
	echo.
	echo.  [3]   Discard Changes ^& Unmount Source Images
)
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.

if "%IsSourceselected%" equ "Yes" if "%SelectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :DiscardSource
	if errorlevel 1 goto :SaveSource
)

if "%IsSourceselected%" equ "Yes" if "%SelectedSourceOS%" neq "w7" (
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :MainMenu
	if errorlevel 3 goto :DiscardSource
	if errorlevel 2 goto :SaveSource
	if errorlevel 1 goto :CleanupSource
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Select Target Menu
::-------------------------------------------------------------------------------------------
:TargetMenu

cls
echo.===============================================================================
echo.                      MSMG ToolKit - Select Target Menu
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "Yes" (
	echo.Source OS is selected, please do save or discard source from "Apply" menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :MainMenu
)

echo.  [1]   Make a DVD ISO Image
echo.
echo.  [2]   Burn an ISO Image to DVD
echo.
echo.  [3]   Copy Source to USB Flash Drive
echo.
echo.  [4]   Sync Source Boot ^& Install Images to USB Flash Drive
echo.
echo.  [5]   Burn an ISO Image to Bootable USB Flash Drive
echo.
echo.  [6]   Format a USB Flash Drive
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123456X /N /M "Enter Your Choice : "
if errorlevel 7 goto :MainMenu
if errorlevel 6 goto :FormatUSB
if errorlevel 5 goto :BurnUSB
if errorlevel 4 goto :SyncUSB
if errorlevel 3 goto :CopyUSB
if errorlevel 2 goto :BurnISO
if errorlevel 1 goto :MakeISO
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Tools Menu
::-------------------------------------------------------------------------------------------
:ToolsMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - Tools Menu
echo.===============================================================================
echo.
echo.  [1]   WIM Manager
echo.
echo.  [2]   Debug Info
echo.
echo.  [3]   Options
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "Enter Your Choice : "
if errorlevel 4 goto :MainMenu
if errorlevel 3 goto :Options
if errorlevel 2 goto :Debug
if errorlevel 1 goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Select Source from <DVD> folder
::-------------------------------------------------------------------------------------------
:SelectSourceDVD

cls
echo.===============================================================================
echo.               MSMG ToolKit - Select Source from ^<DVD^> folder
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%BootWim%" if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Can't find Windows Setup "Boot.wim" Image in ^<DVD\Sources^> folder...
	echo.
	echo.Please copy Windows Setup "Boot.wim" Image to ^<DVD\Sources^> folder...
	goto :Stop
)

if not exist "%BootWim%" if exist "%InstallWim%" (
	echo.Can't find Windows Setup "Boot.wim" Image in ^<DVD\Sources^> folder...
	echo.
	echo.Please copy Windows Setup "Boot.wim" Image to ^<DVD\Sources^> folder...
	goto :Stop
)

:: Checking whether Windows Source Install Image is a ESD Image
if exist "%InstallEsd%" (
	:: Getting Image Index Name
	call :GetImageName "%InstallESD%", 1 >nul

	if not exist "%BootWim%" if "!ImageName!" neq "Windows Setup Media" (
		echo.Can't find Windows Setup "Boot.wim" Image in ^<DVD\Sources^> folder...
		echo.Please copy Windows Setup "Boot.wim" Image to ^<DVD\Sources^> folder...
		goto :Stop
	)

	echo.ToolKit found Windows Installation image in a .esd format, an ESD image
	echo.is a highly compressed image which cannot be directly serviced.
	echo.
	echo.The Toolkit requires the Windows Installation image to be in a .wim
	echo.format for servciing.
	echo.
	echo.Please use a Windows Installation image in a .wim format or use the

	if "!ImageName!" equ "Windows Setup Media" echo.Extract Source from Store ESD Image menu from Source menu.
	if "!ImageName!" neq "Windows Setup Media" echo.Extract Source from MCT or Custom ESD Image menu from Source menu.
	goto :Stop
)

:: Checking whether Windows Source Install Image exist
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Can't find Windows Setup "Install.wim" Image in ^<DVD\Sources^> folder...
	echo.
	echo.Please copy Windows Setup "Install.wim" Image to ^<DVD\Sources^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Selecting Source Images####################################################
echo.-------------------------------------------------------------------------------

:: Getting Image Index Number to Service
call :GetImageIndexNo "%InstallWim%"

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered, Valid Range is [1,...%ImageCount%, 'A'll, 'Q'uit]
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :SelectSourceDVD
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
	for /l %%i in (2, 1, %ImageCount%) do (
		set "ImageIndexNo=!ImageIndexNo!,%%i"
	)
)

if /i "%ImageIndexNo%" equ "Q" (
	set ImageIndexNo=
	goto :MainMenu
)

:: Setting the default Image Index No
for /f "tokens=1 delims=," %%a in ("!ImageIndexNo!") do (set DefaultIndexNo=%%a)

:: Getting first Image Index Information
call :GetImageIndexInfo "%InstallWim%", %DefaultIndexNo% >nul

:: Setting selected Source OS version
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"

if "%ImageVersion:~0,-6%" equ "10.0" (
	if "%ImageBuild%" leq "20348" (
		set "SelectedSourceOS=w10"
		set "OSID=10"
	)
	if "%ImageBuild%" geq "22000" (
		set "SelectedSourceOS=w11"
		set "OSID=11"
	)
)

if "%ImageVersion:~0,-6%" equ "11.0" (
	set "SelectedSourceOS=w11"
	set "OSID=11"
)

:: Setting Package Service Pack Build, Version and Service Pack Build 
if "%SelectedSourceOS%" equ "w7" set "PackageServicePackBuild=17514"
if "%SelectedSourceOS%" equ "w81" set "PackageServicePackBuild=16384"

if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" geq "10240" if "%ImageBuild%" leq "15063" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=0"
	)
	if "%ImageBuild%" equ "16299" (
		set "PackageBuild=16299"
		set "PackageVersion=10.0.16299"
		set "PackageServicePackBuild=15"
	)
	if "%ImageBuild%" geq "17134" if "%ImageBuild%" leq "17763" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=1"
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
		set "PackageBuild=18362"
		set "PackageVersion=10.0.18362"
		set "PackageServicePackBuild=1"
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		set "PackageBuild=19041"
		set "PackageVersion=10.0.19041"
		set "PackageServicePackBuild=1"
	)
	if "%ImageBuild%" equ "20348" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=1"
	)
)

if "%SelectedSourceOS%" equ "w11" (
	if "%ImageBuild%" geq "22000" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=1"
	)
)

:: Setting Package Index and Architecture
if "%ImageArchitecture%" equ "x86" (
	set "PackageIndex=1"
	set "PackageArchitecture=x86"
)
if "%ImageArchitecture%" equ "x64" (
	set "PackageIndex=2"
	set "PackageArchitecture=amd64"
)
if "%ImageArchitecture%" equ "arm" (
	set "PackageIndex=3"
	set "PackageArchitecture=arm"
)
if "%ImageArchitecture%" equ "arm64" (
	set "PackageIndex=4"
	set "PackageArchitecture=arm64"
)

:: Checking whether the HOST OS is Windows 7 and selected Source OS is Windows 10/11
if "%HostVersion%" equ "6.1" if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	echo.
	echo.ToolKit cannot service Windows 10/11 Source OS on Windows 7 HOST OS...
	echo.
	echo.ToolKit requires a Windows 8.1/10/11 HOST OS for servicing Windows 10/11 Source OS...
	goto :Stop
)

:: Check whether the selected Source OS is compatible with ToolKit's Custom Component Remover
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	if "%ImageServicePackBuild%" equ "1" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" equ "17763" if "%ImageServicePackBuild%" equ "5696" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageServicePackBuild%" equ "2274" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		if "%ImageFlag%" equ "EnterpriseS" if "%ImageServicePackBuild%" equ "1288" set "IsCustomRemovalBuild=Yes"
		if "%ImageFlag%" equ "EnterpriseSN" if "%ImageServicePackBuild%" equ "1288" set "IsCustomRemovalBuild=Yes"
		if "%ImageServicePackBuild%" equ "4291" set "IsCustomRemovalBuild=Yes"
	)
	if "%ImageBuild%" equ "22000" if "%ImageServicePackBuild%" equ "2899" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%ImageServicePackBuild%" equ "3447" set "IsCustomRemovalBuild=Yes"
)

if "%IsCustomRemovalBuild%" neq "Yes" (
	echo.
	echo.The selected source image build does not support custom component removal,
	echo.However it supports DISM component removal. For component removal, use Remove
	echo.Windows Components using Package List ^(DISM Method^) menu.
	choice /C:YN /N /M "Do you want to continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
)

echo.
choice /C:YN /N /M "Do you want to mount Windows Setup Boot Image ? ['Y'es/'N'o] : "
if errorlevel 2 set "IsBootImageSelected=No"
if errorlevel 1 set "IsBootImageSelected=Yes"

choice /C:YN /N /M "Do you want to mount Windows Recovery Image ? ['Y'es/'N'o] : "
if errorlevel 2 set "IsRecoveryImageSelected=No"
if errorlevel 1 set "IsRecoveryImageSelected=Yes"

echo.
echo.-------------------------------------------------------------------------------
echo.####Source Image Information###################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    :  Install.wim
echo.    Image Index No           :  %ImageIndexNo%
echo.    Image Architecture       :  %ImageArchitecture%
echo.    Image Version            :  %ImageVersion%
echo.    Image Service Pack Build :  %ImageServicePackBuild%
echo.    Image Service Pack Level :  %ImageServicePackLevel%
echo.    Image Build              :  %ImageBuild%
echo.    Image Default Language   :  %ImageDefaultLanguage%
echo.
echo.-------------------------------------------------------------------------------
echo.####Mounting Source Images#####################################################
echo.-------------------------------------------------------------------------------
echo.
:: Mounting Source Boot Image Index to Service
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		call :CreateFolder "%BootMount%\%%i"

		echo.-------------------------------------------------------------------------------
		echo.Mounting [Boot.wim, Index : %%i] Image at ^<\Mount\Boot\%%i^>...
		echo.-------------------------------------------------------------------------------
		call :MountImage "%BootWim%", %%i, "%BootMount%\%%i"
	)
)

:: Mounting Source Install & Recovery Images Index to Service
for %%i in (%ImageIndexNo%) do (
	call :CreateFolder "%InstallMount%\%%i"

	:: Mounting Source Install Image Indexes to Service
	echo.-------------------------------------------------------------------------------
	echo.Mounting [Install.wim, Index : %%i] Image at ^<\Mount\Install\%%i^>...
	echo.-------------------------------------------------------------------------------
	call :MountImage "%InstallWim%", %%i, "%InstallMount%\%%i"
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	call :CreateFolder "%WinReMount%"

	:: Mounting Source Recovery Image Indexes to Service
	echo.-------------------------------------------------------------------------------
	echo.Mounting [Install.wim, Index : %DefaultIndexNo% -^> WinRE.wim] Image at ^<\Mount\WinRE^>...
	echo.-------------------------------------------------------------------------------
	call :MountImage "%InstallMount%\%DefaultIndexNo%\%WinReWim%", 1, "%WinReMount%"
)

echo.-------------------------------------------------------------------------------
echo.####Finished Selecting ^& Mounting Source Images################################
echo.-------------------------------------------------------------------------------

set "IsSourceSelected=Yes"

:: Getting Information for Unattended file
call :GetInformation4UnattendedFile >nul 2>&1

:: Reset Windows Components Removal Compatibility Settings
call :SetComponentsCompatibility

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Copy Source from DVD Drive to ^<DVD^> folder
::-------------------------------------------------------------------------------------------
:CopySourceDVD

setlocal

set DriveLetter=

cls
echo.===============================================================================
echo.          MSMG ToolKit - Copy Source from DVD Drive to ^<DVD^> folder
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's Source ^<DVD^> folder is not empty...
	echo.
	choice /C:YN /N /M "Do you want to remove it & continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Copying Source from DVD Drive to ^<DVD^> folder#####################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting DVD Drive Options##################################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting DVD Drive Letter
set /p DriveLetter=Enter DVD Drive Letter : 

:: Setting DVD Drive Letter
set "DriveLetter=%DriveLetter%:"
echo.

:: Checking whether the specified DVD Drive letter is empty
if not exist "%DriveLetter%\sources\boot.wim" (
	echo.Can't find Windows OS Installation files in the specified Drive Letter..
	echo.
	echo.Please enter the correct DVD Drive Letter..
	goto :Stop
)

:: Checking whether the specified DVD Drive Letter is empty
if not exist "%DriveLetter%\sources\install.wim" (
	echo.Can't find Windows OS Installation files in the specified Drive Letter..
	echo.
	echo.Please enter the correct DVD Drive Letter..
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Copying Source from DVD Drive to ^<DVD^> folder##############################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.Copying Source from DVD Drive ^<%DriveLetter%^> to Source ^<DVD^> folder...
echo.
echo.Copying from DVD Drive may take some time, so please wait...
%XCopy% %DriveLetter% "%DVD%" >nul
echo.
echo.Copying Complete...
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Copying Source from DVD Drive to ^<DVD^> folder#####################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set DriveLetter=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from DVD ISO Image to <DVD> folder
::-------------------------------------------------------------------------------------------
:ExtractSourceISO

setlocal

set ISOFileName=

cls
echo.===============================================================================
echo.      MSMG ToolKit - Extract Source from DVD ISO Image to ^<DVD^> folder
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's Source ^<DVD^> folder is not empty...
	echo.
	choice /C:YN /N /M "Do you want to remove it & continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
	echo.
)

:: Checking whether DVD ISO Image folder is empty
if not exist "%ISO%\*.iso" (
	echo.DVD ISO Image folder ^<ISO^> is empty...
	echo.
	echo.Please copy DVD ISO Images to ^<ISO^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Extracting Source from DVD ISO Image to ^<DVD^> folder##############
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting DVD ISO Image Options##############################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting DVD ISO Image file Name
set /p ISOFileName=Enter the ISO Image filename without .iso : 

:: Setting DVD ISO Image file Name
set "ISOFileName=%ISOFileName%.iso"
echo.

:: Checking whether the specified DVD ISO Image file exist
if not exist "%ISO%\%ISOFileName%" (
	echo.Can't find the specified DVD ISO Image : "<%ISO%\%ISOFileName%>"...
	echo.
	echo.Please enter the correct DVD ISO Image filename...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Extracting Source from DVD ISO Image to ^<DVD^> folder#######################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.Extracting DVD ISO Image contents to Source ^<DVD^> folder...
echo.
echo.Extraction may take some time, so please wait...
"%Zip%" x -y "%ISO%\%ISOFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if exist "%DVD%\sources\install.esd" set /a n+=1
if "%n%" equ "2" (echo.Extraction Complete...) else echo.Extraction Failed...
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Extracting Source from DVD ISO Image to ^<DVD^> folder##############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from OEM IMG Image to <DVD> folder
::-------------------------------------------------------------------------------------------
:ExtractSourceIMG

setlocal

set IMGFileName=

cls
echo.===============================================================================
echo.      MSMG ToolKit - Extract Source from OEM IMG Image to ^<DVD^> folder
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's Source ^<DVD^> folder is not empty...
	echo.
	choice /C:YN /N /M "Do you want to remove it & continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
)

:: Checking whether OEM IMG folder is empty
if not exist "%ISO%\*.img" (
	echo.Can't find Windows Install OEM IMG Image file in ^<ISO^> folder...
	echo.
	echo.Please copy Windows Install OEM IMG Image file to ^<ISO^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Extracting Source from OEM IMG Image to ^<DVD^> folder##############
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting OEM IMG Image Options##############################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting OEM IMG file Name
set /p IMGFileName=Enter the OEM IMG filename without .img : 

:: Setting OEM IMG file Name
set "IMGFileName=%IMGFileName%.img"
echo.

:: Checking whether the specified OEM IMG Image file exist
if not exist "%ISO%\%IMGFileName%" (
	echo.Can't find the specified DVD ISO Image : "<%ISO%\%IMGFileName%>"...
	echo.
	echo.Please enter the correct OEM IMG Image filename...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Extracting Source from OEM IMG Image to ^<DVD^> folder#######################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.Extracting OEM IMG Image Contents to Source ^<DVD^> folder...
echo.
echo.Extraction may take some time, so please wait...
"%Zip%" x -y "%ISO%\%IMGFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if "%n%" equ "2" (echo.Extraction Complete...) else echo.Extraction Failed...
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Extracting Source from OEM IMG Image to ^<DVD^> folder##############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set IMGFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from Store ESD Image
::-------------------------------------------------------------------------------------------
:ExtractSourceStoreESD

setlocal

set ImageBuild=

cls
echo.===============================================================================
echo.            MSMG ToolKit - Extract Source from Store ESD Image
echo.===============================================================================
echo.

:: Checking whether Windows Store ESD Image exist
if not exist "%InstallEsd%" (
	echo.Can't find Windows Store ESD Image file "Install.esd" in ^<DVD\Sources^> folder.
	echo.
	echo.Please copy Windows Store ESD Image file to ^<DVD\Sources^> folder...
	goto :Stop
)

:: Getting Image Index Name
call :GetImageName "%InstallESD%", 1 >nul

:: Checking whether Source Image is a Windows Store ESD Image
if "%ImageName%" neq "Windows Setup Media" (
	echo.The specified Source Image is not a Windows Store ESD Image
	echo.
	echo.Please copy a valid Windows Store ESD Image file to ^<DVD\Sources^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Extracting Source from Store ESD Image############################
echo.-------------------------------------------------------------------------------
echo.
echo.Reading Image Information...
echo.
echo.===============================================================================
echo.^|Index^| Arch ^| Name
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr Index') do (
	for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:  " %%c in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Name') do (
			if %%a equ 1 echo.^|  %%a  ^|  -   ^|%%c
			if %%a gtr 1 if %%a leq 9 echo.^|  %%a  ^|%%b  ^|%%c
			if %%a gtr 9 echo.^|  %%a ^|%%b  ^|%%c
		)
	)
)
echo.===============================================================================
echo.

:: Finding total no of indexes present inside the ESD Image
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 4 set ImageIndexNo=4

if %ImageCount% gtr 4 (
	:: Getting Image Index Number to Service
	set /p ImageIndexNo=Enter the Image Index # [Range : 4,...%ImageCount%, 'A'll, 'Q'uit] : 

	:: Checking for Image Index Validation
	if not defined ImageIndexNo (
		echo.
		echo.Invalid Index # Entered, Valid Range is [4,...%ImageCount%, 'A'll, 'Q'uit]
		echo.
		pause>nul|set /p=Press any key to continue...
		goto :ExtractSourceStoreESD
	)

	if /i "%ImageIndexNo%" equ "A" (
		set "ImageIndexNo=3"

		for /l %%i in (4, 1, %ImageCount%) do (
			set "ImageIndexNo=!ImageIndexNo!,%%i"
		)
	)

	if /i "%ImageIndexNo%" equ "Q" goto :MainMenu
)
echo.
echo.-------------------------------------------------------------------------------
echo.####Extracting Source from Store ESD Image#####################################
echo.-------------------------------------------------------------------------------
attrib -r -h -s -a "%InstallEsd%" >nul
for /f "skip=1 tokens=4 delims=:." %%e in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:4 ^| find /i "Version"') do set ImageBuild=%%e
"%WimlibImagex%" info "%InstallEsd%" 4 1>nul 2>nul
if %ERRORLEVEL% equ 74 (
	echo.
	echo.Decrypting Windows Store ESD Image...
	"%EsdDecrypter%" "%InstallEsd%" 2>nul
)
echo.
echo.-------------------------------------------------------------------------------
echo.Applying Windows Store ESD Image [Install.esd, Index : 1] to ^<Temp\DVD^>...
echo.-------------------------------------------------------------------------------
:: Creating Windows Setup Installation Media folder "%Temp%\DVD"
call :RemoveFolder "%Temp%\DVD"
call :CreateFolder "%Temp%\DVD"
call :ApplyImage "%InstallEsd%", 1, "%Temp%\DVD"
echo.-------------------------------------------------------------------------------
echo.Exporting Windows Store ESD Image [Install.esd, Index : 2] to Boot Image...
echo.-------------------------------------------------------------------------------
rem call :ExportImageIndex "%InstallEsd%", 2, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
echo.
"%WimlibImagex%" export "%InstallEsd%" 2 "%Temp%\DVD\sources\boot.wim" --boot --compress=LZX
call :DeleteImage "%Temp%\DVD\sources\boot.wim", 1 >nul
echo.
echo.-------------------------------------------------------------------------------
echo.Exporting Windows Store ESD Image [Install.esd, Index : 3] to Boot Image...
echo.-------------------------------------------------------------------------------
rem call :ExportImageIndex "%InstallEsd%", 3, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
echo.
"%WimlibImagex%" export "%InstallEsd%" 3 "%Temp%\DVD\sources\boot.wim" --boot --compress=LZX
echo.
if %ImageBuild% equ 9600 (
	echo.-------------------------------------------------------------------------------
	echo.Exporting Windows Store ESD Image [Install.esd, Index : 4] to Install Image...
	echo.-------------------------------------------------------------------------------
	rem call :ExportImageIndex "%InstallEsd%", 4, "%Temp%\DVD\sources\install.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" export "%InstallEsd%" 4 "%Temp%\DVD\sources\install.wim" --compress=LZX
	echo.
)

if %ImageBuild% gtr 9600 (
	for %%i in (%ImageIndexNo%) do (
		echo.-------------------------------------------------------------------------------
		echo.Exporting Windows Store ESD Image [Install.esd, Index : %%i] to Install Image...
		echo.-------------------------------------------------------------------------------
		rem call :ExportImageIndex "%InstallEsd%", %%i, "%Temp%\DVD\sources\install.wim", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallEsd%" %%i "%Temp%\DVD\sources\install.wim" --compress=LZX
		echo.
	)
)

:: Moving ESD to WIM converted folder <Temp\DVD> to <DVD> Source Folder
call :RemoveFolder "%DVD%"
move /y "%Temp%\DVD" "%ROOT%" >nul

echo.-------------------------------------------------------------------------------
echo.####Copying EI.CFG Config file to Source ^<DVD\sources^> folder##################
echo.-------------------------------------------------------------------------------
echo.
:: Getting Install Image Index Edition
call :GetImageEdition "%InstallWim%", 1

:: Writing EI.cfg Config file to <DVD\sources> folder
echo.Copying EI.CFG file to ^<DVD\sources^> folder...

if exist "%DVD%\sources\EI.CFG" del /f /q "%DVD%\sources\EI.CFG" >nul
(
	echo.[EditionID]
	if %ImageCount% equ 1 echo.%ImageEdition%
	if %ImageCount% gtr 1 echo.
	echo.
	echo.[Channel]
	echo.Retail
	echo.
	echo.[VL]
	echo.0
	echo.
)>"%DVD%\sources\EI.CFG"

:: Cleaning Up Unwanted files from Source folder
call :RemoveFile "%DVD%\MediaMeta.xml"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Extracting Source from Store ESD Image############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set ImageBuild=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from MCT or Custom ESD Install Image
::-------------------------------------------------------------------------------------------
:ExtractSourceESD

setlocal

cls
echo.===============================================================================
echo.   MSMG ToolKit - Extract Source from MCT or Custom ESD Install Image
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%BootWim%" (
	echo.Can't find Windows Setup "Boot.wim" Image in ^<DVD\Sources^> folder...
	echo.
	echo.Please copy Windows Setup "Boot.wim" Image to ^<DVD\Sources^> folder...
	goto :Stop
)

:: Checking whether Windows Source Install ESD Image exist
if not exist "%InstallEsd%" (
	echo.Can't find Windows Setup "Install.esd" Image in ^<DVD\Sources^> folder...
	echo.
	echo.Please copy Windows Setup "Install.esd" Image to ^<DVD\Sources^> folder...
	goto :Stop
)

:: Getting Image Index Name
call :GetImageName "%InstallESD%", 1 >nul

:: Checking whether Source Image is a MCT or Custom ESD Install Image
if "%ImageName%" equ "Windows Setup Media" (
	echo.The specified Source Image is not a MCT or Custom ESD Install Image
	echo.
	echo.Please copy a valid Windows MCT or Custom ESD Install Image file to ^<DVD\Sources^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Extract Source from MCT or Custom ESD Install Image###############
echo.-------------------------------------------------------------------------------
echo.
echo.Reading Image Information...
echo.
echo.===============================================================================
echo.^|Index^| Arch ^| Name
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr Index') do (
	for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:  " %%c in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Name') do (
			if %%a leq 9 echo.^|  %%a  ^|%%b  ^|%%c
			if %%a gtr 9 echo.^|  %%a ^|%%b  ^|%%c
		)
	)
)
echo.===============================================================================
echo.

:: Finding total no of indexes present inside the ESD Image
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 1 (
	set /p ImageIndexNo=Enter the Image Index # [1 or 'Q'uit] : 
) else set /p ImageIndexNo=Enter the Image Index # [Range : 1,...%ImageCount%, 'A'll, 'Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered, Valid Range is [1,...%ImageCount%, 'A'll, 'Q'uit]
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :ExtractSourceESD
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
	for /l %%i in (2, 1, %ImageCount%) do (
		set "ImageIndexNo=!ImageIndexNo!,%%i"
	)
)

if /i "%ImageIndexNo%" equ "Q" goto :MainMenu

echo.
echo.-------------------------------------------------------------------------------
echo.####Extracting Source from MCT or Custom ESD Install Image#####################
echo.-------------------------------------------------------------------------------
echo.

:: Converting Source MCT or Custom ESD Install Image to WIM Image
for %%i in (%ImageIndexNo%) do (
	echo.-------------------------------------------------------------------------------
	echo.Exporting [Install.esd, Index : %%i] to Install Image...
	echo.-------------------------------------------------------------------------------
	rem call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
	echo.
	"%WimlibImagex%" export "%InstallEsd%" %%i "%InstallWim%" --compress=LZX
	echo.
)

:: Deleting original Source MCT or Custom ESD Install Image
call :RemoveFile "%InstallEsd%"

echo.-------------------------------------------------------------------------------
echo.####Finished Extract Source from MCT or Custom ESD Install Image###############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Language Packs Menu
::-------------------------------------------------------------------------------------------
:IntLanguagePacksMenu

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.               MSMG ToolKit - Integrate Windows Language Packs
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo.   Do not integrate a language pack after an update. If you integrate any
	echo.   updates ^(Hotfix, General Distribution Release [GDR], Zero Day Patch [ZDP]
	echo.   or Service Pack [SP]^) that contains language-dependent resources before
	echo.   you integrate a language pack, The language-specific changes that are
	echo.   contained in the update are not applied and you will have to re-integrate
	echo.   the update. Always integrate language packs before you integrate updates.
	echo.
	echo.
	echo.
	echo.
	echo.   To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set LanguagePackType=
set LanguagePackCode=

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Windows Language Packs Menu
echo.===============================================================================
echo.
echo.  [1]   Integrate to Windows Setup Boot Image
echo.
echo.  [2]   Integrate to Windows Installation Image
echo.
echo.  [3]   Integrate to Windows Recovery Image
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "Enter Your Choice : "
if errorlevel 4 goto :IntegrateMenu
if errorlevel 3 set "LanguagePackType=Recovery"
if errorlevel 2 set "LanguagePackType=Install"
if errorlevel 1 set "LanguagePackType=Boot"

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Windows Language Packs Menu
echo.===============================================================================
echo.

if "%LanguagePackType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows Setup Boot Image is not selected...
	echo.
	echo.Please choose Windows Setup Boot Image while selecting Source...
	goto :Stop
)

if "%LanguagePackType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows Recovery Image is not selected...
	echo.
	echo.Please choose Windows Recovery Image while selecting Source...
	goto :Stop
)

cls
echo.===============================================================================
echo.    MSMG ToolKit - Integrate Windows Language Packs - Choose Language Menu
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Latvian - Latvia         [lv-LV]
	echo. Bulgarian - Bulgaria     [bg-BG]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Norwegian - Norway       [nb-NO]
	echo. Chinese - Simplified     [zh-CN]    Polish - Poland          [pl-PL]
	echo. Chinese - Taiwan         [zh-TW]    Portuguese - Brazil      [pt-BR]
	echo. Croatian - Croatia       [hr-HR]    Portuguese - Portugal    [pt-PT]
	echo. Czech - Czech Republic   [cs-CZ]    Romanian - Romania       [ro-RO]
	echo. Danish - Denmark         [da-DK]    Russian - Russia         [ru-RU]
	echo. Dutch - The Netherlands  [nl-NL]    Serbian - Serbia         [sr-Latn-CS]
	echo. English - United States  [en-US]    Slovak - Slovakia        [sk-SK]
	echo. Estonian - Estonia       [et-EE]    Slovenian - Slovenia     [sl-SI]
	echo. Finnish - Finland        [fi-FI]    Spanish - Spain          [es-ES]
	echo. French - France          [fr-FR]    Swedish - Sweden         [sv-SE]
	echo. German - Germany         [de-DE]    Thai - Thailand          [th-TH]
	echo. Greek - Greece           [el-GR]    Turkish - Turkey         [tr-TR]
	echo. Hebrew - israel          [he-IL]    Ukrainian - Ukraine      [uk-UA]
	echo. Hungarian - Hungary      [hu-HU]
	echo. Italian - Italy          [it-IT]
	echo. Japanese - Japan         [ja-JP]
	echo. Korean - Korea           [ko-KR]   [X] Go-Back
)

if "%SelectedSourceOS%" equ "w81" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Korean - Korea           [ko-KR]
	echo. Bulgarian - Bulgaria     [bg-BG]    Latvian - Latvia         [lv-LV]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Simplified     [zh-CN]    Norwegian - Norway       [nb-NO]
	echo. Chinese - Taiwan         [zh-TW]    Polish - Poland          [pl-PL]
	echo. Croatian - Croatia       [hr-HR]    Portuguese - Brazil      [pt-BR]
	echo. Czech - Czech Republic   [cs-CZ]    Portuguese - Portugal    [pt-PT]
	echo. Danish - Denmark         [da-DK]    Romanian - Romania       [ro-RO]
	echo. Dutch - The Netherlands  [nl-NL]    Russian - Russia         [ru-RU]
	echo. English - United Kingdom [en-GB]    Serbian - Serbia         [sr-Latn-CS]
	echo. English - United States  [en-US]    Slovak - Slovakia        [sk-SK]
	echo. Estonian - Estonia       [et-EE]    Slovenian - Slovenia     [sl-SI]
	echo. Finnish - Finland        [fi-FI]    Spanish - Spain          [es-ES]
	echo. French - France          [fr-FR]    Swedish - Sweden         [sv-SE]
	echo. German - Germany         [de-DE]    Thai - Thailand          [th-TH]
	echo. Greek - Greece           [el-GR]    Turkish - Turkey         [tr-TR]
	echo. Hebrew - israel          [he-IL]    Ukrainian - Ukraine      [uk-UA]
	echo. Hungarian - Hungary      [hu-HU]
	echo. Italian - Italy          [it-IT]
	echo. Japanese - Japan         [ja-JP]	  [X] Go-Back
)

if "%SelectedSourceOS%" equ "w10" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Japanese - Japan         [ja-JP]
	echo. Bulgarian - Bulgaria     [bg-BG]    Korean - Korea           [ko-KR]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Latvian - Latvia         [lv-LV]
	echo. Chinese - Simplified     [zh-CN]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Taiwan         [zh-TW]    Norwegian - Norway       [nb-NO]
	echo. Croatian - Croatia       [hr-HR]    Polish - Poland          [pl-PL]
	echo. Czech - Czech Republic   [cs-CZ]    Portuguese - Brazil      [pt-BR]
	echo. Danish - Denmark         [da-DK]    Portuguese - Portugal    [pt-PT]
	echo. Dutch - The Netherlands  [nl-NL]    Romanian - Romania       [ro-RO]
	echo. English - United Kingdom [en-GB]    Russian - Russia         [ru-RU]
	echo. English - United States  [en-US]    Serbian - Serbia         [sr-Latn-RS]
	echo. Estonian - Estonia       [et-EE]    Slovak - Slovakia        [sk-SK]
	echo. Finnish - Finland        [fi-FI]    Slovenian - Slovenia     [sl-SI]
	echo. French - Canada          [fr-CA]    Spanish - Mexico         [es-MX]
	echo. French - France          [fr-FR]    Spanish - Spain          [es-ES]
	echo. German - Germany         [de-DE]    Swedish - Sweden         [sv-SE]
	echo. Greek - Greece           [el-GR]    Thai - Thailand          [th-TH]
	echo. Hebrew - israel          [he-IL]    Turkish - Turkey         [tr-TR]
	echo. Hungarian - Hungary      [hu-HU]    Ukrainian - Ukraine      [uk-UA]
	echo. Italian - Italy          [it-IT]    [X] Go-Back
)

if "%SelectedSourceOS%" equ "w11" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Italian - Italy          [it-IT]
	echo. Basque - Spain           [eu-ES]    Japanese - Japan         [ja-JP]
	echo. Bulgarian - Bulgaria     [bg-BG]    Korean - Korea           [ko-KR]
	echo. Catalan - Spain          [ca-ES]    Latvian - Latvia         [lt-LT]
	echo. Chinese - Simplified     [zh-CN]    Lithuanian - Lithuania   [lv-LV]
	echo. Chinese - Taiwan         [zh-TW]    Norwegian - Norway       [nb-NO]
	echo. Croatian - Croatia       [hr-HR]    Polish - Poland          [pl-PL]
	echo. Czech - Czech Republic   [cs-CZ]    Portuguese - Brazil      [pt-BR]
	echo. Danish - Denmark         [da-DK]    Portuguese - Portugal    [pt-PT]
	echo. Dutch - The Netherlands  [nl-NL]    Romanian - Romania       [ro-RO]
	echo. English - United Kingdom [en-GB]    Russian - Russia         [ru-RU]
	echo. English - United States  [en-US]    Serbian - Serbia         [sr-Latn-RS]
	echo. Estonian - Estonia       [et-EE]    Slovak - Slovakia        [sk-SK]
	echo. Finnish - Finland        [fi-FI]    Slovenian - Slovenia     [sl-SI]
	echo. French - Canada          [fr-CA]    Spanish - Mexico         [es-MX]
	echo. French - France          [fr-FR]    Spanish - Spain          [es-ES]
	echo. Galician - Spain         [gl-ES]    Swedish - Sweden         [sv-SE]
	echo. German - Germany         [de-DE]    Thai - Thailand          [th-TH]
	echo. Greek - Greece           [el-GR]    Turkish - Turkey         [tr-TR]
	echo. Hebrew - israel          [he-IL]    Ukrainian - Ukraine      [uk-UA]
	echo. Hungarian - Hungary      [hu-HU]    Vietnamese - Viet Nam    [vi-VN]
	echo. Indonesian - Indonesia   [id-ID]    [X] Go-Back
)
echo.===============================================================================
set /p LanguagePackCode=Enter Language Code without '[' ']' : 

if /i "%LanguagePackCode%" equ "X" goto :IntegrateMenu

cls
echo.===============================================================================
if "%LanguagePackType%" equ "Boot" echo.  MSMG ToolKit - Integrate Windows Language Packs to Windows Setup Boot Image
if "%LanguagePackType%" equ "Install" echo. MSMG ToolKit - Integrate Windows Language Packs to Windows Installation Image
if "%LanguagePackType%" equ "Recovery" echo.   MSMG ToolKit - Integrate Windows Language Packs to Windows Recovery Image
echo.===============================================================================
echo.

:: Getting Source Image Index Architecture
if "%LanguagePackType%" equ "Boot" (
	call :GetImageArchitecture "%BootWim%", 1 >nul
) else (
	call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul
)

:: Settings Windows Language Packs folder path
if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%"

:: Checking whether Windows PE Language Packs folder is empty
if "%LanguagePackType%" equ "Boot" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		for /d %%i in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
			if "%LanguagePackCode%" equ "%%i" if not exist "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Language Pack folder is missing the below file...
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
)

:: Checking whether Windows Language or Language Features Packs folder is empty
if "%LanguagePackType%" equ "Install" (
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if not exist "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" if not exist "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Client" if not exist "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
)

:: Checking whether Windows PE Language Packs folder is empty
if "%LanguagePackType%" equ "Recovery" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "22621" if not exist "%LanguagePacks%\WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		for /d %%i in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
			if "%LanguagePackCode%" equ "%%i" if not exist "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Language Pack folder is missing the below file...
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "14393" if not exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "22621" if not exist "%LanguagePacks%\WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Language Pack folder is missing the below file...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> folder...
		goto :Stop
	)
)
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####Started Integrating Windows Language Packs to Windows Boot Image###########
if "%LanguagePackType%" equ "Install" echo.####Started Integrating Windows Language Packs to Windows Installation Image###
if "%LanguagePackType%" equ "Recovery" echo.####Started Integrating Windows Language Packs to Windows Recovery Image#######
echo.-------------------------------------------------------------------------------
echo.
if "%LanguagePackType%" equ "Boot" (
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 1, 2
)
if "%LanguagePackType%" equ "Install" (
	echo.    Image                    : Install.wim
	echo.    Image Index              : %ImageIndexNo%
)
if "%LanguagePackType%" equ "Recovery" (
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####Integrating Windows Language Packs to Windows Boot Image###################
if "%LanguagePackType%" equ "Install" echo.####Integrating Windows Language Packs to Windows Installation Image###########
if "%LanguagePackType%" equ "Recovery" echo.####Integrating Windows Language Packs to Windows Recovery Image###############
echo.-------------------------------------------------------------------------------
echo.
if "%LanguagePackType%" equ "Boot" (
	for /l %%i in (1, 1, 2) do (
		echo.=============================[Boot.wim, Index : %%i]=============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE Language Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

			if "%ImageBuild%" geq "15063" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - AT Broker [%LanguagePackCode%] to Windows Boot Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Audio Core [%LanguagePackCode%] to Windows Boot Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Audio Drivers [%LanguagePackCode%] to Windows Boot Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Enhanced Storage Pack [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
		
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Narrator [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - IBS Provider Pack [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Scripting Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Secure Startup Pack [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	)

	echo.=============================[Boot.wim, Index : 2]=============================
	echo.
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Setup Pack to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE - Setup Pack [%LanguagePackCode%] to Windows Boot Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%ImageInstallationType:~,6%" neq "Server" (
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Setup Client Pack to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Setup Client Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	if "%ImageInstallationType:~,6%" equ "Server" (
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Setup Server Pack to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Setup Server Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	for /l %%i in (1, 1, 2) do (
		echo.=============================[Boot.wim, Index : %%i]=============================
		echo.
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
			for /d %%z in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
				if "%LanguagePackCode%" equ "%%z" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating WinPE - Speech TextToSpeech [%LanguagePackCode%] to Windows Boot Image...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				)
			)
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Speech TextToSpeech [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - SRH [%LanguagePackCode%] to Windows Boot Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - SRT Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - WDS Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - WMI Pack [%LanguagePackCode%] to Windows Boot Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

		for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
			if "%LanguagePackCode%" equ "%%z" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Font Support Pack [%LanguagePackCode%] to Windows Boot Image...
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.Generating Windows Boot Language Packs Integration Log File...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Writing Windows Boot Language Packs Integration Log...
		call :GetPackages "%BootMount%\%%i", "Boot-%%i.txt"
		echo.
	)

	echo.-------------------------------------------------------------------------------
	echo.Creating Windows Setup language configuration file [Lang.ini]...
	echo.-------------------------------------------------------------------------------
	%DISM% /Image:"%BootMount%\2" /Gen-LangINI /Distribution:"%DVD%"
	echo.
	echo.-------------------------------------------------------------------------------
	echo.Integrating [%LanguagePackCode%] Localized Windows Setup resources to the Source DVD...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.Extracting Windows PE Language Pack [%LanguagePackCode%] to Temporary folder...
	call :RemoveFolder "%Temp%\LanguagePack"
	call :CreateFolder "%Temp%\LanguagePack"

	if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
		if "%SelectedSourceOS%" equ "w7" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		if "%SelectedSourceOS%" equ "w81" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.Copying Localized Windows Setup resources files to the Source DVD...
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "15063" (
		expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.Copying Localized Windows Setup resources files to the Source DVD...
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-shmig-dl\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" if "%LanguagePackCode%" neq "en-US" (
		expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.Copying Localized Windows Setup resources files to the Source DVD...
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	echo.Copying Windows Setup language configuration file to the Boot Image...
	copy /y "%DVD%\sources\lang.ini" "%BootMount%\2\sources\lang.ini" >nul
	echo.
)

if "%LanguagePackType%" equ "Install" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" (
			if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
			if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Language Pack [%LanguagePackCode%]...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Language Features - Basic Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Language Features - Handwriting Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Language Features - OCR Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Language Features - Text To Speech Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Language Features - Speech Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)
			)

			echo.-------------------------------------------------------------------------------
			echo.Updating Windows Setup language configuration file [Lang.ini]...
			echo.-------------------------------------------------------------------------------
			%DISM% /Image:"%InstallMount%\%%i" /Gen-LangINI /Distribution:"%DVD%"
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Generating Windows Language Packs Integration Log File...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.Writing Windows Language Packs Integration Log...
			call :GetPackages "%InstallMount%\%%i", "LanguagePacks_Install-%%i.txt"
			echo.
		)
	)

	echo.-------------------------------------------------------------------------------
	echo.Integrating [%LanguagePackCode%] Localized Windows Setup resources to Source DVD...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.Extracting Windows Language Pack [%LanguagePackCode%] to Temporary folder...
	call :RemoveFolder "%Temp%\LanguagePack"
	call :CreateFolder "%Temp%\LanguagePack"
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" expand "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	echo.
	echo.Copying Localized Windows Setup resources files to the Source DVD...
	call :CreateFolder "%DVD%\sources\%LanguagePackCode%"

	if "%SelectedSourceOS%" equ "w7" (
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul

		if "%ImageInstallationType%" neq "Embedded" (
			call :CreateFolder "%DVD%\sources\sp1\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\etwproviders\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\sp1\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\sp1\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\sp1\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\sp1\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\sp1\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			echo.Copying Localized Windows Setup license files to the Source DVD...
			call :CreateFolder "%DVD%\sources\license\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\license\%LanguagePackCode%"
			xcopy /y "%Temp%\LanguagePack\sources\license\%LanguagePackCode%\*.*" "%DVD%\sources\license\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\sources\license\%LanguagePackCode%\*.*" "%DVD%\sources\sp1\license\%LanguagePackCode%" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w81" (
		if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "15063" (
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-shmig-dl\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "20348" (
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"

		if "%LanguagePackCode%" neq "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)

		if "%LanguagePackCode%" equ "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w11" (
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"

		if "%LanguagePackCode%" neq "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)

		if "%LanguagePackCode%" equ "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)
	)
	echo.
)

if "%LanguagePackType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE Language Pack [%LanguagePackCode%] to Windows Recovery Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		
		if "%ImageBuild%" geq "17134" (
			if exist "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Appx Packaging [%LanguagePackCode%] to Windows Recovery Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			if exist "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Opc Services [%LanguagePackCode%] to Windows Recovery Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		
			if "%ImageBuild%" geq "22621" if exist "%LanguagePacks%\WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Appx Deployment [%LanguagePackCode%] to Windows Recovery Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Appx Packaging [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - AT Broker [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Audio Core [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Audio Drivers [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	)
	
	if "%SelectedSourceOS%" neq "w7" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Enhanced Storage Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
		if "%LanguagePackCode%" equ "%%z" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Font Support Pack [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	)

	if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - IBS Provider Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	)
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - HTA Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		
		if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Narrator [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	
		if "%ImageBuild%" geq "17134" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WinPE - Opc Services [%LanguagePackCode%] to Windows Recovery Image...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	)
	
	if "%SelectedSourceOS%" neq "w7" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Rejuv Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE - Scripting Pack [%LanguagePackCode%] to Windows Recovery Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%SelectedSourceOS%" equ "w7" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Setup Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Setup Client Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	)

	if "%SelectedSourceOS%" neq "w7" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Secure Startup Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		for /d %%z in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
			if "%LanguagePackCode%" equ "%%z" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WinPE - Speech TextToSpeech [%LanguagePackCode%] to Windows Recovery Image...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)
	)
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Speech TextToSpeech [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - SRH [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE - SRT Pack [%LanguagePackCode%] to Windows Recovery Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	
	if "%SelectedSourceOS%" neq "w7" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Storage WMI Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE - WDS Pack [%LanguagePackCode%] to Windows Recovery Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - WiFi Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "22621" if exist "%LanguagePacks%\WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WinPE - Windows Update Pack [%LanguagePackCode%] to Windows Recovery Image...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	echo.-------------------------------------------------------------------------------
	echo.Integrating WinPE - WMI Pack [%LanguagePackCode%] to Windows Recovery Image...
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	echo.-------------------------------------------------------------------------------
	echo.Generating Windows Recovery Language Packs Integration Log File...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.Writing Windows Recovery Language Packs Integration Log...
	echo.
	call :GetPackages "%WinReMount%", "LanguagePacks_Install_WinRE.txt"
)

echo.-------------------------------------------------------------------------------
echo.####Cleaning Up Temporary Files ^& Folders######################################
echo.-------------------------------------------------------------------------------
echo.
echo.Cleaning Up Temporary folder...
call :RemoveFolder "%Temp%\LanguagePacks"
echo.
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####Finished Integrating Windows Language Packs to Windows Boot Image##########
if "%LanguagePackType%" equ "Install" echo.####Finished Integrating Windows Language Packs to Windows Installation Image##
if "%LanguagePackType%" equ "Recovery" echo.####Finished Integrating Windows Language Packs to Windows Recovery Image######
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set LanguagePacks=
set LanguagePackType=
set LanguagePackCode=

endlocal

:: Returning to Integrate Language Packs Menu
goto :IntLanguagePacksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Drivers Menu
::-------------------------------------------------------------------------------------------
:IntDriversMenu

setlocal

set DriverType=

cls
echo.===============================================================================
echo.                MSMG ToolKit - Integrate Windows Drivers Menu
echo.===============================================================================
echo.
echo.  [1]   Integrate to Windows Setup Boot Image
echo.
echo.  [2]   Integrate to Windows Installation Image
echo.
echo.  [3]   Integrate to Windows Recovery Image
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "Enter Your Choice : "
if errorlevel 4 goto :IntegrateMenu
if errorlevel 3 set DriverType=Recovery
if errorlevel 2 set DriverType=Install
if errorlevel 1 set DriverType=Boot

cls
echo.===============================================================================
if "%DriverType%" equ "Boot" echo.     MSMG ToolKit - Integrate Windows Drivers to Windows Setup Boot Image
if "%DriverType%" equ "Install" echo.    MSMG ToolKit - Integrate Windows Drivers to Windows Installation Image
if "%DriverType%" equ "Recovery" echo.      MSMG ToolKit - Integrate Windows Drivers to Windows Recovery Image
echo.===============================================================================
echo.

if "%DriverType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows Setup Boot Image is not selected...
	echo.
	echo.Please choose Windows Setup Boot Image while selecting Source...
	goto :Stop
)

if "%DriverType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows Recovery Image is not selected...
	echo.
	echo.Please choose Windows Recovery Image while selecting Source...
	goto :Stop
)

:: Getting Source Image Index Architecture
if "%DriverType%" equ "Boot" (
	call :GetImageArchitecture "%BootWim%", 1 >nul
) else (
	call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul
)

:: Settings Windows Drivers folder path
if "%DriverType%" equ "Boot" set "Drivers=%Drivers%\WinPE\%SelectedSourceOS%\%ImageArchitecture%"
if "%DriverType%" equ "Install" set "Drivers=%Drivers%\Install\%SelectedSourceOS%\%ImageArchitecture%"
if "%DriverType%" equ "Recovery" set "Drivers=%Drivers%\WinPE\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Windows Drivers folder is empty
for /f %%i in ('dir /b /s /a:-d "%Drivers%\*.*" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		if "%DriverType%" equ "Boot" echo.Windows Drivers folder ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> is empty...
		if "%DriverType%" equ "Install" echo.Windows Drivers folder ^<Drivers\Install\%SelectedSourceOS%\%ImageArchitecture%^> is empty...
		if "%DriverType%" equ "Recovery" echo.Windows Drivers folder ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> is empty...
		echo.
		echo.Please copy Windows Drivers files to respective folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####Started Integrating Windows Drivers to Windows Boot Image##################
if "%DriverType%" equ "Install" echo.####Started Integrating Windows Drivers to Windows Installation Image##########
if "%DriverType%" equ "Recovery" echo.####Started Integrating Windows Drivers to Windows Recovery Image##############
echo.-------------------------------------------------------------------------------
echo.
if "%DriverType%" equ "Boot" (
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 2
)
if "%DriverType%" equ "Install" (
	echo.    Image                    : Install.wim
	echo.    Image Index              : %ImageIndexNo%
)
if "%DriverType%" equ "Recovery" (
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####Integrating Windows Drivers to Windows Boot Image##########################
if "%DriverType%" equ "Install" echo.####Integrating Windows Drivers to Windows Installation Image##################
if "%DriverType%" equ "Recovery" echo.####Integrating Windows Drivers to Windows Recovery Image######################
echo.-------------------------------------------------------------------------------
echo.

if "%DriverType%" equ "Boot" (
	call :AddDriver "%BootMount%\2", "%Drivers%"
)

if "%DriverType%" equ "Install" (
	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]============================
			call :AddDriver "%InstallMount%\%%i", "%Drivers%"
		)
	)
)

if "%DriverType%" equ "Recovery" (
	call :AddDriver "%WinReMount%", "%Drivers%"
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####Finished Integrating Windows Drivers to Windows Boot Image#################
if "%DriverType%" equ "Install" echo.####Finished Integrating Windows Drivers to Windows Installation Image#########
if "%DriverType%" equ "Recovery" echo.####Finished Integrating Windows Drivers to Windows Recovery Image#############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Drivers=
set DriverType=

endlocal

:: Returning to Integrate Drivers Menu
goto :IntDriversMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 3.5
::-------------------------------------------------------------------------------------------
:IntNetFX35

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate Microsoft .NET Framework 3.5
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Microsoft .NET Framework 3.5 Feature Pack folder path according to Source Image Architecture
if "%SelectedSourceOS%" equ "w81" (
	if exist "%DVD%\sources\sxs" (
		set "NetFX35=%DVD%\sources\sxs"
	) else (
		set "NetFX35=%NetFX35%\%SelectedSourceOS%\%ImageArchitecture%"
	)
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	if exist "%DVD%\sources\sxs\*.cab" (
		if "%ImageBuild%" leq "16299" set "NetFX35=%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package.cab"
		if "%ImageBuild%" geq "17134" set "NetFX35=%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	) else (
		set "NetFX35=%NetFX35%\%SelectedSourceOS%\%PackageVersion%\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
)

:: Checking whether Microsoft .NET Framework 3.5 Feature Pack folder exist
if "%SelectedSourceOS%" equ "w81" if not exist "%NetFX35%\msil_system.net_b03f5f7f11d50a3a_6.3.9600.16384_none_78f2900af99c8442\system.net.dll" (
	echo.Microsoft .NET Framework 3.5 Pack folder is missing or empty...
	echo.
	echo.Please copy the files to ^<Packs\NetFX35\w81\%ImageArchitecture%^> folder...
	echo.
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 3.5 Feature Pack folder exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist %NetFX35% (
	echo.Microsoft .NET Framework 3.5 Pack file is missing...
	echo.
	if "%ImageBuild%" leq "16299" echo.Either copy the "microsoft-windows-netfx3-ondemand-package.cab" file from Source DVD to ^<DVD\sources\sxs^> folder
	if "%ImageBuild%" geq "17134" echo.Either copy the "microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" from Source DVD to ^<DVD\sources\sxs^> folder
	echo.
	echo.or Copy the below ToolKit Pack file to ^<Packs\NetFX35\%SelectedSourceOS%\%PackageVersion%^> folder..
	echo.
	echo."Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	goto :Stop
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%NetFX35%" neq "%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" if exist %NetFX35% (
	copy /y %NetFX35% "%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
	set "NetFX35=%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Framework 3.5###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Framework 3.5###################################
echo.-------------------------------------------------------------------------------

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.
		echo.-------------------------------------------------------------------------------
		echo.Checking whether Microsoft .NET Framework 3.5 is enabled...
		echo.-------------------------------------------------------------------------------
		echo.
		if "%SelectedSourceOS%" equ "w81" (
			%DISM% /Image:"%InstallMount%\%%i" /Get-FeatureInfo /FeatureName:NetFX3 | findstr /c:"State : Enable Pending" >nul
			if errorlevel 1 (
				echo.Microsoft .NET Framework 3.5 is not enabled.
				echo.
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Enable-Feature /All /LimitAccess /FeatureName:NetFX3 /Source:%NetFX35%
			) else (
				echo.Microsoft .NET Framework 3.5 has already been enabled.
			)
		)
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			%DISM% /Image:"%InstallMount%\%%i" /Get-FeatureInfo /FeatureName:NetFx3 | findstr /c:"State : Enabled" >nul
			if errorlevel 1 (
				echo.Microsoft .NET Framework 3.5 is not enabled.
				echo.
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-Package /PackagePath:%NetFX35%
			) else (
				echo.Microsoft .NET Framework 3.5 has already been enabled.
			)
		)
	)
)

call :RemoveFile "%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Framework 3.5##########################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set NetFX35=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 4.6.2 for Windows 10 v1507 & v1511 Source OS
::-------------------------------------------------------------------------------------------
:IntNetFX462

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - Integrate Microsoft .NET Framework 4.6.2
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
if not exist "%NetFX462%\Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft .NET Framework 4.6.2 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX462^> folder...
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
	if not exist "%NetFX462%\Windows10.0-KB4051600-%ImageArchitecture%.cab" (
		echo.Microsoft .NET Framework 4.6.2 Pack folder is missing the below file...
		echo.
		echo."Windows10.0-KB4051600-%ImageArchitecture%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\NetFX462^> folder...
		goto :Stop
	)
)

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" (
	if not exist "%NetFX462%\Windows10.0-KB4054057-%ImageArchitecture%.cab" (
		echo.Microsoft .NET Framework 4.6.2 Pack folder is missing the below file...
		echo.
		echo."Windows10.0-KB4054057-%ImageArchitecture%.cab""
		echo.
		echo.Please copy the above file to ^<Packs\NetFX462^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Framework 4.6.2#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Framework 4.6.2#################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft .NET Framework 4.6.2 Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if exist "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.6.2 [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
		)

		if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.6.2 Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4051600-%ImageArchitecture%.cab"
		)

		if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.6.2 Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4054057-%ImageArchitecture%.cab"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Framework 4.6.2########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set NetFX462=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 4.8
::-------------------------------------------------------------------------------------------
:IntNetFX48

setlocal

set NetFX48Pkg=
set NetFX48LpPkg=

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Microsoft .NET Framework 4.8
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Microsoft .NET Framework 4.8 Pack folder path
set "NetFX48=%NetFX48%\%SelectedSourceOS%"

:: Setting Image Package ServicePackBuildLevel
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "15063" (
		set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
		set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.14393.0.cab"
	)

	if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" (
		set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
		set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.16299.15.cab"
	)
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\Windows6.1-KB4019990-%ImageArchitecture%.cab" (
	echo.Microsoft .NET Framework 4.8 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB4019990-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX48\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\NetFX48.tpk" (
	echo.Microsoft .NET Framework 4.8 Pack folder is missing the below file...
	echo.
	echo."NetFX48.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX48\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\NetFX48_%ImageArchitecture%.reg" (
	echo.Microsoft .NET Framework 4.8 Pack folder is missing the below file...
	echo.
	echo."NetFX48_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX48\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%NetFX48%\Microsoft-Windows-NetFx48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab" (
	echo.Microsoft .NET Framework 4.8 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-NetFx48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX48\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%NetFX48%\%NetFX48Pkg%" (
	echo.Microsoft .NET Framework 4.8 Pack folder is missing the below file...
	echo.
	echo."%NetFX48Pkg%"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX48\%SelectedSourceOS%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Framework 4.8###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Framework 4.8###################################
echo.-------------------------------------------------------------------------------

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]============================

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.8 Prerequisite Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Windows6.1-KB4019990-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.8 Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%NetFX48%\NetFX48.tpk", %PackageIndex%, "%InstallMount%\%%i"

			if exist "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :ApplyImage "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
			)

			echo.-------------------------------------------------------------------------------
			echo.Importing Microsoft .NET Framework 4.8 Registry Settings...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.Mounting Image Registry...
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.Importing Registry Settings to Image Registry...
			call :ImportRegistry2Image "%NetFX48%\NetFX48_%ImageArchitecture%.reg"

			if exist "%NetFX48%\NetFX48_%ImageArchitecture%_%ImageDefaultLanguage%.reg" call :ImportRegistry2Image "%NetFX48%\NetFX48_%ImageArchitecture%_%ImageDefaultLanguage%.reg"

			echo.Un-Mounting Image Registry...
			call :UnMountImageRegistry
			echo.
		)

		if "%SelectedSourceOS%" equ "w81" (
			if not exist "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
			)

			if exist "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
				echo.
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			)
		)

		if "%SelectedSourceOS%" equ "w10" (
			if not exist "%NetFX48%\%NetFX48LpPkg%" call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48Pkg%"

			if exist "%NetFX48%\%NetFX48LpPkg%" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48Pkg%"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48LpPkg%"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Framework 4.8##########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set NetFX48=
set NetFX48Pkg=
set NetFX48LpPkg=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 4.8.1
::-------------------------------------------------------------------------------------------
:IntNetFX481

setlocal

cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft .NET Framework 4.8.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft .NET Framework 4.8.1 Pack file exist
if not exist "%NetFX481%\Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft .NET Framework 4.8.1 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\NetFX481^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Framework 4.8.1#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Framework 4.8.1#################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft .NET Framework 4.8.1 Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%NetFX481%\Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if exist "%NetFX481%\Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft .NET Framework 4.8.1 [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX481%\Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Framework 4.8.1########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Core Desktop Runtime 3.1
::-------------------------------------------------------------------------------------------
:IntNETCore31

setlocal

cls
echo.===============================================================================
echo.      MSMG ToolKit - Integrate Microsoft .NET Core Desktop Runtime 3.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft .NET Core Desktop Runtime 3.1 Pack file exist
if not exist "%NETCore31%\NETCore31_%SelectedSourceOS%.tpk" (
	echo.Microsoft .NET Core Desktop Runtime 3.1 Pack folder is missing the below file...
	echo.
	echo."NETCore31_%SelectedSourceOS%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\NETCore31^> folder...
	goto :Stop
)

if not exist "%NETCore31%\NETCore31_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft .NET Core Desktop Runtime 3.1 Pack folder is missing the below file...
	echo.
	echo."NETCore31_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\NETCore31^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Core Desktop Runtime 3.1################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Core Desktop Runtime 3.1########################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft .NET Core Desktop Runtime 3.1 Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NETCore31%\NETCore31_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft .NET Core Desktop Runtime 3.1 Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%NETCore31%\NETCore31_%SelectedSourceOS%_%ImageArchitecture%.reg"

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Core Desktop Runtime 3.1###############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Desktop Runtime 6
::-------------------------------------------------------------------------------------------
:IntNET6

setlocal

cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft .NET Desktop Runtime 6
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft .NET Desktop Runtime 6 Pack file exist
if not exist "%NET6%\NET6_%SelectedSourceOS%.tpk" (
	echo.Microsoft .NET Desktop Runtime 6 Pack folder is missing the below file...
	echo.
	echo."NET6_%SelectedSourceOS%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\NET6^> folder...
	goto :Stop
)

if not exist "%NET6%\NET6_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft .NET Desktop Runtime 6 Pack folder is missing the below file...
	echo.
	echo."NET6_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\NET6^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Desktop Runtime 6#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Desktop Runtime 6###############################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft .NET Desktop Runtime 6 Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NET6%\NET6_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft .NET Desktop Runtime 6 Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%NET6%\NET6_%SelectedSourceOS%_%ImageArchitecture%.reg"

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Desktop Runtime 6######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Desktop Runtime 7
::-------------------------------------------------------------------------------------------
:IntNET7

setlocal

cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft .NET Desktop Runtime 7
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft .NET Desktop Runtime 7 Pack file exist
if not exist "%NET7%\NET7_%SelectedSourceOS%.tpk" (
	echo.Microsoft .NET Desktop Runtime 7 Pack folder is missing the below file...
	echo.
	echo."NET7_%SelectedSourceOS%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\NET7^> folder...
	goto :Stop
)

if not exist "%NET7%\NET7_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft .NET Desktop Runtime 7 Pack folder is missing the below file...
	echo.
	echo."NET7_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\NET7^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft .NET Desktop Runtime 7#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft .NET Desktop Runtime 7###############################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft .NET Desktop Runtime 7 Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NET7%\NET7_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft .NET Desktop Runtime 7 Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%NET7%\NET7_%SelectedSourceOS%_%ImageArchitecture%.reg"

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft .NET Desktop Runtime 7######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Internet Explorer 11
::-------------------------------------------------------------------------------------------
:IntIE11

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Microsoft Internet Explorer 11
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
if not exist "%IE11%\Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft Internet Explorer 11 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\IE11^> folder...
	goto :Stop
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
if not exist "%IE11%\Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft Internet Explorer 11 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\IE11^> folder...
	goto :Stop
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
if "%ImageDefaultLanguage%" equ "en-US" if not exist "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab" (
	echo.Microsoft Internet Explorer 11 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
	echo.
	echo.Please copy the above file to ^<Packs\IE11^> folder...
	goto :Stop
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
if "%ImageDefaultLanguage%" equ "en-US" if not exist "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab" (
	echo.Microsoft Internet Explorer 11 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
	echo.
	echo.Please copy the above file to ^<Packs\IE11^> folder...
	goto :Stop
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
if "%ImageDefaultLanguage%" neq "en-US" if not exist "%IE11%\Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
	echo.Microsoft Internet Explorer 11 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\IE11^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Internet Explorer 11#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Internet Explorer 11#################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Internet Explorer 11 Prerequisite Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Internet Explorer 11 Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if "%ImageDefaultLanguage%" equ "en-US" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Internet Explorer 11 Hyphenation Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Internet Explorer 11 Spelling Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
		) else (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Internet Explorer 11 [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"

			if exist "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Internet Explorer 11 Hyphenation Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Internet Explorer 11 Hyphenation Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
			)

			if exist "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Internet Explorer 11 Spelling Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Internet Explorer 11 Spelling Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Internet Explorer 11##################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set IE11=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Remote Desktop Protocol (RDP) 8.0 & 8.1
::-------------------------------------------------------------------------------------------
:IntRDP81

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - Integrate Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RDP81^> folder...
	goto :Stop
)

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RDP81^> folder...
	goto :Stop
)

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RDP81^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1########################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Prerequisite Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Prerequisite Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1###############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set RDP81=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Management Framework (WMF) 5.1
::-------------------------------------------------------------------------------------------
:IntWMF

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - Integrate Windows Management Framework ^(WMF^) 5.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows Management Framework (WMF) 5.1 Pack folder path accroding to selected Source OS
set "WMF=%WMF%\%SelectedSourceOS%"

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if "%ImageArchitecture%" equ "x64" if not exist "%WMF%\Windows6.1-KB2809215-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB2809215-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB2872035-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB2872035-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB2872047-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB2872047-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB3033929-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB3033929-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB3191566-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB3191566-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%WMF%\Windows8.1-KB3191564-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 Pack folder is missing the below file...
	echo.
	echo."Windows8.1-KB3191564-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMF\%SelectedSourceOS%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Management Framework ^(WMF^) 5.1#################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Management Framework ^(WMF^) 5.1#########################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			if "%ImageArchitecture%" equ "x64" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Management Framework ^(WMF^) 5.1 Prerequisite Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2809215-%ImageArchitecture%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Management Framework ^(WMF^) 5.1 Prerequisite Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2872035-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Management Framework ^(WMF^) 5.1 Prerequisite Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2872047-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Management Framework ^(WMF^) 5.1 Prerequisite Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3033929-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Management Framework ^(WMF^) 5.1 Feature Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3191566-%ImageArchitecture%.cab"
		)

		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows8.1-KB3191564-%ImageArchitecture%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Management Framework ^(WMF^) 5.1################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WMF=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Paint
::-------------------------------------------------------------------------------------------
:IntMSPaint

setlocal

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Integrate Microsoft Paint
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Paint Pack file exist
if not exist "%MSPaint%\MSPaint.tpk" (
	echo.Microsoft Paint Pack folder is missing the below file...
	echo.
	echo."MSPaint.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\MSPaint^> folder...
	goto :Stop
)

:: Checking whether Microsoft Paint Pack file exist
if not exist "%MSPaint%\MSPaint_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft Paint Pack folder is missing the below file...
	echo.
	echo."MSPaint_%ImageDefaultLanguage%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\MSPaint^> folder...
	goto :Stop
)

:: Checking whether Microsoft Paint Pack file exist
if not exist "%MSPaint%\MSPaint_%ImageArchitecture%.reg" (
	echo.Microsoft Paint Pack folder is missing the below file...
	echo.
	echo."MSPaint_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\MSPaint^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Paint#######@@@@@@@@@@@######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Paint#########################@@@@@@@@@@@############
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Paint Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%MSPaint%\MSPaint.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Paint [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%MSPaint%\MSPaint_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Paint Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%MSPaint%\MSPaint_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Paint#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set MSPaint=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Win32 Calculator
::-------------------------------------------------------------------------------------------
:IntWin32Calc

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Microsoft Win32 Calculator
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Win32 Calculator Pack file exist
if not exist "%Win32Calc%\Win32Calc.tpk" (
	echo.Microsoft Win32 Calculator Pack folder is missing the below file...
	echo.
	echo."Win32Calc.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\Win32Calc^> folder...
	goto :Stop
)

:: Checking whether Microsoft Win32 Calculator Pack file exist
if "%ImageArchitecture%" neq "arm64" if not exist "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft Win32 Calculator Pack folder is missing the below file...
	echo.
	echo."Win32Calc_%ImageDefaultLanguage%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\Win32Calc^> folder...
	goto :Stop
)

:: Checking whether Microsoft Win32 Calculator Pack file exist
if not exist "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg" (
	echo.Microsoft Win32 Calculator Pack folder is missing the below file...
	echo.
	echo."Win32Calc_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\Win32Calc^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Win32 Calculator#############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Win32 Calculator#####################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Win32 Calculator Base Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" neq "arm64" call :ApplyImage "%Win32Calc%\Win32Calc.tpk", %PackageIndex%, "%InstallMount%\%%i"
		if "%ImageArchitecture%" equ "arm64" call :ApplyImage "%Win32Calc%\Win32Calc.tpk", 3, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------

		if "%ImageArchitecture%" neq "arm64" (
			echo.Integrating Microsoft Win32 Calculator [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		)

		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Win32 Calculator Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Win32 Calculator############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Win32Calc=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Data Deduplication
::-------------------------------------------------------------------------------------------
:IntDedup

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Windows Data Deduplication
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether the Source OS architecture is not 64-bit
if "%ImageArchitecture%" neq "x64" (
	echo.This feature is not applicable for 32-bit Source OS...
	goto :Stop
)

:: Setting Windows Data Deduplication Pack folder path accroding to selected Source OS
set "FSSMRESReg=%Dedup%\fssmres.dll.reg"
if "%SelectedSourceOS%"=="w81" set "Dedup=%Dedup%\%SelectedSourceOS%"
if "%SelectedSourceOS%"=="w10" set "Dedup=%Dedup%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
	if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Data Deduplication Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
		goto :Stop
	)

	if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Data Deduplication Pack folder is missing the below file...
		echo.
		echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
		goto :Stop
	)
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" (
	for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
		if "%ImageDefaultLanguage%" equ "%%j" (
			if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Data Deduplication Pack folder is missing the below file...
				echo.
				echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
				goto :Stop
			)

			if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Data Deduplication Pack folder is missing the below file...
				echo.
				echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
				goto :Stop
			)
		)
	)
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Data Deduplication#############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Data Deduplication#####################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows File Server Base Package....
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows File Server [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Deduplication Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Deduplication [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if "%ImageBuild%" equ "10586" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Base Package....
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------

				if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
					echo.Integrating Windows File Server [en-US] Language Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
					if "%ImageDefaultLanguage%" equ "%%j" (
						echo.Integrating Windows File Server [%ImageDefaultLanguage%] Language Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)
				)

				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------

				if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
					echo.Integrating Windows Deduplication [en-US] Language Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
					if "%ImageDefaultLanguage%" equ "%%j" (
						echo.Integrating Windows Deduplication [%ImageDefaultLanguage%] Language Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)
				)
			)

			if "%ImageBuild%" equ "14393" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if exist "%Dedup%\Updates\*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Deduplication Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Updates"
				)
			)

			if "%ImageBuild%" equ "15063" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core [en-US] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication [en-US] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			if "%ImageBuild%" geq "16299" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows File Server Core [%ImageDefaultLanguage%] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication [%ImageDefaultLanguage%] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			if exist "%Dedup%\Updates\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Deduplication Update Packages...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Updates"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.Enabling Windows Data Deduplication Feature...
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" (
			call :EnableFeature "%InstallMount%\%%i", "Dedup-Core /All"
			echo.-------------------------------------------------------------------------------
			echo.Enabling Windows File Services Search Service Feature...
			echo.-------------------------------------------------------------------------------
			call :EnableFeature "%InstallMount%\%%i", "File-Services-Search-Service /All"
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :EnableFeature "%InstallMount%\%%i", "Dedup-Core /All"

		echo.-------------------------------------------------------------------------------
		echo.Importing Windows File Server ^(fssmres.dll^) Fix Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%FSSMRESReg%"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Data Deduplication############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Dedup=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows To Go Workspace
::-------------------------------------------------------------------------------------------
:IntWinToGo

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - Integrate Windows To Go Workspace
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows To Go Workspace Pack path
if "%SelectedSourceOS%" equ "w81" set "WinToGo=%WinToGo%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "WinToGo=%WinToGo%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG.tpk" (
	echo.Windows To Go Workspace Pack file "WTG.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\WinToGo\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG_%ImageDefaultLanguage%.tpk" (
	echo.Windows To Go Workspace Pack file "WTG_%ImageDefaultLanguage%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\WinToGo\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG_%ImageArchitecture%.reg" (
	echo.Windows To Go Workspace Pack file "WTG_%ImageArchitecture%.reg" not found...
	echo.
	echo.Please copy the above file to ^<Packs\WinToGo\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go Workspace Pack folder is missing the below file...
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WinToGo\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go Workspace Pack folder is missing the below file...
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WinToGo\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows To Go Workspace################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows To Go Workspace########################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows To Go Workspace Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows To Go Workspace [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Importing Windows To Go Workspace Registry Settings...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.Mounting Image Registry...
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.Importing Registry Settings to Image Registry...
			call :ImportRegistry2Image "%WinToGo%\WTG_%ImageArchitecture%.reg"
			echo.Un-Mounting Image Registry...
			call :UnMountImageRegistry
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows To Go Workspace Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows To Go Workspace [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows To Go Workspace###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WinToGo=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows System Restore
::-------------------------------------------------------------------------------------------
:IntSystemRestore

setlocal

cls
echo.===============================================================================
echo.               MSMG ToolKit - Integrate Windows System Restore
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows System Restore Pack Path
if "%SelectedSourceOS%" equ "w7" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows System Restore Pack file exist
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows System Restore Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.Please copy the above file to ^<Packs\SystemRestore\%SelectedSourceOS%^> folder...
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Please copy the above file to ^<Packs\SystemRestore\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows System Restore Pack file exist
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows System Restore Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.Please copy the above file to ^<Packs\SystemRestore\%SelectedSourceOS%^> folder...
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Please copy the above file to ^<Packs\SystemRestore\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows System Restore#################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows System Restore#########################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows System Restore Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows System Restore [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows System Restore################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set SystemRestore=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Edge Classic Browser
::-------------------------------------------------------------------------------------------
:IntEdgeClassic

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate Microsoft Edge Classic Browser
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Microsoft Edge Classic Browser Pack path
set "EdgeClassic=%EdgeClassic%\%PackageVersion%"

:: Checking whether Microsoft Edge Classic Browser Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge Classic Browser Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\EdgeBrowser\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Microsoft Edge Classic Browser Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge Classic Browser Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\EdgeBrowser\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Edge Classic Browser#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Edge Classic Browser#################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Classic Browser Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Classic Browser [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

		:: Importing Registry Fix to Enable Integrating Windows 10 Cumulative Update.
		if "%ImageBuild%" lss "17763" (
			for %%j in (EnterpriseS, ServerStandard, ServerDatacenter) do (
				if "%ImageEdition%" equ "%%j" if exist "%InstallMount%\%%i\Windows\servicing\packages\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~*.mum" (
					call :MountImageRegistry "%InstallMount%\%%i"
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.mum" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs.bin.%PackageArchitecture%fre.dep\mergedcomponents\images\client\packages\\" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "Visibility" /t REG_DWORD /d "1" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeHigh" /t REG_DWORD /d "30531506" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeLow" /t REG_DWORD /d "76431985" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
					call :UnMountImageRegistry
				)
			)

			if "%ImageEdition%" equ "EnterpriseSN" if exist "%InstallMount%\%%i\Windows\servicing\packages\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~*.mum" (
				call :MountImageRegistry "%InstallMount%\%%i"
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.mum" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs.bin.%PackageArchitecture%fre.dep\mergedcomponents\images\client\packages\\" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "Visibility" /t REG_DWORD /d "1" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeHigh" /t REG_DWORD /d "30531506" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeLow" /t REG_DWORD /d "76431985" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
				call :UnMountImageRegistry
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Edge Classic Browser########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set EdgeClassic=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Edge Chromium Browser
::-------------------------------------------------------------------------------------------
:IntEdgeChromium

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Microsoft Edge Chromium Browser
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Edge Chromium Browser Pack file exist
if not exist "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%.tpk" (
	echo.Microsoft Edge Chromium Browser Pack folder is missing the below file...
	echo.
	echo.EdgeChromium_%SelectedSourceOS%.tpk
	echo.
	echo.Please copy the above file to ^<Packs\EdgeChromium^> folder...
	goto :Stop
)

if not exist "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft Edge Chromium Browser Pack folder is missing the below file...
	echo.
	echo.EdgeChromium_%SelectedSourceOS%_%ImageArchitecture%.reg
	echo.
	echo.Please copy the above file to ^<Packs\EdgeChromium^> folder...
	goto :Stop
)

if not exist "%EdgeChromium%\EdgeChromiumGP.tpk" (
	echo.Microsoft Edge Chromium Browser Pack folder is missing the below file...
	echo.
	echo.EdgeChromiumGP.tpk
	echo.
	echo.Please copy the above file to ^<Packs\EdgeChromium^> folder...
	goto :Stop
)

for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
	if "%ImageDefaultLanguage%" equ "%%k" (
		if not exist "%EdgeChromium%\EdgeChromiumGP_%%k.tpk" (
			echo.Microsoft Edge Chromium Browser Pack folder is missing the below file...
			echo.
			echo.EdgeChromiumGP_%%k.tpk
			echo.
			echo.Please copy the above file to ^<Packs\EdgeChromium^> folder...
			goto :Stop
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Edge Chromium Browser########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Edge Chromium Browser################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Chromium Browser Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Chromium Browser Group Policy Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChromium%\EdgeChromiumGP.tpk", 1, "%InstallMount%\%%i"

		for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
			if "%ImageDefaultLanguage%" equ "%%k" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Edge Chromium Browser Group Policy [%%k] Package...
				echo.-------------------------------------------------------------------------------
				call :ApplyImage "%EdgeChromium%\EdgeChromiumGP_%%k.tpk", 1, "%InstallMount%\%%i"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Edge Chromium Browser Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Edge Chromium Browser#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Edge WebView 2
::-------------------------------------------------------------------------------------------
:IntEdgeWebView2

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Microsoft Edge WebView 2
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Edge WebView 2 Pack file exist
if not exist "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%.tpk" (
	echo.Microsoft Edge WebView 2 Pack folder is missing the below file...
	echo.
	echo.EdgeWebView2_%SelectedSourceOS%.tpk
	echo.
	echo.Please copy the above file to^<Packs\EdgeWebView2^> folder...
	goto :Stop
)

:: Checking whether Microsoft Edge WebView 2 Pack file exist
if not exist "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft Edge WebView 2 Pack folder is missing the below file...
	echo.
	echo.EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg
	echo.
	echo.Please copy the above file to^<Packs\EdgeWebView2^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Edge WebView 2###############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Edge WebView 2#######################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge WebView 2 Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Edge WebView 2 Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Edge WebView 2##############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate 3rd Party Application Packs
::-------------------------------------------------------------------------------------------
:Int3rdPartyAppPacks

setlocal

set PackFile=
set PackName=

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate 3rd Party Application Packs
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether 3rd Party Application Packs Pack file exist
if not exist "%ThirdPartyAppPacks%\*_%SelectedSourceOS%.tpk" (
	echo.3rd Party Application Packs folder is missing the pack base files...
	echo.
	echo.Please copy the above file to ^<Packs\ThirdPartyAppPacks^> folder...
	goto :Stop
)

if not exist "%ThirdPartyAppPacks%\*_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.3rd Party Application Packs folder is missing the pack registry files...
	echo.
	echo.Please copy the above file to ^<Packs\ThirdPartyAppPacks^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating 3rd Party Application Packs############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating 3rd Party Application Packs####################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /f %%j in ('"dir /b %ThirdPartyAppPacks%\*.tpk" 2^>nul') do (
			for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-WimInfo /WimFile:"%ThirdPartyAppPacks%\%%j" /Index:%PackageIndex% ^| findstr /i Name') do (set PackName=%%a)
			set PackFile=%%j
			set PackFile=!PackFile:~0,-4!
			set PackName=!PackName:~1!"
			set PackName=!PackName:~0,-7!
			echo._______________________________________________________________________________
			echo.-------------------------------------------------------------------------------
			echo.Integrating !PackName! Application Pack Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%ThirdPartyAppPacks%\!PackFile!.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Importing !PackName! Application Pack Registry Settings...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.Mounting Image Registry...
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.Importing Registry Settings to Image Registry...
			call :ImportRegistry2Image "%ThirdPartyAppPacks%\!PackFile!_%ImageArchitecture%.reg"
			echo.Un-Mounting Image Registry...
			call :UnMountImageRegistry
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating 3rd Party Application Packs###########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set PackFile=
set PackName=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Accessibility Braille
::-------------------------------------------------------------------------------------------
:IntBraille

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - Integrate Windows Accessibility Braille
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Braille Pack Path
set "Braille=%Braille%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Accessibility Braille Pack file exist
if not exist "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Accessibility Braille Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\Braille\%PackageVersion%^> folder...
	goto :Stop
)

call :RemoveFile "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
if "%ImageBuild%" geq "17763" copy /y "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Accessibility Braille##########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Accessibility Braille##################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	)
)

call :RemoveFile "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Accessibility Braille#########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Braille=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Multimedia Restricted Codecs
::-------------------------------------------------------------------------------------------
:IntMMRC

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - Integrate Windows Multimedia Restricted Codecs
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Multimedia Restricted Codecs Pack path
set "MMRC=%MMRC%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if not exist "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
	echo.
	echo."Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
	goto :Stop
)

if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
	echo.
	echo."Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
	goto :Stop
)

if "%ImageInstallationType%" equ "Server" (
	if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
		echo.
		echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
		goto :Stop
	)

	if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
		echo.
		echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
		goto :Stop
	)

	if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
		echo.
		echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
		goto :Stop
	)

	if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs Pack folder is missing the below file...
		echo.
		echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Please copy the above file to ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Multimedia Restricted Codecs###################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Multimedia Restricted Codecs###########################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Multimedia Restricted Dolby Codec Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Multimedia Restricted Dolby Codec [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------

		if "%ImageArchitecture%" equ "x64" (
			echo.Integrating Windows Multimedia Restricted Dolby Codec WOW64 Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Multimedia Restricted Dolby Codec WOW64 [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		if "%ImageInstallationType%" equ "Server" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Multimedia Restricted Extended Codecs Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Multimedia Restricted Extended Codecs [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------

			if "%ImageArchitecture%" equ "x64" (
				echo.Integrating Windows Multimedia Restricted Extended Codecs WOW64 Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Multimedia Restricted Extended Codecs WOW64 [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Multimedia Restricted Codecs##################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set MMRC=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Subsystem for Linux ^(WSL^)
::-------------------------------------------------------------------------------------------
:IntWSL

setlocal

cls
echo.===============================================================================
echo.        MSMG ToolKit - Integrate Windows Subsystem for Linux ^(WSL^)
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows Subsystem for Linux (WSL) Pack Path
set "WSL=%WSL%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Subsystem for Linux (WSL) Pack file exist
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Subsystem for Linux ^(WSL^) Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WSL\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Subsystem for Linux (WSL) Pack file exist
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Subsystem for Linux ^(WSL^) Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WSL\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Subsystem for Linux ^(WSL^)######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Subsystem for Linux ^(WSL^)##############################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Subsystem for Linux ^(WSL^) Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Subsystem for Linux ^(WSL^) [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Enabling Windows Subsystem for Linux ^(WSL^) Feature...
		echo.-------------------------------------------------------------------------------
		call :EnableFeature "%InstallMount%\%%i", "Microsoft-Windows-Subsystem-Linux /All"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Subsystem for Linux ^(WSL^)#####################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WSL=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Open Secure Shell (SSH) Client & Server
::-------------------------------------------------------------------------------------------
:IntOpenSSH

setlocal

cls
echo.===============================================================================
echo.      MSMG ToolKit - Integrate Open Secure Shell ^(SSH^) Client ^& Server
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Open Secure Shell Pack Path
set "OpenSSH=%OpenSSH%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Open Secure Shell (SSH) Client Pack file exist
if not exist "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH Client ^& Server Pack folder is missing the below file...
	echo.
	echo."OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\OpenSSH\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Open Secure Shell (SSH) Server Pack file exist
if not exist "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH Client ^& Server Pack folder is missing the below file...
	echo.
	echo."OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\OpenSSH\%PackageVersion%^> folder...
	goto :Stop
)

call :RemoveFile "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

if "%ImageBuild%" geq "17763" (
	copy /y "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
	copy /y "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Open Secure Shell ^(SSH^) Client ^& Server###############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Open Secure Shell ^(SSH^) Client ^& Server#######################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating OpenSSH Client Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating OpenSSH Server Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	)
)

call :RemoveFile "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Open Secure Shell ^(SSH^) Client ^& Server##############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set OpenSSH=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Media Feature Pack
::-------------------------------------------------------------------------------------------
:IntMediaFeaturePack

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Windows Media Feature Pack
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether exists N Editions supported for Windows Media Feature Integration are selected as source.
set /A ImageEditionCount=0
for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProfessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
   if "%ImageEdition%" equ "%%j" set /A ImageEditionCount+=1
)

if %ImageEditionCount% equ 0 (
   echo.No N Edition was found. And, Non-N Editions are not supported.
   echo.
   goto :Stop
)

:: Setting Windows Media Feature Pack folder path according to selected Source OS
if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Media Feature Pack#############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Media Feature Pack#####################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProfessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
			if "%ImageEdition%" equ "%%j" (
				if "%SelectedSourceOS%" equ "w7" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Feature Pack OOB Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Format OOB Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
				)

				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"

				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Feature Pack OOB Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Feature Pack OOB [%ImageDefaultLanguage%] Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" (
					call :RemoveFolder "%Temp%\Updates\MediaFeaturePack"
					call :CreateFolder "%Temp%\Updates\MediaFeaturePack"
					expand -R "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" -F:* "%Temp%\Updates\MediaFeaturePack" >nul

					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Features Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\MediaFeaturePack"
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Windows Media Features [%ImageDefaultLanguage%] Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageArchitecture%" equ "x64" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Microsoft Windows Media Features WOW64 Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
						echo.-------------------------------------------------------------------------------
						echo.Integrating Microsoft Windows Media Features [%ImageDefaultLanguage%] WOW64 Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)

					call :RemoveFolder "%Temp%\Updates"
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Media Feature Pack############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set MediaFeaturePack=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Mixed Reality
::-------------------------------------------------------------------------------------------
:IntWMR

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - Integrate Windows Mixed Reality
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows Mixed Reality folder path according to selected Source OS
set "WMR=%WMR%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Mixed Reality file exist
if not exist "%WMR%\Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab" (
	echo.Windows Mixed Reality folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab"
	echo.
	echo.Please copy the above file to ^<Packs\WMR\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Mixed Reality##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Mixed Reality##########################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		call :AddPackage "%InstallMount%\%%i", "%WMR%\Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Mixed Reality#################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WMR=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Portable Devices
::-------------------------------------------------------------------------------------------
:IntPortableDevices

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - Integrate Windows Portable Devices
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether exists N Editions supported for Portable Devices Integration are selected as source.
set /A ImageEditionCount=0
for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProfessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
   if "%ImageEdition%" equ "%%j" set /A ImageEditionCount+=1
)

if %ImageEditionCount% equ 0 (
   echo.No N Edition was found. And, Non-N Editions are not supported.
   echo.
   goto :Stop
)

:: Setting Windows Portable Devices Pack Path
set "PortableDevices=%PortableDevices%\%SelectedSourceOS%\%PackageVersion%"

:: Checking whether Windows Portable Devices Pack file exist
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PortableDevices\%PackageVersion%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Portable Devices###############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Portable Devices#######################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /d %%j in (StarterN,StarterKN,HomeBasicN,HomeBasicKN,CoreN,CloudN,ProfessionalN,ProfessionalKN,ProfessionalEducationN,ProfessionalEducationKN,EnterpriseN,EnterpriseKN,EnterpriseSN,EnterpriseGN,UltimateN,UltimateKN,EducationN,EducationKN) do (
			if "%ImageEdition%" equ "%%j" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Portable Devices Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Portable Devices [%ImageDefaultLanguage%] Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if "%ImageArchitecture%" equ "x64" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Portable Devices WOW64 Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Portable Devices [%ImageDefaultLanguage%] Language WOW64 Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Portable Devices##############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set PortableDevices=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows PowerShell 7
::-------------------------------------------------------------------------------------------
:IntPowerShell7

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - Integrate Windows PowerShell 7
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Windows PowerShell 7 Pack file exist
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk" (
	echo.Windows PowerShell 7 Pack folder is missing the below file...
	echo.
	echo."PowerShell7_%SelectedSourceOS%.tpk"
	echo.
	echo.Please copy the above file to ^<Packs\PowerShell7^> folder...
	goto :Stop
)

:: Checking whether Windows PowerShell 7 Pack file exist
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Windows PowerShell 7 Pack folder is missing the below file...
	echo.
	echo."PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Please copy the above file to ^<Packs\PowerShell7^> folder...
	goto :Stop
)

:: Checking whether Windows PowerShell 7 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%PowerShell7%\Windows6.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7 Pack folder is missing the below file...
	echo.
	echo."Windows6.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PowerShell7^> folder...
	goto :Stop
)

:: Checking whether Windows PowerShell 7 Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%PowerShell7%\Windows8.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7 Pack folder is missing the below file...
	echo.
	echo."Windows8.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\PowerShell7^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows PowerShell 7###################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows PowerShell 7###########################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Universal C Runtime ^(CRT^) Package...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%InstallMount%\%%i", "%PowerShell7%\Windows6.1-KB3118401-%ImageArchitecture%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%PowerShell7%\Windows8.1-KB3118401-%ImageArchitecture%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows PowerShell 7 Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Windows PowerShell 7 Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows PowerShell 7##################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set PowerShell7=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Remote Server Administration Tool (RSAT)
::-------------------------------------------------------------------------------------------
:IntRSAT

setlocal

set RSATType=

if "%SelectedSourceOS%" equ "w10" (
	cls
	echo.===============================================================================
	echo.   MSMG ToolKit - Integrate Windows Remote Server Administration Tool ^(RSAT^)
	echo.===============================================================================
	echo.
	echo.  [1]  RSAT for Managing targets older than Windows Server, version 1709
	echo.
	echo.  [2]  RSAT for Managing Windows Server, version 1709
	echo.
	echo.  [3]  RSAT for Managing Windows Server, version 1803
	echo.
	echo.  [X]  Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:123X /N /M "Enter Your Choice : "
	if errorlevel 4 goto :IntegrateMenu
	if errorlevel 3 set RSATType=v1803
	if errorlevel 2 set RSATType=v1709
	if errorlevel 1 set RSATType=v1609
)

cls
echo.===============================================================================
echo.   MSMG ToolKit - Integrate Windows Remote Server Administration Tool ^(RSAT^)
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Windows Remote Server Administration Tool (RSAT) Pack folder path according to selected Source OS
set "RSAT=%RSAT%\%SelectedSourceOS%"

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) for Streaming Media Services Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1609" if not exist "%RSAT%\10.0.14393\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%\10.0.14393^> folder...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1709" if not exist "%RSAT%\10.0.16299\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%\10.0.16299^> folder...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1803" if not exist "%RSAT%\10.0.17134\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab" (
	echo.Remote Server Administration Tool Pack folder is missing the below file...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab"
	echo.
	echo.Please copy the above file to ^<Packs\RSAT\%SelectedSourceOS%\10.0.17134^> folder...
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Remote Server Administration Tool ^(RSAT^)#######
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Remote Server Administration Tool ^(RSAT^)###############
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul
		
		:: Checking whether the selected Source OS is a valid editions
		if "%SelectedSourceOS%" equ "w7" (
			for /d %%j in (Professional,Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Remote Server Administration Tool ^(RSAT^) Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows RSAT for Streaming Media Services Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
				)
			)
		)

		if "%SelectedSourceOS%" neq "w7" (
			for /d %%j in (Professional,Enterprise) do (
				if "%ImageEdition%" equ "%%j" (
					if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"

					if "%SelectedSourceOS%" equ "w10" (
						if "%RSATType%" equ "v1609" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.14393\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
						if "%RSATType%" equ "v1709" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.16299\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
						if "%RSATType%" equ "v1803" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.17134\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab"
					)
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Remote Server Administration Tool ^(RSAT^)######
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set RSAT=
set RSATType=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Microsoft Office Desktop Universal Windows Platform (UWP) Apps
::-------------------------------------------------------------------------------------------
:IntOfficeUWPApps

setlocal

set OfficeUWPApp=
set OfficeDesktop_Appx=
set OfficeAccess_Appx=
set OfficeExcel_Appx=
set OfficeOutlook_Appx=
set OfficePowerPoint_Appx=
set OfficePublisher_Appx=
set OfficeWord_Appx=

set OfficeDesktop_License=
set OfficeAccess_License=
set OfficeExcel_License=
set OfficeOutlook_License=
set OfficePowerPoint_License=
set OfficePublisher_License=
set OfficeWord_License=

cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft Office Desktop ^(UWP^) Apps
echo.===============================================================================
echo.

:: Checking whether Microsoft Office Desktop (UWP) Apps folder is empty
if not exist "%OfficeUWP%\*.appxbundle" (
	echo.Microsoft Office Desktop ^(UWP^) Apps Pack folder ^<Packs\%OfficeUWP%^> is empty...
	echo.
	echo.Please copy Microsoft Office Desktop ^(UWP^) Apps Pack files to respective folder...
	echo.
	goto :Stop
)

if not exist "%OfficeUWP%\*.xml" (
	echo.Microsoft Office Desktop ^(UWP^) Apps Pack folder ^<Packs\%OfficeUWP%^> is empty...
	echo.
	echo.Please copy Microsoft Office Desktop ^(UWP^) Apps Pack files to respective folder...
	echo.
	goto :Stop
)

cls
echo.===============================================================================
echo.      MSMG ToolKit - Integrate Microsoft Office Desktop ^(UWP^) Apps Menu
echo.===============================================================================
echo.
echo.  [1]  Microsoft Office Access 2016
echo.
echo.  [2]  Microsoft Office Excel 2016
echo.
echo.  [3]  Microsoft Office Outlook 2016
echo.
echo.  [4]  Microsoft Office PowerPoint 2016
echo.
echo.  [5]  Microsoft Office Publisher 2016
echo.
echo.  [6]  Microsoft Office Word 2016
echo.
echo.
echo.  [A]  All Apps
echo.
echo.  [X]  Go Back
echo.
echo.===============================================================================
echo.
choice /C:123456AX /N /M "Enter Your Choice : "

if errorlevel 8 goto :IntFeaturesMenu
if errorlevel 7 set "OfficeUWPApp=AllOfficeApps"
if errorlevel 6 set "OfficeUWPApp=OfficeWord"
if errorlevel 5 set "OfficeUWPApp=OfficePublisher"
if errorlevel 4 set "OfficeUWPApp=OfficePowerPoint"
if errorlevel 3 set "OfficeUWPApp=OfficeOutlook"
if errorlevel 2 set "OfficeUWPApp=OfficeExcel"
if errorlevel 1 set "OfficeUWPApp=OfficeAccess"

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Getting Microsoft Office Desktop (UWP) Apps files full pathnames
cd /d "%OfficeUWP%\"

for /f %%i IN ('"dir /b *Microsoft.Office.Desktop_*.appxbundle" 2^>nul') do if exist %%i set "OfficeDesktop_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Access_*.appxbundle" 2^>nul') do if exist %%i set "OfficeAccess_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Excel_*.appxbundle" 2^>nul') do if exist %%i set "OfficeExcel_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Outlook_*.appxbundle" 2^>nul') do if exist %%i set "OfficeOutlook_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.PowerPoint*.appxbundle" 2^>nul') do if exist %%i set "OfficePowerPoint_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Publisher_*.appxbundle" 2^>nul') do if exist %%i set "OfficePublisher_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Word_*.appxbundle" 2^>nul') do if exist %%i set "OfficeWord_Appx=%OfficeUWP%\%%i"

for /f %%i IN ('"dir /b *Microsoft.Office.Desktop_*.xml" 2^>nul') do if exist %%i set "OfficeDesktop_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Access_*.xml" 2^>nul') do if exist %%i set "OfficeAccess_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Excel_*.xml" 2^>nul') do if exist %%i set "OfficeExcel_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Outlook_*.xml" 2^>nul') do if exist %%i set "OfficeOutlook_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.PowerPoint_*.xml" 2^>nul') do if exist %%i set "OfficePowerPoint_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Publisher_*.xml" 2^>nul') do if exist %%i set "OfficePublisher_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Word_*.xml" 2^>nul') do if exist %%i set "OfficeWord_License=%OfficeUWP%\%%i"

cd /d "%ROOT%\"

cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft Office Desktop ^(UWP^) Apps
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Office Desktop ^(UWP^) Apps####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%OfficeUWPApp%" equ "AllOfficeApps" echo.####Integrating Microsoft Office Desktop ^(UWP^) Apps############################
if "%OfficeUWPApp%" equ "OfficeAccess" echo.####Integrating Microsoft Office Desktop - Access ^(UWP^) Apps###################
if "%OfficeUWPApp%" equ "OfficeExcel" echo.####Integrating Microsoft Office Desktop - Excel ^(UWP^) Apps####################
if "%OfficeUWPApp%" equ "OfficeOutlook" echo.####Integrating Microsoft Office Desktop - Outlook ^(UWP^) Apps##################
if "%OfficeUWPApp%" equ "OfficePowerPoint" echo.####Integrating Microsoft Office Desktop - PowerPoint ^(UWP^) Apps###############
if "%OfficeUWPApp%" equ "OfficePublisher" echo.####Integrating Microsoft Office Desktop - Publisher ^(UWP^) Apps################
if "%OfficeUWPApp%" equ "OfficeWord" echo.####Integrating Microsoft Office Desktop - Word ^(UWP^) Apps#####################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%OfficeUWPApp%" equ "OfficeAccess" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeAccess_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeAccess_License%
		if "%OfficeUWPApp%" equ "OfficeExcel" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeExcel_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeExcel_License%
		if "%OfficeUWPApp%" equ "OfficeOutlook" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeOutlook_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeOutlook_License%
		if "%OfficeUWPApp%" equ "OfficePowerPoint" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficePowerPoint_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficePowerPoint_License%
		if "%OfficeUWPApp%" equ "OfficePublisher" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficePublisher_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficePublisher_License%
		if "%OfficeUWPApp%" equ "OfficeWord" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeWord_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeWord_License%
		if "%OfficeUWPApp%" equ "AllOfficeApps" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeAccess_Appx% /OptionalPackagePath=%OfficeExcel_Appx% /OptionalPackagePath=%OfficeOutlook_Appx% /OptionalPackagePath=%OfficePowerPoint_Appx% /OptionalPackagePath=%OfficePublisher_Appx% /OptionalPackagePath=%OfficeWord_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeAccess_License% /LicensePath:%OfficeExcel_License% /LicensePath:%OfficeOutlook_License% /LicensePath:%OfficePowerPoint_License% /LicensePath:%OfficePublisher_License% /LicensePath:%OfficeWord_License%
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Office Desktop ^(UWP^) Apps###################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set OfficeUWPApp=
set OfficeDesktop_Appx=
set OfficeAccess_Appx=
set OfficeExcel_Appx=
set OfficeOutlook_Appx=
set OfficePowerPoint_Appx=
set OfficePublisher_Appx=
set OfficeWord_Appx=

set OfficeDesktop_License=
set OfficeAccess_License=
set OfficeExcel_License=
set OfficeOutlook_License=
set OfficePowerPoint_License=
set OfficePublisher_License=
set OfficeWord_License=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Thin PC Add-on Features
::-------------------------------------------------------------------------------------------
:IntThinPcPkgs

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.            MSMG ToolKit - Integrate Windows Thin PC Add-on Features
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo.  Do not integrate any updates before integrating a language pack or
	echo.  any windows features. If you integrate any updates ^(Hotfix, General
	echo.  Distribution Release [GDR], Zero-Day Patch [ZDP] or Service Pack [SP]^)
	echo.  that contains language/feature-dependent resources before you integrate
	echo.  any updates, The language/feature-specific changes that are contained
	echo.  in the updates are not applied and you will have to re-integrate the
	echo.  updates. Always integrate language packs/Windows features before you
	echo.  install updates.
	echo.
	echo.
	echo.  To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set Feature=

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Windows Thin PC Add-on Features
echo.===============================================================================

:: Checking whether Multi-Index servicing mode is selected
if "%ImageIndexNo:~0,2%" equ "," (
	echo.This feature is not available when Multi-Index servicing mode is enabled...
	echo.
	echo.Please Re-Choose source with a Single Index...
	goto :Stop
)

:: Checking whether the selected Source OS is a Windows Thin PC OS
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" (
	echo.Selected Source OS is not a Windows Thin PC OS..
	echo.
	echo.Please use Windows Thin PC Source OS..
	goto :Stop
)

echo.  [A]  Microsoft .NET Framework 3.5 with Client Profile
echo.  [B]  Windows Backup ^& Restore
echo.  [C]  Windows Basic Help
echo.  [D]  Windows Defender
echo.  [E]  Windows DVD Maker
echo.  [F]  Windows Fax ^& Scan
echo.  [G]  Windows ISO Burner
echo.  [H]  Windows Media Center
echo.  [I]  Windows Media Player Premium Codecs
echo.  [J]  Windows Mobility Center
echo.  [K]  Windows Parental Control
echo.  [L]  Windows Photo Viewer
echo.  [M]  Windows Search
echo.  [N]  Windows Speech ^& Text with Speech US English Pack
echo.  [O]  Windows Tablet PC Support
echo.
echo.  [1]  All Features
echo.
echo.  [X]  Go Back
echo.===============================================================================
choice /C:ABCDEFGHIJKLMNO1X /N /M "Enter your choice : "
if errorlevel 17 goto :IntegrateMenu
if errorlevel 16 set "Feature=All"
if errorlevel 15 set "Feature=TabletPC"
if errorlevel 14 set "Feature=SpeechText"
if errorlevel 13 set "Feature=Search"
if errorlevel 12 set "Feature=PhotoViewer"
if errorlevel 11 set "Feature=ParentalControl"
if errorlevel 10 set "Feature=MobilityCenter"
if errorlevel 9  set "Feature=PremiumCodecs"
if errorlevel 8  set "Feature=MediaCenter"
if errorlevel 7  set "Feature=ISOBurner"
if errorlevel 6  set "Feature=FaxScan"
if errorlevel 5  set "Feature=DVDMaker"
if errorlevel 4  set "Feature=Defender"
if errorlevel 3  set "Feature=BasicHelp"
if errorlevel 2  set "Feature=BackupRestore"
if errorlevel 1  set "Feature=NetFx35"

cls
echo.===============================================================================
if "%Feature%" equ "NetFx35" echo.     MSMG ToolKit - Integrate Microsoft .NET Framework 3.5 Add-on Feature
if "%Feature%" equ "BackupRestore" echo.       MSMG ToolKit - Integrate Windows Backup ^& Restore Add-on Feature
if "%Feature%" equ "BasicHelp" echo.         MSMG ToolKit - Integrate Windows Basic Help Add-on Feature
if "%Feature%" equ "Defender" echo.          MSMG ToolKit - Integrate Windows Defender Add-on Feature
if "%Feature%" equ "DVDMaker" echo.          MSMG ToolKit - Integrate Windows DVD Maker Add-on Feature
if "%Feature%" equ "FaxScan" echo.           MSMG ToolKit - Integrate Windows Fax ^& Scan Add-on Feature
if "%Feature%" equ "ISOBurner" echo.          MSMG ToolKit - Integrate Windows ISO Burner Add-on Feature
if "%Feature%" equ "MediaCenter" echo.        MSMG ToolKit - Integrate Windows Media Center Add-on Feature
if "%Feature%" equ "PremiumCodecs" echo.     MSMG ToolKit - Integrate Windows Media Player Premium Codecs Features
if "%Feature%" equ "MobilityCenter" echo.        MSMG ToolKit - Integrate Windows Mobility Center Add-on Feature
if "%Feature%" equ "ParentalControl" echo.       MSMG ToolKit - Integrate Windows Parental Control Add-on Feature
if "%Feature%" equ "PhotoViewer" echo.          MSMG ToolKit - Integrate Windows Photo Viewer Add-on Feature
if "%Feature%" equ "Search" echo.             MSMG ToolKit - Integrate Windows Search Add-on Feature
if "%Feature%" equ "SpeechText" echo.        MSMG ToolKit - Integrate Windows Speech ^& Text Add-on Feature
if "%Feature%" equ "TabletPC" echo.          MSMG ToolKit - Integrate Windows Tablet PC Add-on Feature
if "%Feature%" equ "All" echo.            MSMG ToolKit - Integrate Windows Thin PC Add-on Features
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Windows Thin PC Add-on Features folder is empty
if not exist "%ThinPC%\*.*" (
	echo.Windows Thin PC Add-on Features folder ^<Packs\ThinPC^> is empty...
	echo.
	echo.Please copy Windows Thin PC Add-on Features files to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####Started Integrating Microsoft .NET Framework 3.5 Add-on Feature############
if "%Feature%" equ "BackupRestore" echo.####Started Integrating Windows Backup ^& Restore Add-on Feature#################
if "%Feature%" equ "BasicHelp" echo.####Started Integrating Windows Basic Help Add-on Feature######################
if "%Feature%" equ "Defender" echo.####Started Integrating Windows Defender Add-on Feature########################
if "%Feature%" equ "DVDMaker" echo.####Started Integrating Windows DVD Maker Add-on Feature#######################
if "%Feature%" equ "FaxScan" echo.####Started Integrating Windows Fax ^& Scan Add-on Feature######################
if "%Feature%" equ "ISOBurner" echo.####Started Integrating Windows ISO Burner Add-on Feature######################
if "%Feature%" equ "MediaCenter" echo.####Started Integrating Windows Media Center Add-on Feature####################
if "%Feature%" equ "PremiumCodecs" echo.####Started Integrating Windows Media Player Premium Codecs Features###########
if "%Feature%" equ "MobilityCenter" echo.####Started Integrating Windows Mobility Center Add-on Feature#################
if "%Feature%" equ "ParentalControl" echo.####Started Integrating Windows Parental Control Add-on Feature################
if "%Feature%" equ "PhotoViewer" echo.####Started Integrating Windows Photo Viewer Add-on Feature####################
if "%Feature%" equ "Search" echo.####Started Integrating Windows Search Add-on Feature##########################
if "%Feature%" equ "SpeechText" echo.####Started Integrating Windows Speech ^& Text Add-on Feature###################
if "%Feature%" equ "TabletPC" echo.####Started Integrating Windows Tablet PC Add-on Feature#######################
if "%Feature%" equ "All" echo.####Started Integrating Windows Thin PC Add-on Features########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####Integrating Microsoft .NET Framework 3.5 Add-on Feature####################
if "%Feature%" equ "BackupRestore" echo.####Integrating Windows Backup ^& Restore Add-on Feature#######################
if "%Feature%" equ "BasicHelp" echo.####Integrating Windows Basic Help Add-on Feature##############################
if "%Feature%" equ "Defender" echo.####Integrating Windows Defender Add-on Feature################################
if "%Feature%" equ "DVDMaker" echo.####Integrating Windows DVD Maker Add-on Feature###############################
if "%Feature%" equ "FaxScan" echo.####Integrating Windows Fax ^& Scan Add-on Feature##############################
if "%Feature%" equ "ISOBurner" echo.####Integrating Windows ISO Burner Add-on Feature##############################
if "%Feature%" equ "MediaCenter" echo.####Integrating Windows Media Center Add-on Feature############################
if "%Feature%" equ "PremiumCodecs" echo.####Integrating Windows Media Player Premium Codecs Features###################
if "%Feature%" equ "MobilityCenter" echo.####Integrating Windows Mobility Center Add-on Feature#########################
if "%Feature%" equ "ParentalControl" echo.####Integrating Windows Parental Control Add-on Feature########################
if "%Feature%" equ "PhotoViewer" echo.####Integrating Windows Photo Viewer Add-on Feature############################
if "%Feature%" equ "Search" echo.####Integrating Windows Search Add-on Feature##################################
if "%Feature%" equ "SpeechText" echo.####Integrating Windows Speech ^& Text Add-on Feature###########################
if "%Feature%" equ "TabletPC" echo.####Integrating Windows Tablet PC Add-on Feature###############################
if "%Feature%" equ "All" echo.####Integrating Windows Thin PC Add-on Features################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageEdition%" equ "Embedded" (
			if "%Feature%" equ "NetFx35" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft IIS Windows Process Activation Service Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.0 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.0 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "BackupRestore" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-BackupRestore~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "BasicHelp" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-HelpEngine~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "Defender" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-AntiMalware~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "DVDMaker" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows DVD Maker Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows ISO Burner Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "FaxScan" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Fax-Scan~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "ISOBurner" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "MediaCenter" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MediaCenter~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "PremiumCodecs" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player DOLBY AC3 Audio Encoder Premium Codec Package
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-DOLBY-AC3-AudioEncoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 Decoder Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Decoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 Encoder Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Encoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 ^& Dolby Decoder Premium Codec Package..
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG3 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG4 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player WMV Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-WMV~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "MobilityCenter" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MobilePC~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "ParentalControl" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-ParentalControl~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "PhotoViewer" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Photos-Viewer~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "Search" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Natural Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Search Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)
			
			if "%Feature%" equ "SpeechText" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Speech ^& Text US English Language Pack Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Speech ^& Text Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "TabletPC" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Tablet~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "All" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft IIS Windows Process Activation Service Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.0 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.0 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Backup ^& Restore Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-BackupRestore~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Basic Help Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-HelpEngine~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Defender Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-AntiMalware~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows DVD Maker Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Fax ^& Scan Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Fax-Scan~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows ISO Burner Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Center Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MediaCenter~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player DOLBY AC3 Audio Encoder Premium Codec Package
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-DOLBY-AC3-AudioEncoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 Decoder Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Decoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 Encoder Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Encoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG2 ^& Dolby Decoder Premium Codec Package..
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG3 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player MPEG4 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Media Player WMV Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-WMV~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Mobility Center Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MobilePC~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Parental Control Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-ParentalControl~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Photo Viewer Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Photos-Viewer~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Natural Language Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Search Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Speech ^& Text US English Language Pack Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Speech ^& Text Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Tablet PC Support Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Tablet~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)
		)

		if "%IsLogsEnabled%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			if "%Feature%" equ "NetFx35" echo.Generating Microsoft .NET Framework 3.5 Add-on Feature Integration Log...
			if "%Feature%" equ "BackupRestore" echo.Generating Windows Backup ^& Restore Add-on Feature Integration Log...
			if "%Feature%" equ "BasicHelp" echo.Generating Windows Basic Help Add-on Feature Integration Log...
			if "%Feature%" equ "Defender" echo.Generating Windows Defender Add-on Feature Integration Log...
			if "%Feature%" equ "DVDMaker" echo.Generating Windows DVD Maker Add-on Feature Integration Log...
			if "%Feature%" equ "FaxScan" echo.Generating Windows Fax ^& Scan Add-on Feature Integration Log...
			if "%Feature%" equ "ISOBurner" echo.Generating Windows ISO Burner Add-on Feature Integration Log...
			if "%Feature%" equ "MediaCenter" echo.Generating Windows Media Center Add-on Feature Integration Log...
			if "%Feature%" equ "PremiumCodecs" echo.Generating Windows Media Player Premium Codecs Features Integration Log...
			if "%Feature%" equ "MobilityCenter" echo.Generating Windows Mobility Center Add-on Feature Integration Log...
			if "%Feature%" equ "ParentalControl" echo.Generating Windows Parental Control Add-on Feature Integration Log...
			if "%Feature%" equ "PhotoViewer" echo.Generating Windows Photo Viewer Add-on Feature Integration Log...
			if "%Feature%" equ "Search" echo.Generating Windows Search Add-on Feature Integration Log...
			if "%Feature%" equ "SpeechText" echo.Generating Windows Speech ^& Text Add-on Feature Integration Log...
			if "%Feature%" equ "TabletPC" echo.Generating Windows Tablet PC Add-on Feature Integration Log...
			if "%Feature%" equ "All" echo.Generating Thin PC Add-on Features Integration Log...
			echo.-------------------------------------------------------------------------------
			echo.Writing Thin PC Add-on Features ^<Logs\ThinPC.txt^> Log file.
			call :GetPackages "%InstallMount%\%%i", "ThinPC.txt"
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####Finished Integrating Microsoft .NET Framework 3.5 Add-on Feature###########
if "%Feature%" equ "BackupRestore" echo.####Finished Integrating Windows Backup ^& Restore Add-on Feature###############
if "%Feature%" equ "BasicHelp" echo.####Finished Integrating Windows Basic Help Add-on Feature#####################
if "%Feature%" equ "Defender" echo.####Finished Integrating Windows Defender Add-on Feature#######################
if "%Feature%" equ "DVDMaker" echo.####Finished Integrating Windows DVD Maker Add-on Feature######################
if "%Feature%" equ "FaxScan" echo.####Finished Integrating Windows Fax ^& Scan Add-on Feature#####################
if "%Feature%" equ "ISOBurner" echo.####Finished Integrating Windows ISO Burner Add-on Feature#####################
if "%Feature%" equ "MediaCenter" echo.####Finished Integrating Windows Media Center Add-on Feature###################
if "%Feature%" equ "PremiumCodecs" echo.####Finished Integrating Windows Media Player Premium Codecs Features##########
if "%Feature%" equ "MobilityCenter" echo.####Finished Integrating Windows Mobility Center Add-on Feature################
if "%Feature%" equ "ParentalControl" echo.####Finished Integrating Windows Parental Control Add-on Feature###############
if "%Feature%" equ "PhotoViewer" echo.####Finished Integrating Windows Photo Viewer Add-on Feature###################
if "%Feature%" equ "Search" echo.####Finished Integrating Windows Search Add-on Feature#########################
if "%Feature%" equ "SpeechText" echo.####Finished Integrating Windows Speech ^& Text Add-on Feature##################
if "%Feature%" equ "TabletPC" echo.####Finished Integrating Windows Tablet PC Add-on Feature######################
if "%Feature%" equ "All" echo.####Finished Integrating Windows Thin PC Add-on Features#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Feature=

endlocal

:: Returning to Integrate Windows Thin PC Add-on Features Menu
goto :IntThinPcPkgs
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Diagnostics and Recovery Toolset ^(DaRT^) 7.0/8.1/10/11
::-------------------------------------------------------------------------------------------
:IntDaRT

setlocal

set DartType=
set DebugTools=
set PackageLanguage=

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.              MSMG ToolKit - Integrate Microsoft DaRT 7.0 Tools
if "%SelectedSourceOS%" equ "w81" echo.              MSMG ToolKit - Integrate Microsoft DaRT 8.1 Tools
if "%SelectedSourceOS%" equ "w10" echo.               MSMG ToolKit - Integrate Microsoft DaRT 10 Tools
if "%SelectedSourceOS%" equ "w11" echo.               MSMG ToolKit - Integrate Microsoft DaRT 11 Tools
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo. Microsoft DaRT 8.1/10/11 Tools includes functionality that lets an
	echo. administrator or a help desk worker run the DaRT tools remotely to resolve
	echo. problems on an end-user computer. In addition, you can save the International
	echo. Organization for Standardization ^(ISO^) image to a USB flash drive or put the
	echo. ISO image on a network to include its contents as a recovery partition on a
	echo. computer's hard disk. These capabilities provide flexibility, but also create
	echo. potential security risks that you should consider when configuring DaRT.
	echo.
	echo.
	echo.
	echo.
	echo. To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.              MSMG ToolKit - Integrate Microsoft DaRT 7.0 Tools
if "%SelectedSourceOS%" equ "w81" echo.              MSMG ToolKit - Integrate Microsoft DaRT 8.1 Tools
if "%SelectedSourceOS%" equ "w10" echo.               MSMG ToolKit - Integrate Microsoft DaRT 10 Tools
if "%SelectedSourceOS%" equ "w11" echo.               MSMG ToolKit - Integrate Microsoft DaRT 11 Tools
echo.===============================================================================
echo.
echo.  [1]  Integrate to Windows Setup Boot Image
echo.
if "%SelectedSourceOS%" neq "w7" (
	echo.  [2]  Integrate to Windows Recovery Image
	echo.
)
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" (
	echo.  [2]  Integrate to Windows Recovery Image
	echo.
)
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]  Go Back
echo.
echo.===============================================================================
echo.
choice /C:12X /N /M "Enter Your Choice : "
if errorlevel 3 goto :IntegrateMenu
if errorlevel 2 set "DartType=Recovery"
if errorlevel 1 set "DartType=Boot"

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.              MSMG ToolKit - Integrate Microsoft DaRT 7.0 Tools
if "%SelectedSourceOS%" equ "w81" echo.              MSMG ToolKit - Integrate Microsoft DaRT 8.1 Tools
if "%SelectedSourceOS%" equ "w10" echo.               MSMG ToolKit - Integrate Microsoft DaRT 10 Tools
if "%SelectedSourceOS%" equ "w11" echo.               MSMG ToolKit - Integrate Microsoft DaRT 11 Tools
echo.===============================================================================
echo.

:: Checking whether the Source Boot Image is selected
if "%DartType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows Setup Boot Image is not selected...
	echo.
	echo.Please choose Windows Setup Boot Image while selecting Source...
	goto :Stop
)

:: Checking whether the Source Recovery Image is selected
if "%DartType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows Recovery Image Is not selected...
	echo.
	echo.Please choose Windows Recovery Image while selecting Source...
	goto :Stop
)

:: Setting Microsoft DaRT Tools Pack folder path
set "DaRT=%DaRT%\%SelectedSourceOS%"
set "DebugTools=DebugTools_%PackageVersion%.tpk"

:: Setting Package Language
for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,el-GR,en-GB,en-US,et-EE,fi-FI,he-IL,hr-HR,hu-HU,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,ro-RO,sk-SK,sl-SI,sr-Latn-CS,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA) do (
	if "%ImageDefaultLanguage%" equ "%%i" set "PackageLanguage=en-US"
)

for /d %%l in (de-DE,es-ES,fr-FR,it-IT,ja-JP,ko-KR,pt-BR,ru-RU,zh-CN,zh-TW) do (
   if "%ImageDefaultLanguage%" equ "%%l" set "PackageLanguage=%%l"
)

if "%ImageDefaultLanguage%" equ "es-MX" set "PackageLanguage=es-ES"
if "%ImageDefaultLanguage%" equ "fr-CA" set "PackageLanguage=fr-FR"
if "%ImageDefaultLanguage%" equ "pt-PT" set "PackageLanguage=pt-BR"
if "%ImageDefaultLanguage%" equ "zh-HK" set "PackageLanguage=zh-TW"

:: Checking whether Microsoft DaRT 7/8.1/10/11 Tools Base Package file exist
if not exist "%DaRT%\DaRT.tpk" (
	if "%SelectedSourceOS%" equ "w7" echo.Microsoft DaRT 7 Tools Pack file "DaRT.tpk" not found...
	if "%SelectedSourceOS%" equ "w81" echo.Microsoft DaRT 8.1 Tools Pack file "DaRT.tpk" not found...
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 Tools Pack file "DaRT.tpk" not found...
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 Tools Pack file "DaRT.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\DaRT\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft DaRT 7/8.1/10/11 Tools Language Package file exist
if not exist "%DaRT%\DaRT_%PackageLanguage%.tpk" (
	if "%SelectedSourceOS%" equ "w7" echo.Microsoft DaRT 7 Tools Pack file "DaRT_%PackageLanguage%.tpk" not found...
	if "%SelectedSourceOS%" equ "w81" echo.Microsoft DaRT 8.1 Tools Pack file "DaRT_%PackageLanguage%.tpk" not found...
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 Tools Pack file "DaRT_%PackageLanguage%.tpk" not found...
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 Tools Pack file "DaRT_%PackageLanguage%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\DaRT\%SelectedSourceOS%^> folder...
	goto :Stop
)

:: Checking whether Microsoft DaRT 10/11 Debug Tools Package file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%DaRT%\%DebugTools%" (
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 Tools Pack folder is missing the below file...
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 Tools Pack folder is missing the below file...
	echo.
	echo."%DebugTools%"
	echo.
	echo.Please copy the above file to ^<Packs\DaRT\%SelectedSourceOS%^> folder...
	goto :Stop
)

if "%DartType%" equ "Boot" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.  MSMG ToolKit - Integrate Microsoft DaRT 7 Tools to Windows Setup Boot Image
	if "%SelectedSourceOS%" equ "w81" echo. MSMG ToolKit - Integrate Microsoft DaRT 8.1 Tools to Windows Setup Boot Image
	if "%SelectedSourceOS%" equ "w10" echo. MSMG ToolKit - Integrate Microsoft DaRT 10 Tools to Windows Setup Boot Image
	if "%SelectedSourceOS%" equ "w11" echo. MSMG ToolKit - Integrate Microsoft DaRT 11 Tools to Windows Setup Boot Image
	echo.===============================================================================
	echo.

	:: Getting Boot Image Index Architecture
	call :GetImageArchitecture "%BootWim%", 2 >nul

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Started Integrating Microsoft DaRT 7 Tools to Windows Boot Image###########
	if "%SelectedSourceOS%" equ "w81" echo.####Started Integrating Microsoft DaRT 8.1 Tools to Windows Boot Image#########
	if "%SelectedSourceOS%" equ "w10" echo.####Started Integrating Microsoft DaRT 10 Tools to Windows Boot Image##########
	if "%SelectedSourceOS%" equ "w11" echo.####Started Integrating Microsoft DaRT 11 Tools to Windows Boot Image##########
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 2
	echo.    Image Architecture       : %ImageArchitecture%
	echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Integrating Microsoft DaRT 7 Tools to Windows Boot Image###################
	if "%SelectedSourceOS%" equ "w81" echo.####Integrating Microsoft DaRT 8.1 Tools to Windows Boot Image#################
	if "%SelectedSourceOS%" equ "w10" echo.####Integrating Microsoft DaRT 10 Tools to Windows Boot Image##################
	if "%SelectedSourceOS%" equ "w11" echo.####Integrating Microsoft DaRT 11 Tools to Windows Boot Image##################
	echo.-------------------------------------------------------------------------------
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.Integrating Microsoft DaRT 7 Tools Base Package...
	if "%SelectedSourceOS%" equ "w81" echo.Integrating Microsoft DaRT 8.1 Tools Base Package...
	if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Tools Base Package...
	if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Tools Base Package...
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT.tpk", %PackageIndex%, "%BootMount%\2"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\System32\fmapi.dll" (
		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" copy /y "%InstallMount%\%%i\Windows\System32\fmapi.dll" "%BootMount%\2\Windows\System32" >nul
		)
	)

	call :RemoveFile "%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.[LaunchApps]>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\wpeinit.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\netstart.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%systemdrive%%\setup.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.Integrating Microsoft DaRT 7 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w81" echo.Integrating Microsoft DaRT 8.1 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Tools [%PackageLanguage%] Language Package...
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", %PackageIndex%, "%BootMount%\2"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Debug Tools Package...
		if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Debug Tools Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DaRT%\%DebugTools%", %PackageIndex%, "%BootMount%\2"
	)

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Finished Integrating Microsoft DaRT 7 Tools to Windows Boot Image##########
	if "%SelectedSourceOS%" equ "w81" echo.####Finished Integrating Microsoft DaRT 8.1 Tools to Windows Boot Image########
	if "%SelectedSourceOS%" equ "w10" echo.####Finished Integrating Microsoft DaRT 10 Tools to Windows Boot Image#########
	if "%SelectedSourceOS%" equ "w11" echo.####Finished Integrating Microsoft DaRT 11 Tools to Windows Boot Image#########
	echo.-------------------------------------------------------------------------------
)

if "%DartType%" equ "Recovery" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.   MSMG ToolKit - Integrate Microsoft DaRT 7 Tools to Windows Recovery Image
	if "%SelectedSourceOS%" equ "w81" echo.  MSMG ToolKit - Integrate Microsoft DaRT 8.1 Tools to Windows Recovery Image
	if "%SelectedSourceOS%" equ "w10" echo.  MSMG ToolKit - Integrate Microsoft DaRT 10 Tools to Windows Recovery Image
	if "%SelectedSourceOS%" equ "w11" echo.  MSMG ToolKit - Integrate Microsoft DaRT 11 Tools to Windows Recovery Image
	echo.===============================================================================
	echo.
	:: Getting Recovery Image Index Architecture
	call :GetImageArchitecture "%InstallMount%\%DefaultIndexNo%\%WinReWim%", 1 >nul
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Started Integrating Microsoft DaRT 7 Tools to Windows Recovery Image#######
	if "%SelectedSourceOS%" equ "w81" echo.####Started Integrating Microsoft DaRT 8.1 Tools to Windows Recovery Image#####
	if "%SelectedSourceOS%" equ "w10" echo.####Started Integrating Microsoft DaRT 10 Tools to Windows Recovery Image######
	if "%SelectedSourceOS%" equ "w11" echo.####Started Integrating Microsoft DaRT 11 Tools to Windows Recovery Image######
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
	echo.    Image Architecture       : %ImageArchitecture%
	echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Integrating Microsoft DaRT 7 Tools to Windows Recovery Image###############
	if "%SelectedSourceOS%" equ "w81" echo.####Integrating Microsoft DaRT 8.1 Tools to Windows Recovery Image#############
	if "%SelectedSourceOS%" equ "w10" echo.####Integrating Microsoft DaRT 10 Tools to Windows Recovery Image##############
	if "%SelectedSourceOS%" equ "w11" echo.####Integrating Microsoft DaRT 11 Tools to Windows Recovery Image##############
	echo.-------------------------------------------------------------------------------
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.Integrating Microsoft DaRT 7 Tools Base Package...
	if "%SelectedSourceOS%" equ "w81" echo.Integrating Microsoft DaRT 8.1 Tools Base Package...
	if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Tools Base Package...
	if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Tools Base Package...
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT.tpk", %PackageIndex%, "%WinReMount%"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\fmapi.dll" "%WinReMount%\Windows\System32" >nul

	call :RemoveFile "%WinReMount%\Windows\System32\winpeshl.ini"
	echo.[LaunchApps]>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\wpeinit.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\netstart.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%systemdrive%%\sources\recovery\recenv.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.Integrating Microsoft DaRT 7 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w81" echo.Integrating Microsoft DaRT 8.1 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Tools [%PackageLanguage%] Language Package...
	if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Tools [%PackageLanguage%] Language Package...
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", %PackageIndex%, "%WinReMount%"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w10" echo.Integrating Microsoft DaRT 10 Debug Tools Package...
		if "%SelectedSourceOS%" equ "w11" echo.Integrating Microsoft DaRT 11 Debug Tools Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DaRT%\%DebugTools%", %PackageIndex%, "%WinReMount%"
	)

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####Finished Integrating Microsoft DaRT 7 Tools to Windows Recovery Image######
	if "%SelectedSourceOS%" equ "w81" echo.####Finished Integrating Microsoft DaRT 8.1 Tools to Windows Recovery Image####
	if "%SelectedSourceOS%" equ "w10" echo.####Finished Integrating Microsoft DaRT 10 Tools to Windows Recovery Image#####
	if "%SelectedSourceOS%" equ "w11" echo.####Finished Integrating Microsoft DaRT 11 Tools to Windows Recovery Image#####
	echo.-------------------------------------------------------------------------------
)

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set DaRT=
set DartType=
set DebugTools=
set PackageLanguage=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft DirectX 9.0c
::-------------------------------------------------------------------------------------------
:IntDirectX9c

setlocal

cls
echo.===============================================================================
echo.               MSMG ToolKit - Integrate Microsoft DirectX 9.0c
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft DirectX 9.0c Pack file exist
if not exist "%DirectX9c%\DirectX9c_%SelectedSourceOS%.tpk" (
	echo.Microsoft DirectX 9.0c Pack file "DirectX9c_%SelectedSourceOS%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\DirectX9c^> folder...
	goto :Stop
)

:: Checking whether Microsoft DirectX 9.0c Pack file exist
if not exist "%DirectX9c%\DirectX9c_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft DirectX 9.0c Pack file "DirectX9c_%SelectedSourceOS%_%ImageArchitecture%.reg" not found...
	echo.
	echo.Please copy the above file to ^<Packs\DirectX9c^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft DirectX 9.0c#################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft DirectX 9.0c#########################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft DirectX 9.0c Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DirectX9c%\DirectX9c_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft DirectX 9.0c Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%DirectX9c%\DirectX9c_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft DirectX 9.0c################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Games
::-------------------------------------------------------------------------------------------
:IntGames

setlocal

set Game=
set PackageLanguage=

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate Microsoft Games
echo.===============================================================================

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether the selected Source OS is a Windows 7 Client Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - Integrate Microsoft Games Menu
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  FreeCell
	echo.  [D]  Hearts
	echo.  [E]  Hold 'Em
	echo.  [F]  Inkball
	echo.  [G]  Mahjong Titans
	echo.  [H]  Minesweeper
	echo.  [I]  Pinball
	echo.  [J]  Purble Place
	echo.  [K]  Solitaire
	echo.  [L]  Spider Solitaire
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  All Games
	echo.
	echo.  [X]  Go Back
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "Enter your choice : "
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: Checking whether the selected Source OS is a Windows 7 Client Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "HomeBasic" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - Integrate Microsoft Games Menu
	echo.===============================================================================
	echo.
	echo.  [1]  Carioca Rummy
	echo.  [2]  Chess Titans
	echo.  [3]  Hold 'Em
	echo.  [4]  Inkball
	echo.  [5]  Mahjong Titans
	echo.  [6]  Pinball
	echo.  [7]  Sudoku
	echo.  [8]  Tinker
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]  All Games
	echo.  [X]  Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345678AX /N /M "Enter your choice : "
	if errorlevel 10 goto :IntFeaturesMenu
	if errorlevel 9  set "Game=AllGames"
	if errorlevel 8  set "Game=Tinker"
	if errorlevel 7  set "Game=Sudoku"
	if errorlevel 6  set "Game=Pinball"
	if errorlevel 5  set "Game=MahjongTitans"
	if errorlevel 4  set "Game=Inkball"
	if errorlevel 3  set "Game=HoldEm"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: Checking whether the selected Source OS is not a Windows 7 Client Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - Integrate Microsoft Games Menu
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  FreeCell
	echo.  [D]  Hearts
	echo.  [E]  Hold 'Em
	echo.  [F]  Inkball
	echo.  [G]  Mahjong Titans
	echo.  [H]  Minesweeper
	echo.  [I]  Pinball
	echo.  [J]  Purble Place
	echo.  [K]  Solitaire
	echo.  [L]  Spider Solitaire
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  All Games
	echo.
	echo.  [X]  Go Back
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "Enter your choice : "
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: Checking whether the selected Source OS is not Windows 7
if "%SelectedSourceOS%" neq "w7" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - Integrate Microsoft Games Menu
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  FreeCell
	echo.  [D]  Hearts
	echo.  [E]  Hold 'Em
	echo.  [F]  Inkball
	echo.  [G]  Mahjong Titans
	echo.  [H]  Minesweeper
	echo.  [I]  Pinball
	echo.  [J]  Purble Place
	echo.  [K]  Solitaire
	echo.  [L]  Spider Solitaire
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  All Games
	echo.
	echo.  [X]  Go Back
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "Enter your choice : "
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)
cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate Microsoft Games
echo.===============================================================================
echo.

:: Checking whether Microsoft Games Pack file exist
if not exist "%Games%\Games_%ImageArchitecture%.tpk" (
	echo.Microsoft Games Pack file "Games_%ImageArchitecture%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Games^> folder...
	goto :Stop
)

:: Checking whether Microsoft Games Pack file exist
if not exist "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft Games Pack file "Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Games^> folder...
	goto :Stop
)

:: Checking whether Microsoft Games Pack file exist
for %%j in (ChessTitans,FreeCell,Hearts,Inkball,MahjongTitans,Minesweeper,Pinball,PurblePlace,Solitaire,SpiderSolitaire) do (
	if "%Game%" equ "%%j" if not exist "%Games%\%Game%.reg" (
		echo.Microsoft Games Pack file "%Game%.reg" not found...
		echo.
		echo.Please copy the above file to ^<Packs\Games^> folder...
		goto :Stop
	)
)

:: Checking whether Microsoft Games Pack file exist
for %%j in (AllGames,CariocaRummy,HoldEm,Sudoku,Tinker) do (
	if "%Game%" equ "%%j" if not exist "%Games%\%Game%_%ImageArchitecture%.reg" (
		echo.Microsoft Games Pack file "%Game%_%ImageArchitecture%.reg" not found...
		echo.
		echo.Please copy the above file to ^<Packs\Games^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Games########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Games################################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Games Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 1, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Games Base [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 1, "%InstallMount%\%%i"

		if "%Game%" equ "CariocaRummy" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Carioca Rummy Game Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
		)

		if "%Game%" equ "ChessTitans" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
		)

		if "%Game%" equ "FreeCell" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Hearts" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
		)

		if "%Game%" equ "HoldEm" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Inkball" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
		)

		if "%Game%" equ "MahjongTitans" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Minesweeper" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Pinball" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
		)

		if "%Game%" equ "PurblePlace" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Solitaire" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
		)

		if "%Game%" equ "SpiderSolitaire" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Sudoku" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Tinker" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Carioca Rummy Game Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "StarterN" if "%ImageEdition%" neq "HomeBasic" if "%ImageEdition%" neq "HomeBasicN" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Carioca Rummy Game Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Carioca Rummy Game Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Carioca Rummy Game Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Chess Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft FreeCell Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hearts Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Hold 'Em Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Inkball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Mahjong Titans Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Minesweeper Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Pinball Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Purble Place Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Spider Solitaire Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Sudoku Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Tinker Game [%ImageDefaultLanguage%] Language Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Games Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"

		echo.Importing Registry Settings to Image Registry...
		if "%Game%" equ "CariocaRummy" call :ImportRegistry2Image "%Games%\CariocaRummy_%ImageArchitecture%.reg"
		if "%Game%" equ "ChessTitans" call :ImportRegistry2Image "%Games%\ChessTitans.reg"
		if "%Game%" equ "FreeCell" call :ImportRegistry2Image "%Games%\FreeCell.reg"
		if "%Game%" equ "Hearts" call :ImportRegistry2Image "%Games%\Hearts.reg"
		if "%Game%" equ "HoldEm" call :ImportRegistry2Image "%Games%\HoldEm_%ImageArchitecture%.reg"
		if "%Game%" equ "Inkball" call :ImportRegistry2Image "%Games%\Inkball.reg"
		if "%Game%" equ "MahjongTitans" call :ImportRegistry2Image "%Games%\MahjongTitans.reg"
		if "%Game%" equ "Minesweeper" call :ImportRegistry2Image "%Games%\Minesweeper.reg"
		if "%Game%" equ "Pinball" call :ImportRegistry2Image "%Games%\Pinball.reg"
		if "%Game%" equ "PurblePlace" call :ImportRegistry2Image "%Games%\PurblePlace.reg"
		if "%Game%" equ "Solitaire" call :ImportRegistry2Image "%Games%\Solitaire.reg"
		if "%Game%" equ "SpiderSolitaire" call :ImportRegistry2Image "%Games%\SpiderSolitaire.reg"
		if "%Game%" equ "Sudoku" call :ImportRegistry2Image "%Games%\Sudoku_%ImageArchitecture%.reg"
		if "%Game%" equ "Tinker" call :ImportRegistry2Image "%Games%\Tinker_%ImageArchitecture%.reg"
		if "%Game%" equ "AllGames" (

			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" (
				if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
					call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
				)
				if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "StarterN" if "%ImageEdition%" neq "HomeBasic" if "%ImageEdition%" neq "HomeBasicN" (
					call :ImportRegistry2Image "%Games%\CariocaRummy_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\HoldEm_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\Inkball.reg"
					call :ImportRegistry2Image "%Games%\Sudoku_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\Tinker_%ImageArchitecture%.reg"
				)
				if "%ImageInstallationType%" neq "Client" call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
			)

			if "%SelectedSourceOS%" neq "w7" call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
		)

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Games#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Game=

endlocal

:: Returning to Integrate Microsoft Games Menu
goto :IntGames
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Sidebar
::-------------------------------------------------------------------------------------------
:IntSidebar

setlocal

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate Windows Sidebar
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar.tpk" (
	echo.Windows Sidebar Pack file "Sidebar.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Sidebar^> folder...
	goto :Stop
)

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar_%ImageDefaultLanguage%.tpk" (
	echo.Windows Sidebar Pack file "Sidebar_%ImageDefaultLanguage%.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Sidebar^> folder...
	goto :Stop
)

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar_%ImageArchitecture%.reg" (
	echo.Windows Sidebar Pack file "Sidebar_%ImageArchitecture%.reg" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Sidebar^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Sidebar########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Sidebar################################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Sidebar Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Sidebar%\Sidebar.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows Sidebar [%ImageDefaultLanguage%] Language Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Sidebar%\Sidebar_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Windows Sidebar Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Taking Image Registry Ownership...
		echo.Importing Registry Settings to Image Registry...
		call :ImportRegistry2Image "%Sidebar%\Sidebar_%ImageArchitecture%.reg"
		call :ImportRegistry2Image "%Sidebar%\3rdPartyGadgets_%ImageArchitecture%.reg"
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.

		:: Deleting Microsoft Sidebar Media Center files if the Source Edition is not MediaCenter
		if /i not exist "%InstallMount%\%%i\Windows\ehome" call :RemoveFolder "%InstallMount%\%%i\Program Files\Windows Sidebar\Gadgets\MediaCenter.Gadget"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Sidebar#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Visual C++ Runtime
::-------------------------------------------------------------------------------------------
:IntVCRuntime

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - Integrate Microsoft Visual C++ Runtime
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Microsoft Visual C++ Runtime Pack folder path
set "VCRuntime=%VCRuntime%\%SelectedSourceOS%"

:: Checking whether Microsoft Visual C++ Runtime Pack file exist
if not exist "%VCRuntime%\VC.tpk" (
	echo.Microsoft Visual C++ Runtime Pack file "VC.tpk" not found...
	echo.
	echo.Please copy the above file to ^<Packs\VCRuntime\%SelectedSourceOS%^> folder...
	goto :Stop
)

if "%SelectedSourceOS%" equ "w7" if not exist "%VCRuntime%\Windows6.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Microsoft Visual C++ Runtime Pack file "Windows6.1-KB3118401-%ImageArchitecture%.cab" not found...
	echo.
	echo.Please copy the above file to ^<Packs\VCRuntime\%SelectedSourceOS%^> folder...
	goto :Stop
)

if "%SelectedSourceOS%" equ "w81" if not exist "%VCRuntime%\Windows8.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Microsoft Visual C++ Runtime Pack file "Windows8.1-KB3118401-%ImageArchitecture%.cab" not found...
	echo.
	echo.Please copy the above file to ^<Packs\VCRuntime\%SelectedSourceOS%^> folder...
	goto :Stop
)

for %%i in (Certificates, VC_2005, VC_2008, VC_2010, VC_2012, VC_2013, VC_2022, VC_Legacy) do (
	if not exist "%VCRuntime%\%%i_%ImageArchitecture%.reg" (
		echo.Microsoft Visual C++ Runtime Pack file "%%i_%ImageArchitecture%.reg" not found...
		echo.
		echo.Please copy the above file to ^<Packs\VCRuntime\%SelectedSourceOS%^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Visual C++ Runtime###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Visual C++ Runtime###################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Microsoft Visual C++ Prerequiste Update Package...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%InstallMount%\%%i", "%VCRuntime%\Windows6.1-KB3118401-%ImageArchitecture%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%VCRuntime%\Windows8.1-KB3118401-%ImageArchitecture%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Visual C++ Runtime Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%VCRuntime%\VC.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Visual C++ Runtime Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...

		for %%i in (Certificates, VC_2005, VC_2008, VC_2010, VC_2012, VC_2013, VC_2022, VC_Legacy) do (
			call :ImportRegistry2Image "%VCRuntime%\%%i_%ImageArchitecture%.reg"
		)

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Visual C++ Runtime##########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set VCRuntime=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Updates Menu
::-------------------------------------------------------------------------------------------
:IntUpdatesMenu

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                    MSMG ToolKit - Integrate Windows Updates
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo.  Do not integrate any updates before integrating a language pack or
	echo.  any windows features. If you integrate any updates ^(Hotfix, General
	echo.  Distribution Release [GDR], Zero-Day Patch [ZDP] or Service Pack [SP]^)
	echo.  that contains language/feature-dependent resources before you integrate
	echo.  any updates, The language/feature-specific changes that are contained
	echo.  in the updates are not applied and you will have to re-integrate the
	echo.  updates. Always integrate language packs/Windows features before you
	echo.  install updates.
	echo.
	echo.
	echo.  To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.                MSMG ToolKit - Integrate Windows Updates Menu
echo.===============================================================================
echo.
echo.  [1]   Integrate Windows Updates
echo.
echo.  [2]   Integrate WHD Update Pack
echo.
echo.  [3]   Integrate Windows Setup Media Updates
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.

choice /C:123X /N /M "Enter Your Choice : "
if errorlevel 4 goto :IntegrateMenu
if errorlevel 3 goto :IntWindowsSetupMediaUpdates
if errorlevel 2 goto :IntWHDUpdatesMenu
if errorlevel 1 call :IntUpdates

:IntWHDUpdatesMenu
cls
echo.===============================================================================
echo.               MSMG ToolKit - Integrate WHD Update Pack Menu
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Integrate WHD Update Pack with Service Pack 2
	echo.
	echo.  [2]   Integrate WHD Update Pack without Service Pack 2
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w81" (
	echo.  [1]   Integrate WHD Baseline Updates
	echo.
	echo.  [2]   Integrate WHD General Updates
	echo.
	echo.  [3]   Integrate WHD Hotfix Updates
	echo.
	echo.  [4]   Integrate WHD Security Updates
	echo.
	echo.  [5]   Integrate WHD Additional Updates
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	echo.  [1]   Integrate WHD General Updates
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :IntegrateMenu
	if errorlevel 2 (
		set "IsW7SP1CRUSelected=No"
		goto :IntW7WHDUpdatesMenu
	)
	if errorlevel 1 (
		set "IsW7SP1CRUSelected=Yes"
		goto :IntW7WHDUpdatesMenu
	)
)

if "%SelectedSourceOS%" equ "w81" (
	choice /C:12345X /N /M "Enter Your Choice : "
	if errorlevel 6 goto :IntegrateMenu
	if errorlevel 5 goto :IntWHDAdditionalMenu
	if errorlevel 4 call :IntWHDUpdates Security
	if errorlevel 3 call :IntWHDUpdates Hotfix
	if errorlevel 2 call :IntWHDUpdates General
	if errorlevel 1 goto :IntWHDBaselineMenu
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	choice /C:1X /N /M "Enter Your Choice : "
	if errorlevel 2 goto :IntegrateMenu
	if errorlevel 1 goto :IntWHDBaselineMenu
)

:IntW7WHDUpdatesMenu
if "%IsDialogsEnabled%" equ "Yes" if "%IsW7SP1CRUSelected%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - Integrate WHD Updates with Service Pack 2
	echo.===============================================================================
	echo.## Convenience Rollup Update for Windows 7 SP1 aka Service Pack 2 ##
	echo.
	echo.KB3125574 is a comprehensive rollup update that contains almost all fixes
	echo.released after Windows 7 SP1's release, up through April 2016.
	echo.
	echo.If you intend to integrate any of the following feature packages, integrate
	echo.them *first* ^(before KB3125574^) so the rollup can integrate their updated
	echo.components afterwards:
	echo.
	echo.DCA2.0, AD LDS, VirtualPC, WorkFolders, Server Essentials Connector found
	echo.in WHD Additional and Extra Updates section.
	echo.
	echo.This update aims to simplify the updating process for Windows 7, but it's
	echo.completely optional, and for due diligence purposes, be aware that it does
	echo.contain some telemetry updates components ^(3068708, 3075249^).
	echo.So if you do not want this, you should choose Integrate WHD Updates without
	echo.Service Pack 2 option from Integrate WHD Updates Menu.
	echo.
	echo.You could also block these telemetry effects while having the rollup integrated
	echo.refer to this topic for details: http://forums.mydigitallife.info/threads/68131
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
)
cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate WHD Updates Menu
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Integrate WHD Additional Updates
	echo.
	echo.  [2]   Integrate WHD Extra Updates
	echo.
	echo.  [3]   Integrate WHD General Updates
	echo.
	echo.  [4]   Integrate WHD Hotfix Updates
	echo.
	echo.  [5]   Integrate WHD Security Updates
	echo.
	echo.  [6]   Integrate WHD Extended Security Updates
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" (
	choice /C:123456X /N /M "Enter Your Choice : "
	if errorlevel 7 goto :IntegrateMenu
	if errorlevel 6 call :IntWHDUpdates "ESU"
	if errorlevel 5 call :IntWHDUpdates "Security"
	if errorlevel 4 call :IntWHDUpdates "Hotfix"
	if errorlevel 3 call :IntWHDUpdates "General"
	if errorlevel 2 goto :IntWHDExtraMenu
	if errorlevel 1 goto :IntWHDAdditionalMenu
)

:IntWHDBaselineMenu
cls

echo.===============================================================================
if "%SelectedSourceOS%" equ "w81" echo.               MSMG ToolKit - Integrate WHD Baseline Updates Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.              MSMG ToolKit - Integrate WHD General Updates Menu
echo.===============================================================================
echo.
echo.  [1]   Integrate to Windows Setup Boot Image
echo.
echo.  [2]   Integrate to Windows Setup Install Image
echo.
echo.  [3]   Integrate to Windows Setup Install ^& Recovery Image
echo.
echo.  [4]   Integrate to Windows Setup Boot, Install ^& Recovery Image
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:1234X /N /M "Enter Your Choice : "
if errorlevel 5 goto :IntUpdatesMenu
if errorlevel 4 call :IntWHDBaseLine BootInstallRecovery
if errorlevel 3 call :IntWHDBaseLine InstallRecovery
if errorlevel 2 call :IntWHDBaseLine Install
if errorlevel 1 call :IntWHDBaseLine Boot

:IntWHDAdditionalMenu
cls

echo.===============================================================================
echo.             MSMG ToolKit - Integrate WHD Additional Updates Menu
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Integrate Windows Activation Technologies ^(WAT^)
	echo.
	echo.  [2]   Integrate Windows 10 Upgrade Prerequisites
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

if "%SelectedSourceOS%" equ "w81" (
	echo.  [1]   Integrate Microsoft .NET Framework 3.5 Updates
	echo.
	echo.  [2]   Integrate Windows 10 Upgrade Prerequisites
	echo.
	echo.  [3]   Integrate Windows PE Updates
	echo.
	echo.  [4]   Integrate Windows Update Satisfy Updates
	echo.
	echo.
	echo.
	echo.
)

echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :IntW7WHDUpdatesMenu
	if errorlevel 2 call :IntWHDUpdates "Windows10"
	if errorlevel 1 call :IntWHDUpdates "WAT"
)

if "%SelectedSourceOS%" equ "w81" (
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :IntWHDUpdatesMenu
	if errorlevel 4 call :IntWHDUpdates "WUSatisfy"
	if errorlevel 3 call :IntWHDUpdates "WinPE"
	if errorlevel 2 call :IntWHDUpdates "Windows10"
	if errorlevel 1 call :IntWHDUpdates "NET35"
)

:IntWHDExtraMenu
cls

echo.===============================================================================
echo.                MSMG ToolKit - Integrate WHD Extra Updates Menu
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
	echo.  [1]   Active Directory Lightweight Directory Services ^(ADLDS^)
	echo.
	echo.  [2]   File Management API
	echo.
	echo.  [3]   Microsoft Virtual PC
	echo.
	echo.  [4]   Windows Features Updates
	echo.
	echo.  [5]   Sync Agent for Domain Environmernts ^(Work Folders^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
	echo.
	echo.  [1]   Active Directory Lightweight Directory Services ^(ADLDS^)
	echo.
	echo.  [2]   File Management API
	echo.
	echo.  [3]   Microsoft Virtual PC
	echo.
	echo.  [4]   Sync Agent for Domain Environmernts ^(Work Folders^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
	choice /C:12345X /N /M "Enter Your Choice : "
	if errorlevel 6 goto :IntW7WHDUpdatesMenu
	if errorlevel 5 call :IntWHDUpdates "WorkFolders"
	if errorlevel 4 call :IntWHDUpdates "Features"
	if errorlevel 3 call :IntWHDUpdates "VirtualPC"
	if errorlevel 2 call :IntWHDUpdates "FMApi"
	if errorlevel 1 call :IntWHDUpdates "ADLDS"
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
	choice /C:1234X /N /M "Enter Your Choice : "
	if errorlevel 5 goto :IntW7WHDUpdatesMenu
	if errorlevel 4 call :IntWHDUpdates "WorkFolders"
	if errorlevel 3 call :IntWHDUpdates "VirtualPC"
	if errorlevel 2 call :IntWHDUpdates "FMApi"
	if errorlevel 1 call :IntWHDUpdates "ADLDS"
)

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Updates
:: Input Parameters [%~1 : UpdateType ]
::-------------------------------------------------------------------------------------------
:IntUpdates

setlocal

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate Windows Updates
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Updates=%Updates%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking Windows Updates folder is empty
if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
	echo.Windows Updates folder ^<Updates\%SelectedSourceOS%\%ImageArchitecture%^> is empty...
	echo.
	echo.Please copy Windows Updates files to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Updates########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim	
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Processing Windows Updates Packages########################################
echo.-------------------------------------------------------------------------------
echo.
:: Creating Windows Updates Temporary Folder
echo.Creating Windows Updates Packages Temporary folder...
echo.

call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"

:: Extracting .CAB files From .MSU Package files to CAB Temporary folder
echo.Extracting Update Package files to Temporary folder...
echo.

:: Extracting/Copying Windows Updates .CAB files to Temporary Folder
if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
    if exist "%Updates%\*%ImageArchitecture%*.msu" expand "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
    if exist "%Updates%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\*.cab" "%Temp%\Updates" >nul
)

if "%SelectedSourceOS%" equ "w10" (
	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul

		if "%ImageBuild%" geq "17763" if exist "%Temp%\Updates\*.cab" (
			call :RemoveFolder "%Temp%\Updates\Temp"
			call :CreateFolder "%Temp%\Updates\Temp"

			for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
				expand -R "%Temp%\Updates\%%i" -F:Win*.cab "%Temp%\Updates\Temp" >nul
				expand -R "%Temp%\Updates\%%i" -F:SSU*.cab "%Temp%\Updates\Temp" >nul
				if exist "%Temp%\Updates\Temp\*.cab" move /y "%Temp%\Updates\Temp\*.cab" "%Temp%\Updates" >nul
			)

			call :RemoveFolder "%Temp%\Updates\Temp"
		)

		for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Temp%\Updates\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)

		call :RemoveFile "%Temp%\Updates\*.cab" >nul
	)

	if exist "%Updates%\*.cab" (
		for /f %%i in ('"dir /b %Updates%\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Updates%\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		"%Zip%" x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: Renaming Windows Updates folder names matching to their respective update type
	cd /d "%Temp%\Updates\"

	for /f %%i in ('"dir /b *.*" 2^>nul') do (
		if exist "%%i\update.mum" (
			findstr /c:"Package_for_RollupFix" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "Cumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Update for Removal of Adobe Flash Player" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "RemoveFlashPlayer" >nul
		)

		if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
		if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
		if exist "%%i\setup*.exe" if exist "%%i\setup*.dll" ren "%%i" "DVDMedia" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if not exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" ren "%%i" "EdgeChromium" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_adobe-flash-for-*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" ren "%%i" "FlashPlayer" >nul
		if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.*.mum" ren "%%i" "NET35" >nul
		if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.*.mum" ren "%%i" "NET35LP" >nul
		if exist "%%i\%PackageArchitecture%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >nul
		if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp_31bf3856ad364e35_*.manifest" ren "%%i" "NET48" >nul
		if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp.resources_*%ImageDefaultLanguage%*.manifest" ren "%%i" "NET48LP" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-updatetargeting-windowsoobe_31bf3856ad364e35_*.manifest" ren "%%i" "OOBE" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-s..boot-firmwareupdate_*.manifest" ren "%%i" "SecureBoot" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-servicingstack_*.manifest" ren "%%i" "ServicingStack" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsFeatureExperience" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sysreset_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

if "%SelectedSourceOS%" equ "w11" (
	cd /d "%Temp%\Updates\"
	copy "%PSFExtractor%" "%Temp%\Updates" >nul
	copy "%PSFExtractor%.config" "%Temp%\Updates" >nul

	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:SSU*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.psf "%Temp%\Updates" >nul
	)

	if exist "%Updates%\*.cab" %XCopy% "%Updates%\*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\*.psf" %XCopy% "%Updates%\*.psf" "%Temp%\Updates" >nul

	if exist "%Temp%\Updates\*.psf" (
		for /f %%i in ('"dir /b %Temp%\Updates\SSU*.psf" 2^>nul') do (
			ren "%%i" "ServicingStack.psf"
			for /f %%j in ('"dir /b %Temp%\Updates\SSU*.cab" 2^>nul') do (ren "%%j" "ServicingStack.cab")
		)

		for /f "tokens=2 delims=-" %%i in ('"dir /b %Temp%\Updates\Windows*.psf" 2^>nul') do (
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.cab" 2^>nul') do (ren "%%j" "Cumulative.cab")
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.psf" 2^>nul') do (ren "%%j" "Cumulative.psf")
		)

		if exist "%Temp%\Updates\ServicingStack.psf" (
			md "%Temp%\Updates\ServicingStack"
			expand -f:* ServicingStack.cab "%Temp%\Updates\ServicingStack" >nul

			if exist "%Temp%\Updates\ServicingStack\*cablist.ini" (
				expand -f:* "%Temp%\Updates\ServicingStack\*.cab" "%Temp%\Updates\ServicingStack" >nul
				call :RemoveFile "%Temp%\Updates\ServicingStack\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\ServicingStack\*.cab"
			)

			if not exist "%Temp%\Updates\ServicingStack\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\ServicingStack\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\ServicingStack\%%#" "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
				)
			)

			PSFExtractor.exe ServicingStack.cab >nul
			call :RemoveFile "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\ServicingStack.*"
		)

		if exist "%Temp%\Updates\Cumulative.psf" (
			md "%Temp%\Updates\Cumulative"
			expand -f:* Cumulative.cab "%Temp%\Updates\Cumulative" >nul

			if exist "%Temp%\Updates\Cumulative\*cablist.ini" (
				expand -f:* "%Temp%\Updates\Cumulative\*.cab" "%Temp%\Updates\Cumulative" >nul
				call :RemoveFile "%Temp%\Updates\Cumulative\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\Cumulative\*.cab"
			)

			if not exist "%Temp%\Updates\Cumulative\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\Cumulative\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\Cumulative\%%#" "%Temp%\Updates\Cumulative\express.psf.cix.xml"
				)
			)
			
			PSFExtractor.exe Cumulative.cab >nul
			call :RemoveFile "%Temp%\Updates\Cumulative\*.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\Cumulative.*"
		)

		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe"
		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe.config"
	)

	if exist "%Temp%\Updates\*.cab" (
		for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Temp%\Updates\%%i" -F:* "%Temp%\Updates\!Update!" >nul
		)

		call :RemoveFile "%Temp%\Updates\*.cab"
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		"%Zip%" x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: Renaming Windows Updates folder names matching to their respective update type
	for /f %%i in ('"dir /b *.*" 2^>nul') do (
		if exist "%%i\update.mum" (
			findstr /c:"Package_for_ServicingStack" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "ServicingStack" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_RollupFix" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "Cumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Microsoft .NET Framework 3.0 OnDemand" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NET35" >nul
		)

		if exist "%%i\%PackageArchitecture%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
		if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
		if exist "%%i\setup*.exe" if exist "%%i\setup*.dll" ren "%%i" "DVDMedia" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-onecore-c..dexperiencehost-api_31bf3856ad364e35_*.manifest" ren "%%i" "OOBE" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsFeatureExperience" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-i..dsetup-rejuvenation_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

echo.Finished Extracting Update Package files to Temporary folder...
echo.
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" if exist "%Temp%\Updates\Enablement\Update.mum" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" (
	choice /C:YN /N /M "Do you want to skip integrating Microsoft Edge Chromium ? ['Y'es/'N'o] : "
	if !errorlevel! equ 1 (
		del /f /q "%Temp%\Updates\Enablement\Update.mum" >nul
		del /f /q "%Temp%\Updates\Enablement\Update.cat" >nul

		if "%ImageArchitecture%" equ "x86" (
			call :RemoveFolder "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_d4e678d60dbf374c"
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_88ed58c8b45ef5b335c7e00f1d272a1c_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.cat" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			call :RemoveFolder "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051459c61ca882"
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_84b67765c88012e177d65b696e48302e_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)

		if "%ImageArchitecture%" equ "arm64" (
			call :RemoveFolder "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051c93c61c9d1e"
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_d29030e5eb1fbfc0c65c0cd08e617938_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)
	)
	echo.
)

:: Integrating Windows Updates Packages to WIM Image
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Updates################################################
echo.-------------------------------------------------------------------------------

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.
		if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates"
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if exist "%Temp%\Updates\ServicingStack\Update.mum" (
				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
					echo.-------------------------------------------------------------------------------
					echo.Applying Windows 10 v1507 Cumulative Update Integration Fix...
					echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
					call :MountImageRegistry "%InstallMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\TH1CUFix_%ImageArchitecture%.reg" 2>nul
					call :UnMountImageRegistry
				)

				if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x86" if "%ImageBuild%" equ "14393" if "%ImageServicePackBuild%" equ "0" (
					echo.-------------------------------------------------------------------------------
					echo.Applying Windows 10 v1607 Cumulative Update Integration Fix...
					echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\RS1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
					call :MountImageRegistry "%InstallMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
					call :UnMountImageRegistry
				)

				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows %OSID% Servicing Stack Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\ServicingStack"
			)

			if exist "%Temp%\Updates\General\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 11 General Update...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\General"
			)

			if exist "%Temp%\Updates\WindowsFeatureExperience\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Feature Experience Pack Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\WindowsFeatureExperience"
			)

			if exist "%Temp%\Updates\CPUMicroCode\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Intel CPU Microcode Dynamic Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\CPUMicroCode"
			)

			if exist "%Temp%\Updates\SecureBoot\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Secure Boot DBX Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\SecureBoot"
			)

			if exist "%Temp%\Updates\FlashPlayer\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Adobe Flash Player Security Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\FlashPlayer"
			)

			if exist "%Temp%\Updates\RemoveFlashPlayer\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Remove Adobe Flash Player Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\RemoveFlashPlayer"
			)

			if exist "%Temp%\Updates\Cumulative\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows %OSID% Cumulative Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
			)

			if exist "%Temp%\Updates\NET35\Update.mum" (
				if "%ImageBuild%" lss "19041" if not exist "%InstallMount%\%%i\Windows\WinSxS\pending.xml" (
					echo.-------------------------------------------------------------------------------
					echo.Performing [Install.wim, Index : %%i] Image Cleanup...
					echo.-------------------------------------------------------------------------------
					call :CleanupImage "%InstallMount%\%%i", "ComponentCleanupResetBase"
				)
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35"
			)

			if exist "%Temp%\Updates\NET35LP\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 [%ImageDefaultLanguage%] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35LP"
			)

			if exist "%Temp%\Updates\NET35CDU\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 3.5 Critical Dynamic Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35CDU"
			)

			if exist "%Temp%\Updates\NET48\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48"
			)

			if exist "%Temp%\Updates\NET48LP\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48LP"
			)

			if exist "%Temp%\Updates\NetCumulative\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft .NET Cumulative Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NetCumulative"
			)

			if exist "%Temp%\Updates\EdgeChromium\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Edge Chromium Browser Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\EdgeChromium"
			)

			if exist "%Temp%\Updates\Enablement\Update.mum" (
				echo.-------------------------------------------------------------------------------
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
					echo.Integrating Windows 10 v1909 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.Integrating Windows 10 v20H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.Integrating Windows 10 v21H1 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.Integrating Windows 10 v21H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.Integrating Windows 10 v22H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
					echo.Integrating Windows Server 2022 v22H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 1 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 3 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 4 Feature Enablement Update Package...
				)
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i",  "%Temp%\Updates\Enablement"
			)

			if exist "%Temp%\Updates\OOBE\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows %OSID% OOBE Update...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\OOBE"
			)

			if exist "%Temp%\Updates\Cumulative\Update.mum" if exist "%Temp%\Updates\NET35\Update.mum" if exist "%Temp%\Updates\NetCumulative\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Re-Integrating Windows %OSID% Cumulative Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
			)

			if exist "%Temp%\Updates\Defender\package-defender.xml" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows Defender Definition Update Package...
				echo.-------------------------------------------------------------------------------
				echo.
				for /f %%x IN ('"dir /b %Temp%\Updates\Defender\Platform" 2^>nul') do (set "DefenderVersion=%%x")

				echo.Copying Windows Defender Definition Updates ^(v!DefenderVersion!^).
				%XCopy% "%Temp%\Updates\Defender\Definition Updates\Updates" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Definition Updates\Updates" >nul

				echo.Copying Windows Defender Platform Updates.
				%XCopy% /s "%Temp%\Updates\Defender\Platform" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform" >nul

				echo.Copying MpAsDesc.dll file.
				Copy /y "%InstallMount%\%%i\Program Files\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!" >nul
				if "%ImageArchitecture%" equ "x64" Copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86" >nul

				echo.Copying MpAsDesc.dll.mui file.
				for /d %%y in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
					if exist "%InstallMount%\%%i\Program Files\Windows Defender\%%y" (
						call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y"
						Copy /y "%InstallMount%\%%i\Program Files\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y\mpasdesc.dll.mui" >nul

						if "%ImageArchitecture%" equ "x64" (
							call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y"
							Copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y\mpasdesc.dll.mui" >nul
						)
					)
				)

				echo.Copying Package-defender.xml to Windows Temp folder.
				Copy /y "%Temp%\Updates\Defender\package-defender.xml" "%InstallMount%\%%i\Windows\Temp" >nul
				echo.
			)
		)
	)
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.Generating Windows Updates Integration LOG File...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.Writing Windows Updates Integration Log file.
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" call :GetPackages "%InstallMount%\%%i", "Updates-%%i.txt"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.Cleaning Up Temporary Files ^& Folders...
echo.-------------------------------------------------------------------------------
echo.
:: Cleaning Up Windows Updates Temporary folder...
echo.Cleaning Up Windows Updates Temporary folder.
call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Updates#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Updates=

endlocal

:: Reading Updated Image Information
call :GetUpdatedImageInformation >nul

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate WHD Baseline/General Updates to Windows Setup Boot, Install & Recovery Image
::-------------------------------------------------------------------------------------------
:IntWHDBaseline

setlocal

:: Setting WHD Updates Type
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "Boot" (
	if "%SelectedSourceOS%" equ "w81" echo.   MSMG ToolKit - Integrate WHD Baseline Updates to Windows Setup Boot Image
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.    MSMG ToolKit - Integrate WHD General Updates to Windows Setup Boot Image
)

if "%UpdateType%" equ "Install" (
	if "%SelectedSourceOS%" equ "w81" echo. MSMG ToolKit - Integrate WHD Baseline Updates to Windows Setup Install Image
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.  MSMG ToolKit - Integrate WHD General Updates to Windows Setup Install Image
)

if "%UpdateType%" equ "InstallRecovery" (
	if "%SelectedSourceOS%" equ "w81" echo.                  MSMG ToolKit - Integrate WHD Baseline Updates
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.                   MSMG ToolKit - Integrate WHD General Updates
	echo.                    to Windows Setup Install ^& Recovery Images
)

if "%UpdateType%" equ "BootInstallRecovery" (
	if "%SelectedSourceOS%" equ "w81" echo.                  MSMG ToolKit - Integrate WHD Baseline Updates
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.                   MSMG ToolKit - Integrate WHD General Updates
	echo.                to Windows Setup Boot, Install ^& Recovery Images
)
echo.===============================================================================
echo.

if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" if "%IsBootImageSelected%" equ "No" (
	echo.Windows Setup Boot Image is not selected...
	echo.
	echo.Please choose Windows Setup Boot Image while selecting Source...
	goto :Stop
)

if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows Recovery Image is not selected...
	echo.
	echo.Please choose Windows Recovery Image while selecting Source...
	goto :Stop
)

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Settings WHD Baseline Updates folder path
if "%SelectedSourceOS%" equ "w81" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\Baseline"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\%PackageVersion%"

:: Checking whether WHD Baseline Updates folder is empty
if "%SelectedSourceOS%" equ "w81" (
	:: Windows 8.1 RTM (Build : 6.3.9600.16384)
	if %ImageServicePackBuild% equ 16384 if not exist "%Updates%\RTM\*.msu" if not exist "%Updates%\RTM\*.cab" (
		echo.WHD Baseline Updates folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline\RTM^> is empty...
		echo.
		echo.Please copy WHD Baseline Updates to respective folder...
		goto :Stop
	)

	:: Windows 8.1 all Builds include Post-RTM
	if "%ImageServicePackBuild%" neq "16384" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
		echo.WHD Baseline Updates folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline^> is empty...
		echo.
		echo.Please copy WHD Baseline Updates to respective folder...
		goto :Stop
	)
)

:: Windows 10
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
	echo.WHD General Updates folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\%PackageVersion%^> is empty...
	echo.
	echo.Please copy WHD General Updates to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.##################Started Integrating WHD Baseline Updates#####################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.##################Started Integrating WHD General Updates######################
if "%UpdateType%" equ "Boot" echo.########################to Windows Setup Boot Image#############################
if "%UpdateType%" equ "Install" echo.######################to Windows Setup Install Image############################
if "%UpdateType%" equ "InstallRecovery" echo.#################to Windows Setup Install ^& Recovery Images####################
if "%UpdateType%" equ "BootInstallRecovery" echo.##############to Windows Setup Boot, Install ^& Recovery Images##################
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" equ "Boot" (
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 1, 2
)

if "%UpdateType%" equ "Install" (
	echo.    Image                    : Install.wim	
	echo.    Image Index              : %ImageIndexNo%
)

if "%UpdateType%" equ "InstallRecovery" (
	echo.    Image                    : Install.wim        ^|  WinRE.wim
	echo.    Image Index              : %ImageIndexNo%                  ^|      1
)

if "%UpdateType%" equ "BootInstallRecovery" (
	echo.    Image                    : Boot.wim         ^|  Install.wim   ^|  WinRE.wim
	echo.    Image Index              : 1, 2             ^|      %ImageIndexNo%         ^|      1
)

echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.####Processing WHD Baseline Updates Packages###################################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####Processing WHD General Updates Packages####################################
echo.-------------------------------------------------------------------------------
echo.
:: Creating WHD Baseline Updates Temporary folder
if "%SelectedSourceOS%" equ "w81" echo.Creating WHD Baseline Updates Temporary folder...
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Creating WHD General Updates Temporary folder...
call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"
echo.

:: Extracting .CAB files From .MSU Package files to CAB Temporary folder
echo.Extracting Update Package files to Temporary folder...

:: Windows 8.1 RTM (Build : 6.3.9600.16384)
if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
   if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: Copy .CAB files from .MSU package files to CAB Temporary folder
   if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
   if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: Copy .CAB files from .MSU package files to CAB Temporary folder
   if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh (IR4 Build : 6.3.9600.17056)
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: Copy .CAB files from .MSU package files to CAB Temporary folder
   if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: Copy .CAB files from .MSU package files to CAB Temporary folder
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 10
if "%SelectedSourceOS%" equ "w10" (
	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul

		if "%ImageBuild%" geq "17763" if exist "%Temp%\Updates\*.cab" (
			call :RemoveFolder "%Temp%\Updates\Temp"
			call :CreateFolder "%Temp%\Updates\Temp"

			for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
				expand -R "%Temp%\Updates\%%i" -F:Win*.cab "%Temp%\Updates\Temp" >nul
				expand -R "%Temp%\Updates\%%i" -F:SSU*.cab "%Temp%\Updates\Temp" >nul
				if exist "%Temp%\Updates\Temp\*.cab" move /y "%Temp%\Updates\Temp\*.cab" "%Temp%\Updates" >nul
			)

			call :RemoveFolder "%Temp%\Updates\Temp"
		)

		for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Temp%\Updates\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)

		call :RemoveFile "%Temp%\Updates\*.cab" >nul
	)

	if exist "%Updates%\*.cab" (
		for /f %%i in ('"dir /b %Updates%\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Updates%\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		"%Zip%" x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: Renaming Windows Updates folder names matching to their respective update type
	cd /d "%Temp%\Updates\"

	for /f %%i in ('"dir /b *.*" 2^>nul') do (
		if exist "%%i\update.mum" (
			findstr /c:"Package_for_RollupFix" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "Cumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Update for Removal of Adobe Flash Player" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "RemoveFlashPlayer" >nul
		)

		if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
		if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
		if exist "%%i\setup*.exe" if exist "%%i\setup*.dll" ren "%%i" "DVDMedia" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if not exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" ren "%%i" "EdgeChromium" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_adobe-flash-for-*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" ren "%%i" "FlashPlayer" >nul
		if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.*.mum" ren "%%i" "NET35" >nul
		if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.*.mum" ren "%%i" "NET35LP" >nul
		if exist "%%i\%PackageArchitecture%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >nul
		if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp_31bf3856ad364e35_*.manifest" ren "%%i" "NET48" >nul
		if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp.resources_*%ImageDefaultLanguage%*.manifest" ren "%%i" "NET48LP" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-updatetargeting-windowsoobe_31bf3856ad364e35_*.manifest" ren "%%i" "OOBE" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-s..boot-firmwareupdate_*.manifest" ren "%%i" "SecureBoot" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-servicingstack_*.manifest" ren "%%i" "ServicingStack" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsFeatureExperience" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sysreset_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

:: Windows 11
if "%SelectedSourceOS%" equ "w11" (
	cd /d "%Temp%\Updates\"
	copy "%PSFExtractor%" "%Temp%\Updates" >nul
	copy "%PSFExtractor%.config" "%Temp%\Updates" >nul

	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:SSU*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.psf "%Temp%\Updates" >nul
	)

	if exist "%Updates%\*.cab" %XCopy% "%Updates%\*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\*.psf" %XCopy% "%Updates%\*.psf" "%Temp%\Updates" >nul

	if exist "%Temp%\Updates\*.psf" (
		for /f %%i in ('"dir /b %Temp%\Updates\SSU*.psf" 2^>nul') do (
			ren "%%i" "ServicingStack.psf"
			for /f %%j in ('"dir /b %Temp%\Updates\SSU*.cab" 2^>nul') do (ren "%%j" "ServicingStack.cab")
		)

		for /f "tokens=2 delims=-" %%i in ('"dir /b %Temp%\Updates\Windows*.psf" 2^>nul') do (
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.cab" 2^>nul') do (ren "%%j" "Cumulative.cab")
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.psf" 2^>nul') do (ren "%%j" "Cumulative.psf")
		)

		if exist "%Temp%\Updates\ServicingStack.psf" (
			md "%Temp%\Updates\ServicingStack"
			expand -f:* ServicingStack.cab "%Temp%\Updates\ServicingStack" >nul

			if exist "%Temp%\Updates\ServicingStack\*cablist.ini" (
				expand -f:* "%Temp%\Updates\ServicingStack\*.cab" "%Temp%\Updates\ServicingStack" >nul
				call :RemoveFile "%Temp%\Updates\ServicingStack\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\ServicingStack\*.cab"
			)

			if not exist "%Temp%\Updates\ServicingStack\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\ServicingStack\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\ServicingStack\%%#" "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
				)
			)

			PSFExtractor.exe ServicingStack.cab >nul
			call :RemoveFile "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\ServicingStack.*"
		)

		if exist "%Temp%\Updates\Cumulative.psf" (
			md "%Temp%\Updates\Cumulative"
			expand -f:* Cumulative.cab "%Temp%\Updates\Cumulative" >nul

			if exist "%Temp%\Updates\Cumulative\*cablist.ini" (
				expand -f:* "%Temp%\Updates\Cumulative\*.cab" "%Temp%\Updates\Cumulative" >nul
				call :RemoveFile "%Temp%\Updates\Cumulative\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\Cumulative\*.cab"
			)

			if not exist "%Temp%\Updates\Cumulative\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\Cumulative\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\Cumulative\%%#" "%Temp%\Updates\Cumulative\express.psf.cix.xml"
				)
			)
			
			PSFExtractor.exe Cumulative.cab >nul
			call :RemoveFile "%Temp%\Updates\Cumulative\*.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\Cumulative.*"
		)

		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe"
		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe.config"
	)

	if exist "%Temp%\Updates\*.cab" (
		for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
			set Update=%%i
			set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Temp%\Updates\%%i" -F:* "%Temp%\Updates\!Update!" >nul
		)

		call :RemoveFile "%Temp%\Updates\*.cab"
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		"%Zip%" x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: Renaming Windows Updates folder names matching to their respective update type
	for /f %%i in ('"dir /b *.*" 2^>nul') do (
		if exist "%%i\update.mum" (
			findstr /c:"Package_for_ServicingStack" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "ServicingStack" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_RollupFix" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "Cumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
		)

		if exist "%%i\update.mum" (
			findstr /c:"Microsoft .NET Framework 3.0 OnDemand" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NET35" >nul
		)

		if exist "%%i\%PackageArchitecture%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
		if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
		if exist "%%i\setup*.exe" if exist "%%i\setup*.dll" ren "%%i" "DVDMedia" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-onecore-c..dexperiencehost-api_31bf3856ad364e35_*.manifest" ren "%%i" "OOBE" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsFeatureExperience" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-i..dsetup-rejuvenation_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

echo.
echo.Finished Extracting Update Package files to Temporary folder...
echo.
if "%UpdateType%" neq "Boot" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" if exist "%Temp%\Updates\Enablement\Update.mum" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" (
	choice /C:YN /N /M "Do you want to skip integrating Microsoft Edge Chromium ? ['Y'es/'N'o] : "
	if !errorlevel! equ 1 (
		del /f /q "%Temp%\Updates\Enablement\Update.mum" >nul
		del /f /q "%Temp%\Updates\Enablement\Update.cat" >nul

		if "%ImageArchitecture%" equ "x86" (
			call :RemoveFolder "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_d4e678d60dbf374c"
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_88ed58c8b45ef5b335c7e00f1d272a1c_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.cat" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			call :RemoveFolder "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051459c61ca882"
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_84b67765c88012e177d65b696e48302e_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)

		if "%ImageArchitecture%" equ "arm64" (
			call :RemoveFolder "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051c93c61c9d1e"
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_d29030e5eb1fbfc0c65c0cd08e617938_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)
	)
	echo.
)

if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.####Integrating WHD Baseline Updates to Windows Setup Boot Image###############
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####Integrating WHD General Updates to Windows Setup Boot Image################
	echo.-------------------------------------------------------------------------------
	echo.

	for /l %%i in (1, 1, 2) do (
		echo.=============================[Boot.wim, Index : %%i]=============================
		echo.
		:: Windows 8.1 RTM (Build : 6.3.9600.16384)
		if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Prerequisite Update ^(KB3021910^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Update ^(KB2919355^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2932046^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2937592^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2938439^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2938772^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
		)

		:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
		if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		)

		:: Windows 8.1 with Update (IR4 Build : 6.3.9600.17056)
		if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		)

		:: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
		if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
			if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
		)

		:: Windows 10
		if "%SelectedSourceOS%" equ "w10" (
			if exist "%Temp%\Updates\ServicingStack\Update.mum" (
				if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
					echo.-------------------------------------------------------------------------------
					echo.Applying Windows 10 v1507 Cumulative Update Integration Fix...
					echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", %PackageIndex%, "%BootMount%\%%i"
					call :MountImageRegistry "%BootMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\TH1CUFix_%ImageArchitecture%.reg" 2>nul
					call :UnMountImageRegistry
				)

				if "%ImageArchitecture%" equ "x86" if "%ImageBuild%" equ "14393" if "%ImageServicePackBuild%" equ "0" (
					echo.-------------------------------------------------------------------------------
					echo.Applying Windows 10 v1607 Cumulative Update Integration Fix...
					echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\RS1CUFix.tpk", %PackageIndex%, "%BootMount%\%%i"
					call :MountImageRegistry "%BootMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
					call :UnMountImageRegistry
				)
			)
		)

		:: Windows 10/11
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if exist "%Temp%\Updates\ServicingStack\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows %OSID% Servicing Stack Update...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\ServicingStack"
			)

			if exist "%Temp%\Updates\General\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 11 General Update...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\General"
			)

			if exist "%Temp%\Updates\Cumulative\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows %OSID% Cumulative Update...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Cumulative"
			)

			if exist "%Temp%\Updates\Enablement\Update.mum" (
				echo.-------------------------------------------------------------------------------
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
					echo.Integrating Windows 10 v1909 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.Integrating Windows 10 v20H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.Integrating Windows 10 v21H1 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.Integrating Windows 10 v21H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.Integrating Windows 10 v22H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
					echo.Integrating Windows Server 2022 v22H2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 1 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 2 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 3 Feature Enablement Update Package...
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.Integrating Windows 11 v22H2 Moment 4 Feature Enablement Update Package...
				)
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Enablement"
			)
		)
	)

	:: Windows 8.1
	if "%SelectedSourceOS%" equ "w81" if exist "%Temp%\Updates\WinPE\*.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows 8.1 WinPE Updates...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%BootMount%\2", "%Temp%\Updates\WinPE"
	)

	:: Windows 10/11
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		if exist "%Temp%\Updates\SafeOS\Update.mum" (
		   	echo.-------------------------------------------------------------------------------
		   	echo.Integrating Windows %OSID% Safe OS Dynamic Update...
		   	echo.-------------------------------------------------------------------------------
		   	call :AddPackage "%BootMount%\2", "%Temp%\Updates\SafeOS"
		)

		if exist "%Temp%\Updates\DVDMedia\*.exe" if exist "%Temp%\Updates\DVDMedia\*.dll" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows %OSID% Dynamic Update for Sources...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.Copying Windows %OSID% Dynamic Update for Sources to ^<DVD^> folder.
			%XCopy% "%Temp%\Updates\DVDMedia\*.*" "%DVD%\sources" >nul
			cd /d "%DVD%\sources\" >nul
			
			for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
				if "%ImageDefaultLanguage%" neq "%%i" call :RemoveFolder "%DVD%\sources\%%i"
			)

			cd /d "%ROOT%\" >nul
			echo.
		)
	)
)

if "%UpdateType%" neq "Boot" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.####Integrating WHD Baseline Updates to Windows Setup Install Image############
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####Integrating WHD General Updates to Windows Setup Install Image#############
	echo.-------------------------------------------------------------------------------

	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.

			:: Windows 8.1 RTM (Build : 6.3.9600.16384)
			if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Prerequisite Update ^(KB3021910^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Update ^(KB2919355^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2932046^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2937592^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2938439^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2938772^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3014442^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
			)

			:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
			if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3014442^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
			)

			:: Windows 8.1 with Update (IR4 Build : 6.3.9600.17056)
			if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB3014442^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
			)

			:: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
			if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
				if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
				)

				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
			)

			:: Windows 10
			if "%SelectedSourceOS%" equ "w10" (
				:: Importing registry fix to enable integrating Windows 10 updates to EOL editions.
				if "%ImageBuild%" equ "10240" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, Education, Enterprise, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, EducationN, EnterpriseN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "10586" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "14393" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, Education, Enterprise, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, EducationN, EnterpriseN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "15063" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "16299" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs3.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs3.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "17134" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, Professional, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs4.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs4.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" equ "17763" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs5.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs5.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)

				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					call :GetImageEdition "%InstallWim%", %%i >nul

					for %%j in (Core, CoreSingleLanguage, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs6.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)

					for %%j in (CoreN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs6.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
					)
				)
			)

			:: Windows 10/11
			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				if exist "%Temp%\Updates\ServicingStack\Update.mum" (
					if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
						echo.-------------------------------------------------------------------------------
						echo.Applying Windows 10 v1507 Cumulative Update Integration Fix...
						echo.-------------------------------------------------------------------------------
						call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
						call :MountImageRegistry "%InstallMount%\%%i"
						call :ImportRegistry2Image "%W10CUFix%\TH1CUFix_%ImageArchitecture%.reg" 2>nul
						call :UnMountImageRegistry
					)

					if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x86" if "%ImageBuild%" equ "14393" if "%ImageServicePackBuild%" equ "0" (
						echo.-------------------------------------------------------------------------------
						echo.Applying Windows 10 v1607 Cumulative Update Integration Fix...
						echo.-------------------------------------------------------------------------------
						call :ApplyImage "%W10CUFix%\RS1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
						call :MountImageRegistry "%InstallMount%\%%i"
						call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
						call :UnMountImageRegistry
					)

					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows %OSID% Servicing Stack Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\ServicingStack"
				)

				if exist "%Temp%\Updates\General\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 11 General Update...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\General"
				)

				if exist "%Temp%\Updates\WindowsFeatureExperience\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Feature Experience Pack Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\WindowsFeatureExperience"
				)

				if exist "%Temp%\Updates\CPUMicroCode\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Intel CPU Microcode Dynamic Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\CPUMicroCode"
				)

				if exist "%Temp%\Updates\SecureBoot\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Secure Boot DBX Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\SecureBoot"
				)

				if exist "%Temp%\Updates\FlashPlayer\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Adobe Flash Player Security Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\FlashPlayer"
				)

				if exist "%Temp%\Updates\RemoveFlashPlayer\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Remove Adobe Flash Player Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\RemoveFlashPlayer"
				)

				if exist "%Temp%\Updates\Cumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows %OSID% Cumulative Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
				)

				if exist "%Temp%\Updates\NET35\Update.mum" (
					if "%ImageBuild%" lss "19041" if not exist "%InstallMount%\%%i\Windows\WinSxS\pending.xml" (
						echo.-------------------------------------------------------------------------------
						echo.Performing [Install.wim, Index : %%i] Image Cleanup...
						echo.-------------------------------------------------------------------------------
						call :CleanupImage "%InstallMount%\%%i", "ComponentCleanupResetBase"
					)
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Framework 3.5 Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35"
				)

				if exist "%Temp%\Updates\NET35LP\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Framework 3.5 [%ImageDefaultLanguage%] Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35LP"
				)

				if exist "%Temp%\Updates\NET35CDU\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Framework 3.5 Critical Dynamic Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35CDU"
				)

				if exist "%Temp%\Updates\NET48\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Framework 4.8 Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48"
				)

				if exist "%Temp%\Updates\NET48LP\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48LP"
				)

				if exist "%Temp%\Updates\NetCumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft .NET Cumulative Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NetCumulative"
				)

				if exist "%Temp%\Updates\EdgeChromium\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Microsoft Edge Chromium Browser Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\EdgeChromium"
				)

				if exist "%Temp%\Updates\Enablement\Update.mum" (
					echo.-------------------------------------------------------------------------------
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
						echo.Integrating Windows 10 v1909 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
						echo.Integrating Windows 10 v20H2 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
						echo.Integrating Windows 10 v21H1 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
						echo.Integrating Windows 10 v21H2 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
						echo.Integrating Windows 10 v22H2 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
						echo.Integrating Windows Server 2022 v22H2 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.Integrating Windows 11 v22H2 Moment 1 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.Integrating Windows 11 v22H2 Moment 2 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.Integrating Windows 11 v22H2 Moment 3 Feature Enablement Update Package...
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.Integrating Windows 11 v22H2 Moment 4 Feature Enablement Update Package...
					)
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i",  "%Temp%\Updates\Enablement"
				)

				if exist "%Temp%\Updates\OOBE\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows %OSID% OOBE Update...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\OOBE"
				)

				if exist "%Temp%\Updates\Cumulative\Update.mum" if exist "%Temp%\Updates\NET35\Update.mum" if exist "%Temp%\Updates\NetCumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Re-Integrating Windows %OSID% Cumulative Update Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
				)

				if exist "%Temp%\Updates\Defender\package-defender.xml" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows Defender Definition Update Package...
					echo.-------------------------------------------------------------------------------
					echo.
					for /f %%x IN ('"dir /b %Temp%\Updates\Defender\Platform" 2^>nul') do (set "DefenderVersion=%%x")

					echo.Copying Windows Defender Definition Updates ^(v!DefenderVersion!^).
					%XCopy% "%Temp%\Updates\Defender\Definition Updates\Updates" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Definition Updates\Updates" >nul

					echo.Copying Windows Defender Platform Updates.
					%XCopy% /s "%Temp%\Updates\Defender\Platform" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform" >nul

					echo.Copying MpAsDesc.dll file.
					Copy /y "%InstallMount%\%%i\Program Files\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!" >nul
					if "%ImageArchitecture%" equ "x64" Copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86" >nul

					echo.Copying MpAsDesc.dll.mui file.
					for /d %%y in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
						if exist "%InstallMount%\%%i\Program Files\Windows Defender\%%y" (
							call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y"
							Copy /y "%InstallMount%\%%i\Program Files\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y\mpasdesc.dll.mui" >nul

							if "%ImageArchitecture%" equ "x64" (
								call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y"
								Copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y\mpasdesc.dll.mui" >nul
							)
						)
					)

					echo.Copying Package-defender.xml to Windows Temp folder.
					Copy /y "%Temp%\Updates\Defender\package-defender.xml" "%InstallMount%\%%i\Windows\Temp" >nul
					echo.
				)
			)
		)
	)
)

if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.####Integrating WHD Baseline Updates to Windows Setup Recovery Image###########
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####Integrating WHD General Updates to Windows Setup Recovery Image############
	echo.-------------------------------------------------------------------------------
	echo.
	:: Windows 8.1 RTM (Build : 6.3.9600.16384)
	if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Prerequisite Update ^(KB3021910^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Update ^(KB2919355^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2932046^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2937592^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2938439^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2938772^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
	)

	:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
	if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB2934018^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	)

	:: Windows 8.1 with Update Refresh (IR4 Build : 6.3.9600.17056)
	if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3000850^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB3003057^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	)

	:: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
	if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
		if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating WHD Baseline Feature Pack Update ^(KB3021910^)...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.Integrating WHD Baseline Feature Pack Update ^(KB5018922^)...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
	)

	:: Windows 8.1
	if "%SelectedSourceOS%" equ "w81" if exist "%Temp%\Updates\WinPE\*.cab" (
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows 10 WinPE Updates...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\WinPE"
	)

	:: Windows 10/11
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		if exist "%Temp%\Updates\ServicingStack\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows %OSID% Servicing Stack Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\ServicingStack"
		)

		if exist "%Temp%\Updates\General\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows 11 General Update...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\General"
		)

		if exist "%Temp%\Updates\SafeOS\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows %OSID% Safe OS Dynamic Update...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\SafeOS"
		)

		if not exist "%Temp%\Updates\SafeOS\Update.mum" if exist "%Temp%\Updates\Cumulative\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows %OSID% Cumulative Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Cumulative"
		)

		if exist "%Temp%\Updates\Enablement\Update.mum" (
			echo.-------------------------------------------------------------------------------
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
				echo.Integrating Windows 10 v1909 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
				echo.Integrating Windows 10 v20H2 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
				echo.Integrating Windows 10 v21H1 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
				echo.Integrating Windows 10 v21H2 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
				echo.Integrating Windows 10 v22H2 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
				echo.Integrating Windows Server 2022 v22H2 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.Integrating Windows 11 v22H2 Moment 1 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.Integrating Windows 11 v22H2 Moment 2 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.Integrating Windows 11 v22H2 Moment 3 Feature Enablement Update Package...
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.Integrating Windows 11 v22H2 Moment 4 Feature Enablement Update Package...
			)
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Enablement"
		)

	)
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.Generating WHD Baseline Updates Integration Log File...
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Generating WHD General Updates Integration Log File...
	echo.-------------------------------------------------------------------------------
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.Writing WHD Baseline Updates Integration Log.
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Writing WHD General Updates Integration Log.
	echo.

	if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" (
		for /l %%k in (1, 1, 2) do (
			call :GetPackages "%BootMount%\%%k", "Boot-%%k.txt"
		)
	)

	if "%UpdateType%" neq "Boot" (
		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" (
				call :GetPackages "%InstallMount%\%%i", "Install-%%i.txt"
			)
		)
	)

	if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" (
		call :GetPackages "%WinReMount%", "Install_WinRE.txt"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Cleaning Up Temporary files ^& Folders######################################
echo.-------------------------------------------------------------------------------
echo.
if "%SelectedSourceOS%" equ "w81" echo.Cleaning Up WHD Baseline Updates Temporary folder.
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.Cleaning Up WHD General Updates Temporary folder.
call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.##################Finished Integrating WHD Baseline Updates####################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.##################Finished Integrating WHD General Updates#####################
if "%UpdateType%" equ "Boot" echo.########################to Windows Setup Boot Image############################
if "%UpdateType%" equ "Install" echo.######################to Windows Setup Install Image###########################
if "%UpdateType%" equ "InstallRecovery" echo.#################to Windows Setup Install ^& Recovery Images####################
if "%UpdateType%" equ "BootInstallRecovery" echo.##############to Windows Setup Boot, Install ^& Recovery Images#################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set PackageArchitecture=
set UpdateType=
set Updates=

endlocal

:: Reading Updated Image Information
call :GetUpdatedImageInformation >nul

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate WHD Updates
:: Input Parameters [%~1 : UpdateType ]
::-------------------------------------------------------------------------------------------
:IntWHDUpdates

setlocal

:: Setting WHD Updates Type
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "General" echo.                 MSMG ToolKit - Integrate WHD General Updates
if "%UpdateType%" equ "Hotfix" echo.                 MSMG ToolKit - Integrate WHD Hotfix Updates
if "%UpdateType%" equ "Security" echo.               MSMG ToolKit - Integrate WHD Security Updates
if "%UpdateType%" equ "ESU" echo.           MSMG ToolKit - Integrate WHD Extended Security Updates
if "%UpdateType%" equ "NET35" echo.        MSMG ToolKit - Integrate Microsoft .NET Framework 3.5 Updates
if "%UpdateType%" equ "WAT" echo.        MSMG ToolKit - Integrate Windows Activation Technologies ^(WAT^)
if "%UpdateType%" equ "Windows10" echo.        MSMG ToolKit - Integrate Windows 10 Upgrade Preparation Updates
if "%UpdateType%" equ "WinPE" echo.                MSMG ToolKit - Integrate Windows PE Updates
if "%UpdateType%" equ "WUSatisfy" echo.           MSMG ToolKit - Integrate Windows Update Satisfy Updates
if "%UpdateType%" equ "ADLDS" echo.   MSMG ToolKit - Integrate Active Directory Lightweight Directory Services
if "%UpdateType%" equ "FMApi" echo.                    MSMG ToolKit - Integrate File Management API
if "%UpdateType%" equ "Features" echo.                   MSMG ToolKit - Integrate Windows Features
if "%UpdateType%" equ "VirtualPC" echo.             MSMG ToolKit - Integrate Microsoft Virtual PC Feature
if "%UpdateType%" equ "WorkFolders" echo.  MSMG ToolKit - Integrate Sync Agent for Domain Environmernts ^(Work Folders^)
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Settings WHD Updates Menu folder path
set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking WHD Updates folder is empty
if "%UpdateType%" equ "General" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.cab" (
		echo.WHD General Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#General^> is empty...
		echo.
		echo.Please copy WHD General Updates files to respective folder...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD General Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> is empty...
		echo.
		echo.Please copy WHD General Updates files to respective folder...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD General Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> is empty...
		echo.
		echo.Please copy WHD General Updates files to respective folder...
		goto :Stop
	)
)

if "%UpdateType%" equ "Hotfix" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.cab" (
		echo.WHD Hotfix Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Hotfix^> is empty...
		echo.
		echo.Please copy WHD Hotfix Updates files to respective folder...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD Hotfix Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> is empty...
		echo.
		echo.Please copy WHD Hotfix Updates files to respective folder...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD Hotfix Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> is empty...
		echo.
		echo.Please copy WHD Hotfix Updates files to respective folder...
		goto :Stop
	)
)

if "%UpdateType%" equ "Security" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.cab" (
		echo.WHD Security Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Security^> is empty...
		echo.
		echo.Please copy WHD Security Updates files to respective folder...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD Security Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> is empty...
		echo.
		echo.Please copy WHD Security Updates files to respective folder...
		goto :Stop
	)
	
	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD Security Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> is empty...
		echo.
		echo.Please copy WHD Security Updates files to respective folder...
		goto :Stop
	)
)

if "%UpdateType%" equ "ESU" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%Updates%\Security\ESU\*.msu" if not exist "%Updates%\Security\ESU\*.cab" (
		echo.WHD Extended Security Updates ^(ESU^) Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security\ESU^> is empty...
		echo.
		echo.Please copy WHD Extended Security Updates ^(ESU^) files to respective folder...
		goto :Stop
	)
)

if "%UpdateType%" equ "NET35" if not exist "%Updates%\Additional\NET35\*.msu" if not exist "%Updates%\Additional\NET35\*.cab" (
	echo.			 Microsoft .NET Framework 3.5 Updates Folder
	echo.		   ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\NET35^> is empty...
	echo.
	echo. Please Copy Microsoft .NET Framework 3.5 Updates files to respective folder...
	goto :Stop
)

if "%UpdateType%" equ "WAT" (
	if not exist "%Updates%\Additional\WAT\*.msu" if not exist "%Updates%\Additional\WAT\*.cab" (
		echo.                    Windows Activation Technologies Folder
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WAT^> is empty...
		echo.
		echo.    Please Copy Windows Activation Technologies files to respective folder...
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows Activation Technologies Requires Client/Server Editions...
		goto :Stop
	)
)

if "%UpdateType%" equ "Windows10" (
	if not exist "%Updates%\Additional\Windows10\*.msu" if not exist "%Updates%\Additional\Windows10\*.cab" (
		echo.                  Windows 10 Upgrade Preparation Updates Folder
		echo.               ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\Windows10^> is empty...
		echo.
		echo.Please copy Windows 10 Upgrade Preparation Updates files to Respective Folder..
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.cab" (
		echo.               Windows 10 Upgrade Preparation Updates Folder
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Windows10^> is empty...
		echo.
		echo.Please copy Windows 10 Upgrade Preparation Updates files to Respective Folder..
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows 10 Upgrade Preparation Updates Requires Client Editions...
		goto :Stop
	)
)

if "%UpdateType%" equ "WinPE" if not exist "%Updates%\Additional\WinPE\*.msu" if not exist "%Updates%\Additional\WinPE\*.cab" (
	echo.Windows PE Updates Folder ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WinPE^> is empty...
	echo.
	echo.Please copy Windows PE Updates files to respective folder...
	goto :Stop
)

if "%UpdateType%" equ "WUSatisfy" if not exist "%Updates%\Additional\WU.Satisfy\*.msu" if not exist "%Updates%\Additional\WU.Satisfy\*.cab" (
	echo.                    Windows Update Satisfy Updates Folder
	echo.              ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WU.Satisfy^> is empty...
	echo.
	echo.    Please Copy Windows Update Satisfy Updates files to respective folder...
	goto :Stop
)

if "%UpdateType%" equ "ADLDS" (
	if not exist "%Updates%\Extra\AD_LDS\*.msu" if not exist "%Updates%\Extra\AD_LDS\*.cab" (
		echo.        Active Directory Lightweight Directory Services Feature Folder
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS^> is empty...
		echo.
		echo.           Please Copy ADLDS Feature files to respective folder...
		goto :Stop
	)

	if not exist "%Updates%\Extra\AD_LDS\Updates\*.msu" if not exist "%Updates%\Extra\AD_LDS\Updates\*.cab" (
		echo.     Active Directory Lightweight Directory Services Feature Updates Folder
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS\Updates^> is empty...
		echo.
		echo.        Please Copy ADLDS Feature Updates files to respective folder...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.cab" (
		echo.     Active Directory Lightweight Directory Services Feature Updates Folder
		echo.         ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\AD_LDS^> is empty...
		echo.
		echo.        Please Copy ADLDS Feature Updates files to respective folder...
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.           Active Directory Lightweight Directory Services Feature
		echo.             Requires Professional/Enterprise/Ultimate Editions...
		goto :Stop
	) else (
		goto :Continue
	)
)

if "%UpdateType%" equ "FMApi" if not exist "%Updates%\Extra\Addons\FM.Api\*.msu" if not exist "%Updates%\Extra\Addons\FM.Api\*.cab" (
	echo.                        File Management API Folder
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\FM.Api^> is empty...
	echo.
	echo.           Please Copy File Management API files to respective folder...
	goto :Stop
)

if "%UpdateType%" equ "Features" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.cab" (
	echo.                           Windows Features Folder
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Features^> is empty...
	echo.
	echo.           Please Copy Windows Features files to respective folder...
	goto :Stop
)

if "%UpdateType%" equ "VirtualPC" (
	if not exist "%Updates%\Extra\VirtualPC\*.msu" if not exist "%Updates%\Extra\VirtualPC\*.cab" (
		echo.                     Microsoft Virtual PC Feature Folder
		echo.                ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\VirtualPC^> is empty...
		echo.
		echo.    Please Copy Microsoft Virtual PC Feature files to respective folder...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.cab" (
		echo.                Microsoft Virtual PC Feature Updates Folder
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\VirtualPC^> is empty...
		echo.
		echo.Please copy Microsoft Virtual PC Feature Updates files to respective folder...
		goto :Stop
	)
)

if "%UpdateType%" equ "WorkFolders" (
	if not exist "%Updates%\Extra\Addons\WorkFolders\*.msu" if not exist "%Updates%\Extra\Addons\WorkFolders\*.cab" (
		echo.       Sync Agent for Domain Environmernts ^(Work Folders^) Feature Folder
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\WorkFolders^> is empty...
		echo.
		echo.         Please Copy Sync Agent for Domain Environmernts ^(Work Folders^)
		echo.                   Feature files to respective folder...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.cab" (
		echo.   Sync Agent for Domain Environmernts ^(Work Folders^) Feature Updates Folder
		echo.      ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\WorkFolders^> is empty...
		echo.
		echo.        Please Copy Sync Agent for Domain Environmernts ^(Work Folders^)
		echo.                Feature Updates files to respective folder...
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.           Sync Agent for Domain Environmernts ^(Work Folders^) Feature
		echo.             Requires Professional/Enterprise/Ultimate Editions...
		goto :Stop
	) else (
		goto :Continue
	)
)

:Continue
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "General" echo.####Started Integrating WHD General Updates####################################
if "%UpdateType%" equ "Hotfix" echo.####Started Integrating WHD Hotfix Updates#####################################
if "%UpdateType%" equ "Security" echo.####Started Integrating WHD Security Updates###################################
if "%UpdateType%" equ "ESU" echo.####Started Integrating WHD Extended Security Updates##########################
if "%UpdateType%" equ "NET35" echo.####Started Integrating Microsoft .NET Framework 3.5 Updates###################
if "%UpdateType%" equ "WAT" echo.####Started Integrating Windows Activation Technologies ^(WAT^)##################
if "%UpdateType%" equ "Windows10" echo.####Started Integrating Windows 10 Upgrade Preparation Updates#################
if "%UpdateType%" equ "WinPE" echo.####Started Integrating Windows PE Updates#####################################
if "%UpdateType%" equ "WUSatisfy" echo.####Started Integrating Windows Update Satisfy Updates#########################
if "%UpdateType%" equ "ADLDS" echo.####Started Integrating Active Directory Lightweight Directory Services########
if "%UpdateType%" equ "FMApi" echo.####Started Integrating File Management API####################################
if "%UpdateType%" equ "Features" echo.####Started Integrating Windows Features#######################################
if "%UpdateType%" equ "VirtualPC" echo.####Started Integrating Microsoft Virtual PC Feature###########################
if "%UpdateType%" equ "WorkFolders" echo.####Started Integrating Sync Agent for Domain Environmernts ^(Work Folders^)#####
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" neq "WinPE" (
	echo.    Image                    : Install.wim
	echo.    Image Index              : %ImageIndexNo%
) else (
	echo.    Image                    : Boot.wim         ^|  WinRE.wim
	echo.    Image Indexes            :    2             ^|    1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "General" echo.####Processing WHD General Updates Packages####################################
if "%UpdateType%" equ "Hotfix" echo.####Processing WHD Hotfix Updates Packages#####################################
if "%UpdateType%" equ "Security" echo.####Processing WHD Security Updates Packages###################################
if "%UpdateType%" equ "ESU" echo.####Processing WHD Extended Security Updates Packages##########################
if "%UpdateType%" equ "NET35" echo.####Processing Microsoft .NET Framework 3.5 Updates Packages###################
if "%UpdateType%" equ "WAT" echo.####Processing Windows Activation Technologies ^(WAT^) Packages##################
if "%UpdateType%" equ "Windows10" echo.####Processing Windows 10 Upgrade Preparation Updates Packages#################
if "%UpdateType%" equ "WinPE" echo.####Processing Windows PE Updates Packages#####################################
if "%UpdateType%" equ "WUSatisfy" echo.####Processing Windows Update Satisfy Updates Packages#########################
if "%UpdateType%" equ "ADLDS" echo.####Processing Active Directory Lightweight Directory Services Packages########
if "%UpdateType%" equ "FMApi" echo.####Processing File Management API Packages####################################
if "%UpdateType%" equ "Features" echo.####Processing Windows Features Packages#######################################
if "%UpdateType%" equ "VirtualPC" echo.####Processing Microsoft Virtual PC Feature Packages###########################
if "%UpdateType%" equ "WorkFolders" echo.####Processing Sync Agent for Domain Environmernts ^(Work Folders^) Packages#####
echo.-------------------------------------------------------------------------------
echo.
:: Creating WHD Updates Temporary Folder
if "%UpdateType%" equ "General" echo.Creating WHD General Updates Packages Temporary folder...
if "%UpdateType%" equ "Hotfix" echo.Creating WHD Hotfix Updates Packages Temporary folder...
if "%UpdateType%" equ "Security" echo.Creating WHD Security Updates Packages Temporary folder...
if "%UpdateType%" equ "ESU" echo.Creating WHD Extended Security Updates Packages Temporary folder...
if "%UpdateType%" equ "NET35" echo.Creating Microsoft .NET Framework 3.5 Updates Packages Temporary folder...
if "%UpdateType%" equ "WAT" echo.Creating Windows Activation Technologies Packages Temporary folder...
if "%UpdateType%" equ "Windows10" echo.Creating Windows 10 Upgrade Preparation Updates Packages Temporary folder...
if "%UpdateType%" equ "WinPE" echo.Creating Windows PE Updates Packages Temporary folder...
if "%UpdateType%" equ "WUSatisfy" echo.Creating Windows Update Satisfy Updates Packages Temporary folder...
if "%UpdateType%" equ "ADLDS" echo.Creating ADLDS Packages Temporary folder...
if "%UpdateType%" equ "FMApi" echo.Creating File Management API Packages Temporary folder...
if "%UpdateType%" equ "Features" echo.Creating Windows Features Packages Temporary folder...
if "%UpdateType%" equ "VirtualPC" echo.Creating Microsoft Virtual PC Feature Packages Temporary folder...
if "%UpdateType%" equ "WorkFolders" echo.Creating Sync Agent for Domain Environmernts Packages Temporary folder...
echo.

call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"

if "%UpdateType%" equ "General" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "Hotfix" call :CreateFolder "%Temp%\Updates\%UpdateType%"

if "%UpdateType%" equ "Security" (
	call :CreateFolder "%Temp%\Updates\%UpdateType%" >nul
	if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%Temp%\Updates\%UpdateType%\ProWMC"
)

if "%UpdateType%" equ "ESU" (
	call :CreateFolder "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "NET35" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WAT" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "Windows10" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WinPE" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WUSatisfy" call :CreateFolder "%Temp%\Updates\%UpdateType%\ProfessionalWMC"
if "%UpdateType%" equ "ADLDS" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
if "%UpdateType%" equ "FMApi" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
if "%UpdateType%" equ "Features" call :CreateFolder "%Temp%\Updates\%UpdateType%"

if "%UpdateType%" equ "VirtualPC" (
	if "%IsW7SP1CRUSelected%" equ "Yes" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "No" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

if "%UpdateType%" equ "WorkFolders" (
	if "%IsW7SP1CRUSelected%" equ "Yes" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "No" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

echo.Extracting Update Package files to Temporary folder...
echo.

:: Extracting/Copying WHD Updates .CAB files to Temporary Folder
if "%UpdateType%" equ "General" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#General\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#General\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#General\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#General\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\WUClient*.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\WUClient"
			move /y "%Temp%\Updates\%UpdateType%\WUClient*.cab" "%Temp%\Updates\%UpdateType%\WUClient" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\SP2"
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2670838-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB3125574-v4-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB3172605-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\Client"
		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB917607-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows6.1-KB917607-%ImageArchitecture%.cab" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB3140185-%ImageArchitecture%.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\Upgrade"
			move /y "%Temp%\Updates\%UpdateType%\Windows8.1-KB3140185-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\Upgrade" >nul
		)

		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB917607-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows8.1-KB917607-%ImageArchitecture%.cab" >nul
		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB4486105-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows8.1-KB4486105-%ImageArchitecture%.cab" >nul
	)
)

if "%UpdateType%" equ "Hotfix" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB2780124-%ImageArchitecture%*.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
			move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2780124-%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%\Ent_Ultimate" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\Client"
		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB2727994-v3-%ImageArchitecture%.cab" move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2727994-v3-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\Client" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "Security" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#Security\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#Security\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#Security\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#Security\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\NET452\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\NET452\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\NET452\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\NET452\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "ESU" (
	if exist "%Updates%\Security\ESU\*%ImageArchitecture%*.msu" expand "%Updates%\Security\ESU\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Security\ESU\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Security\ESU\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "NET35" (
	if exist "%Updates%\Additional\NET35\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\NET35\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\NET35\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\NET35\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "WAT" (
	if exist "%Updates%\Additional\WAT\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WAT\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WAT\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WAT\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "Windows10" (
	if exist "%Updates%\Additional\Windows10\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\Windows10\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\Windows10\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\Windows10\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\_Windows10\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\_Windows10\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "WinPE" (
	if exist "%Updates%\Additional\WinPE\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WinPE\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WinPE\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WinPE\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if exist "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.msu" expand "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.cab" %XCopy% "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.msu" expand "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.cab" %XCopy% "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "WUSatisfy" (
	if exist "%Updates%\Additional\WU.Satisfy\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WU.Satisfy\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WU.Satisfy\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WU.Satisfy\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\ProfessionalWMC" >nul
	if exist "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*.cab" "%Temp%\Updates\%UpdateType%\ProfessionalWMC" >nul
)

if "%UpdateType%" equ "ADLDS" (
	if exist "%Updates%\Extra\AD_LDS\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\AD_LDS\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\AD_LDS\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\AD_LDS\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if exist "%Updates%\Extra\AD_LDS\Updates\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\AD_LDS\Updates\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
	if exist "%Updates%\Extra\AD_LDS\Updates\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\AD_LDS\Updates\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

if "%UpdateType%" equ "FMApi" (
	if exist "%Updates%\Extra\Addons\FM.Api\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\Addons\FM.Api\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\Addons\FM.Api\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\Addons\FM.Api\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "Features" (
	if exist "%Updates%\Extra\WithoutKB3125574\_Features\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\_Features\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\WithoutKB3125574\_Features\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\_Features\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "VirtualPC" (
	if exist "%Updates%\Extra\VirtualPC\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\VirtualPC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\VirtualPC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\VirtualPC\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

if "%UpdateType%" equ "WorkFolders" (
	if exist "%Updates%\Extra\Addons\WorkFolders\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\Addons\WorkFolders\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\Addons\WorkFolders\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\Addons\WorkFolders\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

echo.Finished Extracting Update Package files to Temporary folder...
echo.
echo.-------------------------------------------------------------------------------
:: Integrating WHD Updates Packages to WIM Image
if "%UpdateType%" equ "General" echo.####Integrating WHD General Updates############################################
if "%UpdateType%" equ "Hotfix" echo.####Integrating WHD Hotfix Updates#############################################
if "%UpdateType%" equ "Security" echo.####Integrating WHD Security Updates###########################################
if "%UpdateType%" equ "ESU" echo.####Integrating WHD Extended Security Updates##################################
if "%UpdateType%" equ "NET35" echo.####Integrating Microsoft .NET Framework 3.5 Updates###########################
if "%UpdateType%" equ "WAT" echo.####Integrating Windows Activation Technologies ^(WAT^) #########################
if "%UpdateType%" equ "Windows10" echo.####Integrating Windows 10 Upgrade Preparation Updates#########################
if "%UpdateType%" equ "WinPE" echo.####Integrating Windows PE Updates#############################################
if "%UpdateType%" equ "WUSatisfy" echo.####Integrating Windows Update Satisfy Updates#################################
if "%UpdateType%" equ "ADLDS" echo.####Integrating Active Directory Lightweight Directory Services Feature########
if "%UpdateType%" equ "FMApi" echo.####Integrating File Management API Feature####################################
if "%UpdateType%" equ "Features" echo.####Integrating Windows Features Updates#######################################
if "%UpdateType%" equ "VirtualPC" echo.####Integrating Microsoft Virtual PC Feature###################################
if "%UpdateType%" equ "WorkFolders" echo.####Integrating Sync Agent for Domain Environmernts ^(Work Folders^)#############
echo.-------------------------------------------------------------------------------

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]============================

		if "%UpdateType%" equ "General" (
			call :GetImageEdition "%InstallWim%", %%i

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if exist "%Temp%\Updates\%UpdateType%\WUClient\WUClient*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 7 - Windows Update Client Updates Packages...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-Core-%ImageArchitecture%-7.6.7600.320.cab"
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-Aux-%ImageArchitecture%-7.6.7600.320.cab"
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-ActiveX-%ImageArchitecture%-7.6.7600.320.cab"
				)
			)

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
				echo.
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 7 SP1 Convenience Rollup Prerequisite Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB4490628-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 7 SP1 Convenience Rollup Platform Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB2670838-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 7 SP1 Convenience Rollup Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB3125574-v4-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 7 SP1 July 2016 Rollup Update Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB3172605-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.Integrating WHD General Updates Packages...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if "%ImageInstallationType%" neq "Embedded" if exist "%Temp%\Updates\%UpdateType%\Client\*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 7 Client Updates Packages...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Client"
				)
			)

			if "%SelectedSourceOS%" equ "w81" (
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if exist "%Temp%\Updates\%UpdateType%\Upgrade\*.cab" (
					if "%ImageEdition%" equ "Core" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Windows 8.1 Upgradeable Editions Updates Packages...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "CoreSingleLanguage" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Windows 8.1 Upgradeable Editions Updates Packages...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "CoreCountrySpecific" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Windows 8.1 Upgradeable Editions Updates Packages...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "Professional" if not exist "%InstallMount%\%%i\Windows\Servicing\Packages\Microsoft-Windows-Security-SPP-Component-SKU-Professional-GVLK-Package*.mum" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Windows 8.1 Upgradeable Editions Updates Packages...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)
				)
			)
		)

		if "%UpdateType%" equ "Hotfix" (
			call :GetImageEdition "%InstallWim%", %%i

			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if exist "%Temp%\Updates\%UpdateType%\Ent_Ultimate\*.cab" (
				if "%ImageEdition%" equ "Enterprise" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 7 Enterprise Edition Updates Packages...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)

				if "%ImageEdition%" equ "Ultimate"  (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 7 Ultimate Edition Updates Packages...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)
			)

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if "%ImageInstallationType%" neq "Embedded" if exist "%Temp%\Updates\%UpdateType%\Client\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Windows 7 Client Updates Packages...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Client"
			)
		)

		if "%UpdateType%" equ "Security" (
			call :GetImageEdition "%InstallWim%", %%i >nul
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			:: Applying Anti Microsoft Telemetry Client Patches
			call :MountImageRegistry "%InstallMount%\%%i"
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\DiagTrack" /v "Start" /t REG_DWORD /d "4" /f >nul
			Reg delete "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener" /f >nul 2>&1
			Reg delete "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\AutoLogger\SQMLogger" /f >nul 2>&1
			Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f >nul 2>&1
			call :UnMountImageRegistry
		)

		if "%UpdateType%" equ "ESU" (
			set EsuFoundation=
			if "%ImageInstallationType%" equ "Client" set "EsuFoundation=windowsfoundation_31bf3856ad364e35"
			if "%ImageInstallationType%" equ "Embedded" set "EsuFoundation=windowsembe..dfoundation_31bf3856ad364e35"
			if "%ImageInstallationType:~,6%" equ "Server" set "EsuFoundation=windowsserverfoundation_31bf3856ad364e35"

			:: Applying Windows 7 Extended Security Update (ESU) Suppressor Patch
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Apply Windows 7 Extended Security Update ^(ESU^) Suppressor Patch...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%W7ESU%\ESU.tpk", %PackageIndex%, "%InstallMount%\%%i"

			call :MountImageRegistry "%InstallMount%\%%i"

			for /f "tokens=5 delims=\" %%a in ('reg query "HKLM\TK_COMPONENTS\DerivedData\Components" ^| findstr "%ImageArchitecture%_!EsuFoundation!"') do (set "EsuFoundation=%%a")

			if "%ImageArchitecture%" equ "x86" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D7838362C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "S256H" /t REG_BINARY /d "343B7E8DE2FE932E2FA1DB0CDFE69BB648BEE8E834B41728F1C83A12C1766ECB" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			if "%ImageArchitecture%" equ "x64" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D616D6436342C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "S256H" /t REG_BINARY /d "45D0AE442FD92CE32EE1DDC38EA3B875EAD9A53D6A17155A10FA9D9E16BEDEB2" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			call :UnMountImageRegistry

			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows 7 Servicing Stack Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB5006749-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows 7 Extended Security Updates Licensing Preparation Package..
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB4575903-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Security and Quality Rollup for .NET Framework 3.5.1 Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB4578952-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows 7 Security Monthly Quality Rollup Update Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB5006743-%ImageArchitecture%.cab"

			call :MountImageRegistry "%InstallMount%\%%i"

			if "%ImageArchitecture%" equ "x86" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_b26c9b4c15d241fc" /f >nul 2>&1
			)

			if "%ImageArchitecture%" equ "x64" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_0e8b36cfce2fb332" /f >nul 2>&1
			)

			call :UnMountImageRegistry
		)

		if "%UpdateType%" equ "NET35" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "WAT" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "Windows10" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

		if "%UpdateType%" equ "WinPE" (
			if "%IsBootImageSelected%" equ "Yes" (
				echo.-------------------------------------------------------------------------------
				echo.             Integrating Windows PE Updates to Boot.wim Image...
				echo.---------------------------------[Index : 2]-----------------------------------
				call :AddPackage "%BootMount%\2", "%Temp%\Updates\%UpdateType%"
			)

			if "%IsRecoveryImageSelected%" equ "Yes" (
				echo.-------------------------------------------------------------------------------
				echo.             Integrating Windows PE Updates to WinRE.wim Image...
				echo.---------------------------------[Index : 1]-----------------------------------
				call :AddPackage "%WinReMount%", "%Temp%\Updates\%UpdateType%"
			)
		)

		if "%UpdateType%" equ "WUSatisfy" (
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if exist "%Temp%\Updates\%UpdateType%\ProfessionalWMC\*.cab" (
				call :GetImageEdition "%InstallWim%", %%i >nul

				if "%ImageEdition%" equ "ProfessionalWMC" (
					echo.-------------------------------------------------------------------------------
					echo.Integrating Windows 8.1 Pro WMC Edition - Windows Update Satisfy Updates...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\ProfessionalWMC"
				)
			)
		)

		if "%UpdateType%" equ "ADLDS" (
			call :GetImageEdition "%InstallWim%", %%i

			for /d %%j in (Professional, Enterprise, Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

					echo.-------------------------------------------------------------------------------
					echo.Integrating Active Directory Lightweight Directory Services Updates Packages...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
				)
			)
		)

		if "%UpdateType%" equ "FMApi" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "Features" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

		if "%UpdateType%" equ "VirtualPC" (
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if "%IsW7SP1CRUSelected%" equ "No"  if exist "%Temp%\Updates\%UpdateType%\Updates\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.Integrating Microsoft Virtual PC Feature Updates...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
			)
		)

		if "%UpdateType%" equ "WorkFolders" (
			call :GetImageEdition "%InstallWim%", %%i

			for /d %%j in (Professional, Enterprise, Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

					if "%IsW7SP1CRUSelected%" equ "No" if exist "%Temp%\Updates\%UpdateType%\Updates\*.cab" (
						echo.-------------------------------------------------------------------------------
						echo.Integrating Microsoft Work Folders Feature Updates...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
					)
				)
			)
		)
	)
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	if "%UpdateType%" equ "General" echo.Generating WHD General Updates Integration LOG File...
	if "%UpdateType%" equ "Hotfix" echo.Generating WHD Hotfix Updates Integration LOG File...
	if "%UpdateType%" equ "Security" echo.Generating WHD Security Updates Integration LOG File...
	if "%UpdateType%" equ "ESU" echo.Generating WHD Extended Security Updates Integration LOG File...
	if "%UpdateType%" equ "NET35" echo.Generating Microsoft .NET Framework 3.5 Updates Integration LOG File...
	if "%UpdateType%" equ "WAT" echo.Generating Windows Activation Technologies Integration ^(WAT^) LOG File...
	if "%UpdateType%" equ "Windows10" echo.Generating Windows 10 Upgrade Preparation Updates Integration LOG File...
	if "%UpdateType%" equ "WinPE" echo.Generating Windows PE Updates Integration LOG File...
	if "%UpdateType%" equ "WUSatisfy" echo.Generating Windows Update Satisfy Updates Integration LOG File...
	if "%UpdateType%" equ "ADLDS" echo.Generating Active Directory Lightweight Directory Services Integration LOG File...
	if "%UpdateType%" equ "FMApi" echo.Generating File Management API Integration LOG File...
	if "%UpdateType%" equ "Features" echo.Generating Windows Features Packages Integration LOG File...
	if "%UpdateType%" equ "VirtualPC" echo.Generating Microsoft Virtual PC Feature Integration LOG File...
	if "%UpdateType%" equ "WorkFolders" echo.Generating Work Folders Integration LOG File...
	echo.-------------------------------------------------------------------------------
	echo.
	if "%UpdateType%" equ "General" echo.Writing WHD General Updates Integration Log file.
	if "%UpdateType%" equ "Hotfix" echo.Writing WHD Hotfix Updates Integration Log file.
	if "%UpdateType%" equ "Security" echo.Writing WHD Security Updates Integration Log file.
	if "%UpdateType%" equ "ESU" echo.Writing WHD Extended Security Updates Integration Log file.
	if "%UpdateType%" equ "NET35" echo.Writing Microsoft .NET Framework 3.5 Updates Integration Log file.
	if "%UpdateType%" equ "WAT" echo.Writing Windows Activation Technologies Integration Log file.
	if "%UpdateType%" equ "Windows10" echo.Writing Windows 10 Upgrade Preparation Updates Integration Log file.
	if "%UpdateType%" equ "WinPE" echo.Writing Windows PE Updates Integration Log file.
	if "%UpdateType%" equ "WUSatisfy" echo.Writing Windows Update Satisfy Updates Integration Log file.
	if "%UpdateType%" equ "ADLDS" echo.Writing Active Directory Lightweight Directory Services Integration Log file.
	if "%UpdateType%" equ "FMApi" echo.Writing File Management API Integration Log file.
	if "%UpdateType%" equ "Features" echo.Writing Windows Features Packages Integration Log file.
	if "%UpdateType%" equ "VirtualPC" echo.Writing Microsoft Virtual PC Feature Integration Log file.
	if "%UpdateType%" equ "WorkFolders" echo.Writing Work Folders Integration Log file.

	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" call :GetPackages "%InstallMount%\%%i", "Updates-%%i.txt"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.Cleaning Up Temporary Files ^& Folders...
echo.-------------------------------------------------------------------------------
echo.
:: Cleaning Up WHD Updates Temporary folder...
if "%UpdateType%" equ "General" echo.Cleaning Up WHD General Updates Temporary folder.
if "%UpdateType%" equ "Hotfix" echo.Cleaning Up WHD Hotfix Updates Temporary folder.
if "%UpdateType%" equ "Security" echo.Cleaning Up WHD Security Updates Temporary folder.
if "%UpdateType%" equ "ESU" echo.Cleaning Up WHD Extended Security Updates Temporary folder.
if "%UpdateType%" equ "NET35" echo.Cleaning Up Microsoft .NET Framework 3.5 Updates Temporary folder.
if "%UpdateType%" equ "WAT" echo.Cleaning Up Windows Activation Technologies Temporary folder.
if "%UpdateType%" equ "Windows10" echo.Cleaning Up Windows 10 Upgrade Preparation Updates Temporary folder.
if "%UpdateType%" equ "WinPE" echo.Cleaning Up Windows PE Updates Temporary folder.
if "%UpdateType%" equ "WUSatisfy" echo.Cleaning Up Windows Update Satisfy Updates Temporary folder.
if "%UpdateType%" equ "ADLDS" echo.Cleaning Up Active Directory Lightweight Directory Services Temporary folder.
if "%UpdateType%" equ "FMApi" echo.Cleaning Up File Management API Temporary folder.
if "%UpdateType%" equ "Features" echo.Cleaning Up Windows Features Updates Temporary folder.
if "%UpdateType%" equ "VirtualPC" echo.Cleaning Up Microsoft Virtual PC Feature Temporary folder.
if "%UpdateType%" equ "WorkFolders" echo.Cleaning Up Sync Agent for Domain Environmernts Temporary folder.

call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "General" echo.####Finished Integrating WHD General Updates###################################
if "%UpdateType%" equ "Hotfix" echo.####Finished Integrating WHD Hotfix Updates####################################
if "%UpdateType%" equ "Security" echo.####Finished Integrating WHD Security Updates##################################
if "%UpdateType%" equ "ESU" echo.####Finished Integrating WHD Extended Security Updates#########################
if "%UpdateType%" equ "NET35" echo.####Finished Integrating Microsoft .NET Framework 3.5 Updates##################
if "%UpdateType%" equ "WAT" echo.####Finished Integrating Windows Activation Technologies ^(WAT^) ################
if "%UpdateType%" equ "Windows10" echo.####Finished Windows 10 Upgrade Preparation Updates############################
if "%UpdateType%" equ "WinPE" echo.####Finished Integrating Windows PE Updates####################################
if "%UpdateType%" equ "WUSatisfy" echo.####Finished Integrating Windows Update Satisfy Updates########################
if "%UpdateType%" equ "ADLDS" echo.####Finished Integrating Active Directory Lightweight Directory Service Feature
if "%UpdateType%" equ "FMApi" echo.####Finished Integrating File Management API Feature###########################
if "%UpdateType%" equ "Features" echo.####Finished Integrating Windows Features Updates##############################
if "%UpdateType%" equ "VirtualPC" echo.####Finished Integrating Microsoft Virtual PC Feature##########################
if "%UpdateType%" equ "WorkFolders" echo.####Finished Integrating Sync Agent for Domain Environmernts ^(Work Folders^)####
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set IsW7SP1CRUSelected=
set Updates=
set UpdateType=

endlocal

:: Reading Updated Image Information
call :GetUpdatedImageInformation >nul

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Setup Media Updates
::-------------------------------------------------------------------------------------------
:IntWindowsSetupMediaUpdates

setlocal

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Update Windows Setup Media
echo.===============================================================================
echo.

if "%IsBootImageSelected%" equ "No" (
   echo.Windows Setup Boot Image is not selected...
   echo.
   echo.Please Choose Windows Setup Boot Image while selecting Source...
   echo.
   pause>nul|set /p=Press any key to continue...
   goto :IntWHDUpdatesMenu
)

echo.-------------------------------------------------------------------------------
echo.####Starting Updating Windows Setup Media######################################
echo.-------------------------------------------------------------------------------
echo.
echo.Getting Windows Setup Media Language Settings...
echo.
for /f "tokens=1 delims= " %%a in ('%DISM% /Get-WimInfo /WimFile:"%BootWim%" /Index:2 ^| findstr /i "Default"') do (set "ImageDefaultLanguage=%%a")
set "ImageDefaultLanguage=!ImageDefaultLanguage:~1!"
echo.Found Windows Setup Media Language : [%ImageDefaultLanguage%]
echo.
echo.Copying Windows Setup Media Update files to ^<DVD^> folder...

:: Creating Directory Structures
call :CreateFolder "%DVD%"
call :CreateFolder "%DVD%\boot"
call :CreateFolder "%DVD%\efi"
call :CreateFolder "%DVD%\sources"
call :CreateFolder "%DVD%\boot\%ImageDefaultLanguage%"
call :CreateFolder "%DVD%\boot\fonts"
call :CreateFolder "%DVD%\boot\resources"
call :CreateFolder "%DVD%\efi\boot"
call :CreateFolder "%DVD%\efi\microsoft"
call :CreateFolder "%DVD%\efi\microsoft\boot"
call :CreateFolder "%DVD%\efi\microsoft\boot\fonts"
call :CreateFolder "%DVD%\efi\microsoft\boot\resources"
call :CreateFolder "%DVD%\sources\%ImageDefaultLanguage%"
call :CreateFolder "%DVD%\sources\inf"

Copy /Y "%BootMount%\2\Windows\Boot\PCAT\bootmgr" "%DVD%\bootmgr" >nul
Copy /Y "%BootMount%\2\Windows\Boot\EFI\bootmgr.efi" "%DVD%\bootmgr.efi" >nul
Copy /Y "%BootMount%\2\setup.exe" "%DVD%\setup.exe" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\bcd" "%DVD%\boot\bcd" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\boot.sdi" "%DVD%\boot\boot.sdi" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\%ImageDefaultLanguage%\bootfix.bin" "%DVD%\boot\bootfix.bin" >nul
Copy /Y "%BootMount%\2\Windows\System32\bootsect.exe" "%DVD%\boot\bootsect.exe" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\etfsboot.com" "%DVD%\boot\etfsboot.com" >nul
Copy /Y "%BootMount%\2\Windows\Boot\PCAT\memtest.exe" "%DVD%\boot\memtest.exe" >nul
Copy /Y "%BootMount%\2\Windows\System32\%ImageDefaultLanguage%\bootsect.exe.mui" "%DVD%\boot\%ImageDefaultLanguage%\bootsect.exe.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\wgl4_boot.ttf" "%DVD%\boot\fonts\wgl4_boot.ttf" >nul
Copy /Y "%BootMount%\2\Windows\Boot\Resources\bootres.dll" "%DVD%\boot\resources\bootres.dll" >nul
rem "%DVD%\efi\boot\bootia32.efi" >nul
rem "%DVD%\efi\microsoft\boot\cdboot.efi" >nul
rem "%DVD%\efi\microsoft\boot\cdboot_noprompt.efi" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\EFI\%ImageDefaultLanguage%\efisys.bin" "%DVD%\efi\microsoft\boot\efisys.bin" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\EFI\%ImageDefaultLanguage%\efisys_noprompt.bin" "%DVD%\efi\microsoft\boot\efisys_noprompt.bin" >nul
Copy /Y "%BootMount%\2\Windows\Boot\EFI\memtest.efi" "%DVD%\efi\microsoft\boot\memtest.efi" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Boot\Fonts\wgl4_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\wgl4_boot.ttf" >nul
rem "%DVD%\efi\microsoft\boot\resources\bootres.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\apppatch\acres.dll" "%DVD%\sources\acres.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\actionqueue.dll" "%DVD%\sources\actionqueue.dll" >nul
rem "%DVD%\sources\adfscomp.dll" >nul
rem "%DVD%\sources\admtv3check.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\aeinv.dll" "%DVD%\sources\aeinv.dll" >nul
rem "%DVD%\sources\alert.gif" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l2-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l2-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l2-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l2-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l3-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l3-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l4-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l4-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-kernel32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-kernel32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-kernel32-l2-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-kernel32-l2-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-ole32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-ole32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-ole32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-ole32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-shlwapi-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-shlwapi-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-shlwapi-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-shlwapi-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-user32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-user32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-user32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-user32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-version-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-version-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\appcompat.xsl" "%DVD%\sources\appcompat.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_bidi.xsl" "%DVD%\sources\appcompat_bidi.xsl" >nul
rem "%DVD%\sources\appcompat_detailed.xsl" >nul
rem "%DVD%\sources\appcompat_detailed_bidi.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_detailed_bidi_txt.xsl" "%DVD%\sources\appcompat_detailed_bidi_txt.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_detailed_txt.xsl" "%DVD%\sources\appcompat_detailed_txt.xsl" >nul
Copy /Y "%BootMount%\2\sources\arunimg.dll" "%DVD%\sources\arunimg.dll" >nul
Copy /Y "%BootMount%\2\sources\arunres.dll" "%DVD%\sources\arunres.dll" >nul
Copy /Y "%BootMount%\2\sources\autorun.dll" "%DVD%\sources\autorun.dll" >nul
rem "%DVD%\sources\background_cli.bmp" >nul
rem "%DVD%\sources\cdplib.mof" >nul
rem "%DVD%\sources\cdplibuninstall.mof" >nul
rem "%DVD%\sources\clustercompliance.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\cmi2migxml.dll" "%DVD%\sources\cmi2migxml.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\cmifw.dll" "%DVD%\sources\cmifw.dll" >nul
Copy /Y "%BootMount%\2\sources\cmisetup.dll" "%DVD%\sources\cmisetup.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\compatctrl.dll" "%DVD%\sources\compatctrl.dll" >nul
Copy /Y "%BootMount%\2\sources\compatprovider.dll" "%DVD%\sources\compatprovider.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\compatresources.dll" "%DVD%\sources\compatresources.dll" >nul
Copy /Y "%BootMount%\2\sources\compliance.ini" "%DVD%\sources\compliance.ini" >nul
rem "%DVD%\sources\compres.dll" >nul
Copy /Y "%BootMount%\2\sources\cryptosetup.dll" "%DVD%\sources\cryptosetup.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\csiagent.dll" "%DVD%\sources\csiagent.dll" >nul
rem "%DVD%\sources\cversion.ini" >nul
rem "%DVD%\sources\db_msftproductionwindowssigningca.cer" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\devinv.dll" "%DVD%\sources\devinv.dll" >nul
Copy /Y "%BootMount%\2\sources\diager.dll" "%DVD%\sources\diager.dll" >nul
Copy /Y "%BootMount%\2\sources\diagnostic.dll" "%DVD%\sources\diagnostic.dll" >nul
Copy /Y "%BootMount%\2\sources\dism.exe" "%DVD%\sources\dism.exe" >nul
Copy /Y "%BootMount%\2\Windows\System32\dismapi.dll" "%DVD%\sources\dismapi.dll" >nul
Copy /Y "%BootMount%\2\sources\dismcore.dll" "%DVD%\sources\dismcore.dll" >nul
Copy /Y "%BootMount%\2\sources\dismcoreps.dll" "%DVD%\sources\dismcoreps.dll" >nul
Copy /Y "%BootMount%\2\sources\dismprov.dll" "%DVD%\sources\dismprov.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\apppatch\drvmain.sdb" "%DVD%\sources\drvmain.sdb" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\drvmain32.sdb" "%DVD%\sources\drvmain32.sdb" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\drvmain64.sdb" "%DVD%\sources\drvmain64.sdb" >nul
rem "%DVD%\sources\drvmainarm.sdb" >nul
Copy /Y "%BootMount%\2\sources\drvmgrtn.dll" "%DVD%\sources\drvmgrtn.dll" >nul
Copy /Y "%BootMount%\2\sources\du.dll" "%DVD%\sources\du.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\WinSxS\x86_microsoft-windows-servicingstack-net_31bf3856ad364e35_6.3.9600.17031_none_d358249e46914d92\firewallofflineapi.dll" "%DVD%\sources\firewallofflineapi.dll" >nul
Copy /Y "%BootMount%\2\sources\folderprovider.dll" "%DVD%\sources\folderprovider.dll" >nul
rem "%DVD%\sources\fveupg.dll" >nul
Copy /Y "%BootMount%\2\sources\hwcompat.dll" "%DVD%\sources\hwcompat.dll" >nul
Copy /Y "%BootMount%\2\sources\hwcompat.txt" "%DVD%\sources\hwcompat.txt" >nul
rem "%DVD%\sources\hwcompatPE.txt" >nul
Copy /Y "%BootMount%\2\sources\hwexclude.txt" "%DVD%\sources\hwexclude.txt" >nul
rem "%DVD%\sources\hwexcludePE.txt" >nul
rem "%DVD%\sources\hypervcomplcheck.dll" >nul
Copy /Y "%BootMount%\2\sources\idwbinfo.txt" "%DVD%\sources\idwbinfo.txt" >nul
rem "%DVD%\sources\iiscomp.dll" >nul
Copy /Y "%BootMount%\2\sources\imagingprovider.dll" "%DVD%\sources\imagingprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\input.dll" "%DVD%\sources\input.dll" >nul
rem "%DVD%\sources\install.exe" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\oobe\installeventres.dll" "%DVD%\sources\installeventres.dll" >nul
rem "%DVD%\sources\installprep.exe" >nul
rem "%DVD%\sources\itgtupg.dll" >nul
Copy /Y "%BootMount%\2\sources\lang.ini" "%DVD%\sources\lang.ini" >nul
Copy /Y "%BootMount%\2\sources\locale.nls" "%DVD%\sources\locale.nls" >nul
Copy /Y "%BootMount%\2\sources\logprovider.dll" "%DVD%\sources\logprovider.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\luainstall.dll" "%DVD%\sources\luainstall.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\migapp.xml" "%DVD%\sources\migapp.xml" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\migcore.dll" "%DVD%\sources\migcore.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\mighost.exe" "%DVD%\sources\mighost.exe" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migisol.dll" "%DVD%\sources\migisol.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\migres.dll" "%DVD%\sources\migres.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\migstore.dll" "%DVD%\sources\migstore.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\migsys.dll" "%DVD%\sources\migsys.dll" >nul
rem "%DVD%\sources\migtestplugin.dll" >nul
Copy /Y "%BootMount%\2\sources\msxml6.dll" "%DVD%\sources\msxml6.dll" >nul
Copy /Y "%BootMount%\2\sources\msxml6r.dll" "%DVD%\sources\msxml6r.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\mxeagent.dll" "%DVD%\sources\mxeagent.dll" >nul
Copy /Y "%BootMount%\2\sources\ndiscompl.dll" "%DVD%\sources\ndiscompl.dll" >nul
Copy /Y "%BootMount%\2\sources\nlsbres.dll" "%DVD%\sources\nlsbres.dll" >nul
Copy /Y "%BootMount%\2\sources\ntdsupg.dll" "%DVD%\sources\ntdsupg.dll" >nul
rem "%DVD%\sources\ntfrsupg.dll" >nul
rem "%DVD%\sources\nxquery.cat" >nul
rem "%DVD%\sources\nxquery.inf" >nul
rem "%DVD%\sources\nxquery.sys" >nul
Copy /Y "%BootMount%\2\sources\offline.xml" "%DVD%\sources\offline.xml" >nul
rem "%DVD%\sources\oscomps.woa.xml" >nul
rem "%DVD%\sources\oscomps.xml" >nul
rem "%DVD%\sources\osfilter.inf" >nul
rem "%DVD%\sources\outofbox_windows_db.bin" >nul
Copy /Y "%BootMount%\2\sources\pnpibs.dll" "%DVD%\sources\pnpibs.dll" >nul
rem "%DVD%\sources\postrollback.exe" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\queryappblock.exe" "%DVD%\sources\queryappblock.exe" >nul
rem "%DVD%\sources\quirks.ait" >nul
rem "%DVD%\sources\rdsupgcheck.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\PolicyDefinitions\reagent.admx" "%DVD%\sources\reagent.admx" >nul
Copy /Y "%BootMount%\2\sources\reagent.dll" "%DVD%\sources\reagent.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\Recovery\reagent.xml" "%DVD%\sources\reagent.xml" >nul
rem "%DVD%\sources\reportgen.dll" >nul
rem "%DVD%\sources\rmsupg.dll" >nul
Copy /Y "%BootMount%\2\sources\rollback.exe" "%DVD%\sources\rollback.exe" >nul
Copy /Y "%BootMount%\2\sources\schema.dat" "%DVD%\sources\schema.dat" >nul
Copy /Y "%BootMount%\2\sources\sdbapiu.dll" "%DVD%\sources\sdbapiu.dll" >nul
Copy /Y "%BootMount%\2\sources\segoeui.ttf" "%DVD%\sources\segoeui.ttf" >nul
Copy /Y "%BootMount%\2\sources\setup.exe" "%DVD%\sources\setup.exe" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\setupcompat.dll" "%DVD%\sources\setupcompat.dll" >nul
rem "%DVD%\sources\setuperror.exe" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.cfg" "%DVD%\sources\setupplatform.cfg" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.dll" "%DVD%\sources\setupplatform.dll" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.exe" "%DVD%\sources\setupplatform.exe" >nul
rem "%DVD%\sources\setupresume.exe" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sfcn.dat" "%DVD%\sources\sfcn.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflcid.dat" "%DVD%\sources\sflcid.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflistw7.dat" "%DVD%\sources\sflistw7.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflistw8.dat" "%DVD%\sources\sflistw8.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflistw8.woa.dat" "%DVD%\sources\sflistw8.woa.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflistwb.dat" "%DVD%\sources\sflistwb.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sflistwb.woa.dat" "%DVD%\sources\sflistwb.woa.dat" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sfpat.inf" "%DVD%\sources\sfpat.inf" >nul
rem "%DVD%\sources\sfpatpg.inf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sfpatw7.inf" "%DVD%\sources\sfpatw7.inf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sfpatw8.inf" "%DVD%\sources\sfpatw8.inf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\sfpatwb.inf" "%DVD%\sources\sfpatwb.inf" >nul
Copy /Y "%BootMount%\2\sources\smiengine.dll" "%DVD%\sources\smiengine.dll" >nul
Copy /Y "%BootMount%\2\sources\spflvrnt.dll" "%DVD%\sources\spflvrnt.dll" >nul
Copy /Y "%BootMount%\2\sources\spprgrss.dll" "%DVD%\sources\spprgrss.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizeng.dll" "%DVD%\sources\spwizeng.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizimg.dll" "%DVD%\sources\spwizimg.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizres.dll" "%DVD%\sources\spwizres.dll" >nul
Copy /Y "%BootMount%\2\sources\sqmapi.dll" "%DVD%\sources\sqmapi.dll" >nul
Copy /Y "%BootMount%\2\sources\ssshim.dll" "%DVD%\sources\ssshim.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\apppatch\sysmain.sdb" "%DVD%\sources\sysmain.sdb" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\sysmain32.sdb" "%DVD%\sources\sysmain32.sdb" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\sysmain64.sdb" "%DVD%\sources\sysmain64.sdb" >nul
rem "%DVD%\sources\telemetry.xsd" >nul
rem "%DVD%\sources\uddicomp.dll" >nul
Copy /Y "%BootMount%\2\sources\unattend.dll" "%DVD%\sources\unattend.dll" >nul
Copy /Y "%BootMount%\2\sources\unbcl.dll" "%DVD%\sources\unbcl.dll" >nul
rem "%DVD%\sources\upgcompat.inf" >nul" >nul
rem "%DVD%\sources\upgdriver.dll" >nul" >nul
Copy /Y "%BootMount%\2\sources\upgloader.dll" "%DVD%\sources\upgloader.dll" >nul
rem "%DVD%\sources\upgradeagent.dll" >nul
rem "%DVD%\sources\upgradeagent.xml" >nul
rem "%DVD%\sources\upgrade_bulk.xml" >nul
rem "%DVD%\sources\upgrade_data.xml" >nul
Copy /Y "%BootMount%\2\sources\upgrade_frmwrk.xml" "%DVD%\sources\upgrade_frmwrk.xml" >nul
Copy /Y "%BootMount%\2\sources\upgreport.dll" "%DVD%\sources\upgreport.dll" >nul
rem "%DVD%\sources\upgwow_bulk.xml" >nul
Copy /Y "%BootMount%\2\sources\uxlib.dll" "%DVD%\sources\uxlib.dll" >nul
Copy /Y "%BootMount%\2\sources\uxlibres.dll" "%DVD%\sources\uxlibres.dll" >nul
Copy /Y "%BootMount%\2\sources\vhdprovider.dll" "%DVD%\sources\vhdprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\w32uiimg.dll" "%DVD%\sources\w32uiimg.dll" >nul
Copy /Y "%BootMount%\2\sources\w32uires.dll" "%DVD%\sources\w32uires.dll" >nul
Copy /Y "%BootMount%\2\sources\warning.gif" "%DVD%\sources\warning.gif" >nul
Copy /Y "%BootMount%\2\sources\wdsclient.dll" "%DVD%\sources\wdsclient.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsclientapi.dll" "%DVD%\sources\wdsclientapi.dll" >nul
Copy /Y "%BootMount%\2\sources\wdscore.dll" "%DVD%\sources\wdscore.dll" >nul
Copy /Y "%BootMount%\2\sources\wdscsl.dll" "%DVD%\sources\wdscsl.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsimage.dll" "%DVD%\sources\wdsimage.dll" >nul
Copy /Y "%BootMount%\2\sources\wdstptc.dll" "%DVD%\sources\wdstptc.dll" >nul
rem "%DVD%\sources\wdsupgcompl.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsutil.dll" "%DVD%\sources\wdsutil.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\wica.dll" "%DVD%\sources\wica.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\wica.ini" "%DVD%\sources\wica.ini" >nul
rem "%DVD%\sources\wicadevicefilters.xml" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\CompatTel\wicainventory.exe" "%DVD%\sources\wicainventory.exe" >nul
rem "%DVD%\sources\wicatel.dll" >nul
Copy /Y "%BootMount%\2\sources\wimprovider.dll" "%DVD%\sources\wimprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\win32ui.dll" "%DVD%\sources\win32ui.dll" >nul
Copy /Y "%BootMount%\2\sources\winsetup.dll" "%DVD%\sources\winsetup.dll" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\apppatch\%ImageDefaultLanguage%\acres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\acres.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\%ImageDefaultLanguage%\actionqueue.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\actionqueue.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\arunres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\arunres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\cmisetup.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\cmisetup.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compatctrl.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\compatprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\compatprovider.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compatresources.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compres.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\Help\%ImageDefaultLanguage%\credits.rtf" "%DVD%\sources\%ImageDefaultLanguage%\credits.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dism.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\dism.exe.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\%ImageDefaultLanguage%\dismapi.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismapi.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dismcore.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismcore.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dismprov.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismprov.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\%ImageDefaultLanguage%\erofflps.txt" "%DVD%\sources\%ImageDefaultLanguage%\erofflps.txt" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\folderprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\folderprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\imagingprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\imagingprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\input.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\input.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\install.exe.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\oobe\%ImageDefaultLanguage%\installeventres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\installeventres.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\installprep.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\logprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\logprovider.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\%ImageDefaultLanguage%\migcore.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\migcore.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\migwiz\%ImageDefaultLanguage%\migres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\migres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\msxml6r.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\msxml6r.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\nlsbres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\nlsbres.dll.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\oobe\%ImageDefaultLanguage%\oobe_help_opt_in_details.rtf" "%DVD%\sources\%ImageDefaultLanguage%\oobe_help_opt_in_details.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\pnpibs.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\pnpibs.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\postrollback.exe.mui" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\oobe\%ImageDefaultLanguage%\privacy.rtf" "%DVD%\sources\%ImageDefaultLanguage%\privacy.rtf" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\PolicyDefinitions\%ImageDefaultLanguage%\reagent.adml" "%DVD%\sources\%ImageDefaultLanguage%\reagent.adml" >nul
Copy /Y "%InstallMount%\%DefaultIndexNo%\Windows\System32\%ImageDefaultLanguage%\reagent.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\reagent.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\rollback.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\rollback.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\setup.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupcompat.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setuperror.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupplatform.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupresume.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" "%DVD%\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setup_help_whattokeep.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\smiengine.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\smiengine.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\spwizres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\spwizres.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgdriver.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\upgloader.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\upgloader.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgreport.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vofflps.rtf" "%DVD%\sources\%ImageDefaultLanguage%\vofflps.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\w32uires.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\w32uires.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\winsetup.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\winsetup.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\inf\setup.cfg" "%DVD%\sources\inf\setup.cfg" >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Updating Windows Setup Media######################################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Microsoft Default Inbox Apps Menu
::-------------------------------------------------------------------------------------------
:IntInboxAppsMenu

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Microsoft Default Inbox Apps Menu
echo.===============================================================================
echo.
echo.  [1]   Select Windows Apps
echo.
echo.  [2]   Start Integrating Windows Apps
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:12X /N /M "Enter Your Choice : "
if errorlevel 3 goto :IntegrateMenu
if errorlevel 2 goto :IntInboxApps
if errorlevel 1 goto :SelectInboxAppsMenu

:SelectInboxAppsMenu
cls
echo.===============================================================================
echo.         MSMG ToolKit - Integrate Microsoft Default Inbox Apps Menu
echo.===============================================================================
:: Integrate Windows 8.1 Default Inbox Apps Menu
if "%SelectedSourceOS%" equ "w81" (
	echo.  [ 1] %I_Alarms% Alarms ^& Clock
	echo.  [ 2] %I_Calculator% Calculator
	echo.  [ 3] %I_CommunicationsApps% Calender, Mail ^& People
	echo.  [ 4] %I_BingFinance% Bing Finance
	echo.  [ 5] %I_BingFoodDrink% Bing Food ^& Drink
	echo.  [ 6] %I_BingHealthFitness% Bing Health ^& Fitness
	echo.  [ 7] %I_BingMaps% Bing Maps
	echo.  [ 8] %I_BingNews% Bing News
	echo.  [ 9] %I_BingSports% Bing Sports
	echo.  [10] %I_BingTravel% Bing Travel
	echo.  [11] %I_BingWeather% Bing Weather
	echo.  [12] %I_HelpAndTips% Help ^& Tips
	echo.  [13] %I_OfficeOneNote% Office OneNote
	echo.  [14] %I_Reader% Reader
	echo.  [15] %I_ReadingList% Reading List
	echo.  [16] %I_Scan% Scan
	echo.  [17] %I_SkypeApp% Skype
	echo.  [18] %I_SoundRecorder% Sound Recorder
	echo.  [19] %I_XboxLiveGames% Xbox LIVE Games
	echo.  [20] %I_ZuneMusic% Zune Music
	echo.  [21] %I_ZuneVideo% Zune Video
	echo.
	echo.  [A]    All Windows Apps
	echo.  [X]    Go Back
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_BingFinance%" equ "+" ( set "I_BingFinance=-" ) else ( set "I_BingFinance=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_BingFoodDrink%" equ "+" ( set "I_BingFoodDrink=-" ) else ( set "I_BingFoodDrink=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_BingHealthFitness%" equ "+" ( set "I_BingHealthFitness=-" ) else ( set "I_BingHealthFitness=+" ) )
	if "!MenuChoice!" equ "7" ( if "%I_BingMaps%" equ "+" ( set "I_BingMaps=-" ) else ( set "I_BingMaps=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "9" ( if "%I_BingSports%" equ "+" ( set "I_BingSports=-" ) else ( set "I_BingSports=+" ) )
	if "!MenuChoice!" equ "10" ( if "%I_BingTravel%" equ "+" ( set "I_BingTravel=-" ) else ( set "I_BingTravel=+" ) )
	if "!MenuChoice!" equ "11" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "12" ( if "%I_HelpAndTips%" equ "+" ( set "I_HelpAndTips=-" ) else ( set "I_HelpAndTips=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_OfficeOneNote%" equ "+" ( set "I_OfficeOneNote=-" ) else ( set "I_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "14" ( if "%I_Reader%" equ "+" ( set "I_Reader=-" ) else ( set "I_Reader=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_ReadingList%" equ "+" ( set "I_ReadingList=-" ) else ( set "I_ReadingList=+" ) )
	if "!MenuChoice!" equ "16" ( if "%I_Scan%" equ "+" ( set "I_Scan=-" ) else ( set "I_Scan=+" ) )
	if "!MenuChoice!" equ "17" ( if "%I_SkypeApp%" equ "+" ( set "I_SkypeApp=-" ) else ( set "I_SkypeApp=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "19" ( if "%I_XboxLiveGames%" equ "+" ( set "I_XboxLiveGames=-" ) else ( set "I_XboxLiveGames=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_Alarms=+"
		set "I_Calculator=+"
		set "I_CommunicationsApps=+"
		set "I_BingFinance=+"
		set "I_BingFoodDrink=+"
		set "I_BingHealthFitness=+"
		set "I_BingMaps=+"
		set "I_BingNews=+"
		set "I_BingSports=+"
		set "I_BingTravel=+"
		set "I_BingWeather=+"
		set "I_HelpAndTips=+"
		set "I_OfficeOneNote=+"
		set "I_Reader=+"
		set "I_ReadingList=+"
		set "I_Scan=+"
		set "I_SkypeApp=+"
		set "I_SoundRecorder=+"
		set "I_XboxLiveGames=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: Integrate Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Server 2022 Default Inbox Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" (
  	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [ 1] %I_3DViewer% 3D Viewer ^(Microsoft.Microsoft3DViewer^)
  	echo.  [ 2] %I_Alarms% Alarms ^& Clock ^(Microsoft.WindowsAlarms^)
  	echo.  [ 3] %I_DesktopAppInstaller% App Installer ^(Microsoft.DesktopAppInstaller^)
  	echo.  [ 4] %I_AV1VideoExtension% AV1 Video Extension ^(Microsoft.AV1VideoExtension^)
	echo.  [ 5] %I_BingSearch% Bing Search ^(Microsoft.BingSearch^)
	echo.  [ 6] %I_Calculator% Calculator ^(Microsoft.WindowsCalculator^)
  	echo.  [ 7] %I_Camera% Camera ^(Microsoft.WindowsCamera^)
	echo.  [ 8] %I_Clipchamp% Clipchamp - Video Editor ^(Clipchamp.Clipchamp^)
  	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [ 9] %I_Cortana% Cortana ^(Microsoft.549981C3F5F10^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [10] %I_DirectXRuntime% DirectX ^(Microsoft.DirectXRuntime^)
	if "%ImageArchitecture%" neq "x86" echo.  [11] %I_DolbyAudioExtensions% Dolby Audio Extensions ^(Microsoft.DolbyAudioExtensions^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" if "%ImageArchitecture%" neq "x86" echo.  [12] %I_Family% Family ^(MicrosoftCorporationII.MicrosoftFamily^)
	echo.  [13] %I_FeedbackHub% Feedback Hub ^(Microsoft.WindowsFeedbackHub^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [14] %I_ZuneVideo% Films ^& TV ^(Microsoft.ZuneVideo^)
  	echo.  [15] %I_GetHelp% Get Help ^(Microsoft.GetHelp^)
  	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [16] %I_ZuneMusic% Groove Music ^(Microsoft.ZuneMusic^)
  	echo.  [17] %I_HEIFImageExtension% HEIF Image Extensions ^(Microsoft.HEIFImageExtension^)
	echo.  [18] %I_HEVCVideoExtension% HEVC Video Extensions ^(Microsoft.HEVCVideoExtension^)
  	echo.  [19] %I_CommunicationsApps% Mail and Calendar ^(Microsoft.WindowsCommunicationsApps^)
  	echo.  [20] %I_Maps% Maps ^(Microsoft.WindowsMaps^)
  	echo.  [21] %I_Messaging% Messaging ^(Microsoft.Messaging^)
  	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [22] %I_MicrosoftDefender% Microsoft Defender ^(Microsoft.6365217CE6EB4^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [23] %I_Journal% Microsoft Journal ^(Microsoft.MicrosoftJournal^)
  	echo.  [24] %I_Wallet% Microsoft Pay ^(Microsoft.Wallet^)
  	echo.  [25] %I_SolitaireCollection% Microsoft Solitaire Collection ^(Microsoft.MicrosoftSolitaireCollection^)
	echo.  [26] %I_WindowsStore% Microsoft Store ^(Microsoft.WindowsStore^)
  	echo.  [27] %I_Todos% Microsoft To Do ^(Microsoft.Todos^)
	echo.  [28] %I_Whiteboard% Microsoft Whiteboard ^(Microsoft.Whiteboard^)
  	echo.  [29] %I_MinecraftEducationEdition% Minecraft Education ^(Microsoft.MinecraftEducationEdition^)
	if "%ImageArchitecture%" equ "x64" echo.  [30] %I_MixedRealityPortal% Mixed Reality Portal ^(Microsoft.MixedReality.Portal^)
  	if "%ImageBuild%" equ "17763" echo.  [31] %I_3DViewer% Mixed Reality Viewer ^(Microsoft.Microsoft3DViewer^)
	echo.  [32] %I_MPEG2VideoExtension% MPEG-2 Video Extension ^(Microsoft.MPEG2VideoExtension^)
	echo.  [33] %I_OneConnect% Mobile Plans ^(Microsoft.OneConnect^)
  	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [34] %I_ZuneVideo% Movies ^& TV ^(Microsoft.ZuneVideo^)
  	if "%ImageBuild%" equ "17763" echo.  [35] %I_OfficeHub% My Office ^(Microsoft.MicrosoftOfficeHub^)
	echo.  [36] %I_BingNews% News ^(Microsoft.BingNews^)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [37] %I_OfficeHub% Office ^(Microsoft.MicrosoftOfficeHub^)
	echo.  [38] %I_OfficeOneNote% OneNote ^(Microsoft.Office.OneNote^)
  	echo.  [39] %I_D3DMappingLayers% OpenGL ^& OpenCL Compatibility Pack ^(Microsoft.D3DMappingLayers^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [40] %I_OutlookForWindows% Outlook for Windows ^(Microsoft.OutlookForWindows^)
	echo.  [41] %I_Paint3D% Paint 3D ^(Microsoft.MSPaint^)
  	echo.  [42] %I_People% People ^(Microsoft.People^)
  	echo.  [43] %I_Photos% Photos ^(Microsoft.Windows.Photos^)
	echo.  [44] %I_PowerAutomateDesktop% Power Automate ^(Microsoft.PowerAutomateDesktop^)
	echo.  [45] %I_MicrosoftPowerBI% Power BI ^(Microsoft.MicrosoftPowerBIForWindows^)
  	echo.  [46] %I_Print3D% Print 3D ^(Microsoft.Print3D^)
  	echo.  [47] %I_QuickAssist% Quick Assist ^(MicrosoftCorporationII.QuickAssist^)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [48] %I_RawImageExtension% Raw Image Extension ^(Microsoft.RawImageExtension^)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [49] %I_SkypeApp% Skype ^(Microsoft.SkypeApp^)
  	echo.  [50] %I_ScreenSketch% Snip ^& Sketch ^(Microsoft.ScreenSketch^)
  	echo.  [51] %I_StickyNotes% Sticky Notes ^(Microsoft.MicrosoftStickyNotes^)
  	echo.  [52] %I_StorePurchaseApp% Store Experience Host ^(Microsoft.StorePurchaseApp^)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [53] %I_Teams% Teams ^(Microsoft.WindowsTeams^)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [54] %I_Terminal% Terminal ^(Microsoft.WindowsTerminal^)
	echo.  [55] %I_Getstarted% Tips ^(Microsoft.Getstarted^)
  	echo.  [56] %I_SoundRecorder% Voice Recorder ^(Microsoft.WindowsSoundRecorder^)
  	echo.  [57] %I_VP9VideoExtensions% VP9 Video Extensions ^(Microsoft.VP9VideoExtensions^)
  	echo.  [58] %I_BingWeather% Weather ^(Microsoft.BingWeather^)
  	echo.  [59] %I_WebMediaExtensions% Web Media Extensions ^(Microsoft.WebMediaExtensions^)
  	echo.  [60] %I_WebpImageExtension% Webp Image Extensions ^(Microsoft.WebpImageExtension^)
	echo.  [61] %I_WindowsDefender% Windows Defender ^(Microsoft.SecHealthUI_8wekyb3d8bbwe^)
  	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [62] %I_ZuneMusic% Windows Media Player ^(Microsoft.ZuneMusic^)
	echo.  [63] %I_Xbox% Xbox App - Xbox Console Companion ^(Microsoft.XboxApp^)
  	echo.  [64] %I_XboxGamingOverlay% Xbox Game Bar ^(Microsoft.XboxGamingOverlay^)
  	echo.  [65] %I_XboxGameOverlay% Xbox Game Bar Plugin ^(Microsoft.XboxGameOverlay^)
  	echo.  [66] %I_XboxSpeechToTextOverlay% Xbox Game Speech Window ^(Microsoft.XboxSpeechToTextOverlay^)
  	echo.  [67] %I_XboxIdentityProvider% Xbox Identity Provider ^(Microsoft.XboxIdentityProvider^)
  	echo.  [68] %I_XboxTCUI% Xbox Live ^(Microsoft.Xbox.TCUI^)
  	echo.  [69] %I_YourPhone% Your Phone ^(Microsoft.YourPhone^)
	echo.
	echo.  [70] %I_AMDLink% AMD Link
	echo.  [71] %I_HPSupportAssistant% HP Support Assistant 9
	echo.  [72] %I_IntelGraphicsCommandCenter% Intel Graphics Command Center
	echo.  [73] %I_IntelThunderboltController% Intel Thunderbolt Controller
	echo.  [74] %I_KillerControlCenter% Rivet Networks Killer Control Center
	echo.  [75] %I_NVIDIAControlPanel% NVIDIA Control Panel
	echo.  [76] %I_RealtekAudioControl% Realtek Audio Console
	echo.  [77] %I_WavesMaxxAudioProforDell% Waves MaxxAudio Pro for Dell 2020
	echo.
	echo.  [A]    All Inbox Apps
	echo.  [X]    Go Back
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_3DViewer%" equ "+" ( set "I_3DViewer=-" ) else ( set "I_3DViewer=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_DesktopAppInstaller%" equ "+" ( set "I_DesktopAppInstaller=-" ) else ( set "I_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_AV1VideoExtension%" equ "+" ( set "I_AV1VideoExtension=-" ) else ( set "I_AV1VideoExtension=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_BingSearch%" equ "+" ( set "I_BingSearch=-" ) else ( set "I_BingSearch=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "7" ( if "%I_Camera%" equ "+" ( set "I_Camera=-" ) else ( set "I_Camera=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_Clipchamp%" equ "+" ( set "I_Clipchamp=-" ) else ( set "I_Clipchamp=+" ) )
	if "!MenuChoice!" equ "9" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_Cortana%" equ "+" ( set "I_Cortana=-" ) else ( set "I_Cortana=+" ) )
	if "!MenuChoice!" equ "10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_DirectXRuntime%" equ "+" ( set "I_DirectXRuntime=-" ) else ( set "I_DirectXRuntime=+" ) )
	if "!MenuChoice!" equ "11" if "%ImageArchitecture%" neq "x86" ( if "%I_DolbyAudioExtensions%" equ "+" ( set "I_DolbyAudioExtensions=-" ) else ( set "I_DolbyAudioExtensions=+" ) )
	if "!MenuChoice!" equ "12" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" if "%ImageArchitecture%" neq "x86" ( if "%I_Family%" equ "+" ( set "I_Family=-" ) else ( set "I_Family=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_FeedbackHub%" equ "+" ( set "I_FeedbackHub=-" ) else ( set "I_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "14" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_GetHelp%" equ "+" ( set "I_GetHelp=-" ) else ( set "I_GetHelp=+" ) )
	if "!MenuChoice!" equ "16" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "17" ( if "%I_HEIFImageExtension%" equ "+" ( set "I_HEIFImageExtension=-" ) else ( set "I_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_HEVCVideoExtension%" equ "+" ( set "I_HEVCVideoExtension=-" ) else ( set "I_HEVCVideoExtension=+" ) )
	if "!MenuChoice!" equ "19" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_Maps%" equ "+" ( set "I_Maps=-" ) else ( set "I_Maps=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_Messaging%" equ "+" ( set "I_Messaging=-" ) else ( set "I_Messaging=+" ) )
	if "!MenuChoice!" equ "22" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_MicrosoftDefender%" equ "+" ( set "I_MicrosoftDefender=-" ) else ( set "I_MicrosoftDefender=+" ) )
	if "!MenuChoice!" equ "23" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_Journal%" equ "+" ( set "I_Journal=-" ) else ( set "I_Journal=+" ) )
	if "!MenuChoice!" equ "24" ( if "%I_Wallet%" equ "+" ( set "I_Wallet=-" ) else ( set "I_Wallet=+" ) )
	if "!MenuChoice!" equ "25" ( if "%I_SolitaireCollection%" equ "+" ( set "I_SolitaireCollection=-" ) else ( set "I_SolitaireCollection=+" ) )
	if "!MenuChoice!" equ "26" ( if "%I_WindowsStore%" equ "+" ( set "I_WindowsStore=-" ) else ( set "I_WindowsStore=+" ) )
	if "!MenuChoice!" equ "27" ( if "%I_Todos%" equ "+" ( set "I_Todos=-" ) else ( set "I_Todos=+" ) )
	if "!MenuChoice!" equ "28" ( if "%I_Whiteboard%" equ "+" ( set "I_Whiteboard=-" ) else ( set "I_Whiteboard=+" ) )
	if "!MenuChoice!" equ "29" ( if "%I_MinecraftEducationEdition%" equ "+" ( set "I_MinecraftEducationEdition=-" ) else ( set "I_MinecraftEducationEdition=+" ) )
	if "!MenuChoice!" equ "30" if "%ImageArchitecture%" equ "x64" ( if "%I_MixedRealityPortal%" equ "+" ( set "I_MixedRealityPortal=-" ) else ( set "I_MixedRealityPortal=+" ) )
	if "!MenuChoice!" equ "31" if "%ImageBuild%" equ "17763" ( if "%I_3DViewer%" equ "+" ( set "I_3DViewer=-" ) else ( set "I_3DViewer=+" ) )
	if "!MenuChoice!" equ "32" ( if "%I_MPEG2VideoExtension%" equ "+" ( set "I_MPEG2VideoExtension=-" ) else ( set "I_MPEG2VideoExtension=+" ) )
	if "!MenuChoice!" equ "33" ( if "%I_OneConnect%" equ "+" ( set "I_OneConnect=-" ) else ( set "I_OneConnect=+" ) )
	if "!MenuChoice!" equ "34" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "35" if "%ImageBuild%" equ "17763" ( if "%I_OfficeHub%" equ "+" ( set "I_OfficeHub=-" ) else ( set "I_OfficeHub=+" ) )
	if "!MenuChoice!" equ "36" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "37" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_OfficeHub%" equ "+" ( set "I_OfficeHub=-" ) else ( set "I_OfficeHub=+" ) )
	if "!MenuChoice!" equ "38" ( if "%I_OfficeOneNote%" equ "+" ( set "I_OfficeOneNote=-" ) else ( set "I_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "39" ( if "%I_D3DMappingLayers%" equ "+" ( set "I_D3DMappingLayers=-" ) else ( set "I_D3DMappingLayers=+" ) )
	if "!MenuChoice!" equ "40" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_OutlookForWindows%" equ "+" ( set "I_OutlookForWindows=-" ) else ( set "I_OutlookForWindows=+" ) )
	if "!MenuChoice!" equ "41" ( if "%I_Paint3D%" equ "+" ( set "I_Paint3D=-" ) else ( set "I_Paint3D=+" ) )
	if "!MenuChoice!" equ "42" ( if "%I_People%" equ "+" ( set "I_People=-" ) else ( set "I_People=+" ) )
	if "!MenuChoice!" equ "43" ( if "%I_Photos%" equ "+" ( set "I_Photos=-" ) else ( set "I_Photos=+" ) )
	if "!MenuChoice!" equ "44" ( if "%I_PowerAutomateDesktop%" equ "+" ( set "I_PowerAutomateDesktop=-" ) else ( set "I_PowerAutomateDesktop=+" ) )
	if "!MenuChoice!" equ "45" ( if "%I_MicrosoftPowerBI%" equ "+" ( set "I_MicrosoftPowerBI=-" ) else ( set "I_MicrosoftPowerBI=+" ) )
	if "!MenuChoice!" equ "46" ( if "%I_Print3D%" equ "+" ( set "I_Print3D=-" ) else ( set "I_Print3D=+" ) )
	if "!MenuChoice!" equ "47" ( if "%I_QuickAssist%" equ "+" ( set "I_QuickAssist=-" ) else ( set "I_QuickAssist=+" ) )
	if "!MenuChoice!" equ "48" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_RawImageExtension%" equ "+" ( set "I_RawImageExtension=-" ) else ( set "I_RawImageExtension=+" ) )
	if "!MenuChoice!" equ "49" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_SkypeApp%" equ "+" ( set "I_SkypeApp=-" ) else ( set "I_SkypeApp=+" ) )
	if "!MenuChoice!" equ "50" ( if "%I_ScreenSketch%" equ "+" ( set "I_ScreenSketch=-" ) else ( set "I_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "51" ( if "%I_StickyNotes%" equ "+" ( set "I_StickyNotes=-" ) else ( set "I_StickyNotes=+" ) )
	if "!MenuChoice!" equ "52" ( if "%I_StorePurchaseApp%" equ "+" ( set "I_StorePurchaseApp=-" ) else ( set "I_StorePurchaseApp=+" ) )
	if "!MenuChoice!" equ "53" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_Teams%" equ "+" ( set "I_Teams=-" ) else ( set "I_Teams=+" ) )
	if "!MenuChoice!" equ "54" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_Terminal%" equ "+" ( set "I_Terminal=-" ) else ( set "I_Terminal=+" ) )
	if "!MenuChoice!" equ "55" ( if "%I_Getstarted%" equ "+" ( set "I_Getstarted=-" ) else ( set "I_Getstarted=+" ) )
	if "!MenuChoice!" equ "56" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "57" ( if "%I_VP9VideoExtensions%" equ "+" ( set "I_VP9VideoExtensions=-" ) else ( set "I_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "58" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "59" ( if "%I_WebMediaExtensions%" equ "+" ( set "I_WebMediaExtensions=-" ) else ( set "I_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "60" ( if "%I_WebpImageExtension%" equ "+" ( set "I_WebpImageExtension=-" ) else ( set "I_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "61" ( if "%I_WindowsDefender%" equ "+" ( set "I_WindowsDefender=-" ) else ( set "I_WindowsDefender=+" ) )
	if "!MenuChoice!" equ "62" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "63" ( if "%I_Xbox%" equ "+" ( set "I_Xbox=-" ) else ( set "I_Xbox=+" ) )
	if "!MenuChoice!" equ "64" ( if "%I_XboxGamingOverlay%" equ "+" ( set "I_XboxGamingOverlay=-" ) else ( set "I_XboxGamingOverlay=+" ) )
	if "!MenuChoice!" equ "65" ( if "%I_XboxGameOverlay%" equ "+" ( set "I_XboxGameOverlay=-" ) else ( set "I_XboxGameOverlay=+" ) )
	if "!MenuChoice!" equ "66" ( if "%I_XboxSpeechToTextOverlay%" equ "+" ( set "I_XboxSpeechToTextOverlay=-" ) else ( set "I_XboxSpeechToTextOverlay=+" ) )
	if "!MenuChoice!" equ "67" ( if "%I_XboxIdentityProvider%" equ "+" ( set "I_XboxIdentityProvider=-" ) else ( set "I_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "68" ( if "%I_XboxTCUI%" equ "+" ( set "I_XboxTCUI=-" ) else ( set "I_XboxTCUI=+" ) )
	if "!MenuChoice!" equ "69" ( if "%I_YourPhone%" equ "+" ( set "I_YourPhone=-" ) else ( set "I_YourPhone=+" ) )

	if "!MenuChoice!" equ "70" ( if "%I_AMDLink%" equ "+" ( set "I_AMDLink=-" ) else ( set "I_AMDLink=+" ) )
	if "!MenuChoice!" equ "71" ( if "%I_HPSupportAssistant%" equ "+" ( set "I_HPSupportAssistant=-" ) else ( set "I_HPSupportAssistant=+" ) )
	if "!MenuChoice!" equ "72" ( if "%I_IntelGraphicsCommandCenter%" equ "+" ( set "I_IntelGraphicsCommandCenter=-" ) else ( set "I_IntelGraphicsCommandCenter=+" ) )
	if "!MenuChoice!" equ "73" ( if "%I_IntelThunderboltController%" equ "+" ( set "I_IntelThunderboltController=-" ) else ( set "I_IntelThunderboltController=+" ) )
	if "!MenuChoice!" equ "74" ( if "%I_KillerControlCenter%" equ "+" ( set "I_KillerControlCenter=-" ) else ( set "I_KillerControlCenter=+" ) )
	if "!MenuChoice!" equ "75" ( if "%I_NVIDIAControlPanel%" equ "+" ( set "I_NVIDIAControlPanel=-" ) else ( set "I_NVIDIAControlPanel=+" ) )
	if "!MenuChoice!" equ "76" ( if "%I_RealtekAudioControl%" equ "+" ( set "I_RealtekAudioControl=-" ) else ( set "I_RealtekAudioControl=+" ) )
	if "!MenuChoice!" equ "77" ( if "%I_WavesMaxxAudioProforDell%" equ "+" ( set "I_WavesMaxxAudioProforDell=-" ) else ( set "I_WavesMaxxAudioProforDell=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_3DViewer=+"
		set "I_Alarms=+"
		set "I_AV1VideoExtension=+"
		set "I_BingNews=+"
		set "I_BingSearch=+"
		set "I_BingWeather=+"
		set "I_Calculator=+"
		set "I_Camera=+"
		set "I_Clipchamp=+"
		set "I_CommunicationsApps=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_Cortana=+"
		set "I_D3DMappingLayers=+"
		set "I_DesktopAppInstaller=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_DirectXRuntime=+"
		if "%ImageArchitecture%" neq "x86" set "I_DolbyAudioExtensions=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" if "%ImageArchitecture%" neq "x86" set "I_Family=+"
		set "I_FeedbackHub=+"
		set "I_GetHelp=+"
		set "I_Getstarted=+"
		set "I_HEIFImageExtension=+"
		set "I_HEVCVideoExtension=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_Journal=+"
		set "I_Maps=+"
		set "I_Messaging=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_MicrosoftDefender=+"
		set "I_MicrosoftPowerBI=+"
		set "I_MinecraftEducationEdition=+"
		if "%ImageArchitecture%" equ "x64" set "I_MixedRealityPortal=+"
		set "I_MPEG2VideoExtension=+"
		set "I_OfficeHub=+"
		set "I_OfficeOneNote=+"
		set "I_OneConnect=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_OutlookForWindows=+"
		set "I_Paint3D=+"
		set "I_People=+"
		set "I_Photos=+"
		set "I_PowerAutomateDesktop=+"
		set "I_Print3D=+"
		set "I_QuickAssist=+"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" set "I_RawImageExtension=+"
		set "I_ScreenSketch=+"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" set "I_SkypeApp=+"
		set "I_SolitaireCollection=+"
		set "I_SoundRecorder=+"
		set "I_StickyNotes=+"
		set "I_StorePurchaseApp=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_Teams=+"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" set "I_Terminal=+"
		set "I_Todos=+"
		set "I_VP9VideoExtensions=+"
		set "I_Wallet=+"
		set "I_WebMediaExtensions=+"
		set "I_WebpImageExtension=+"
		set "I_Whiteboard=+"
		set "I_WindowsDefender=+"
		set "I_WindowsStore=+"
		set "I_Xbox=+"
		set "I_XboxGameOverlay=+"
		set "I_XboxGamingOverlay=+"
		set "I_XboxIdentityProvider=+"
		set "I_XboxSpeechToTextOverlay=+"
		set "I_XboxTCUI=+"
		set "I_YourPhone=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"

		set "I_AMDLink=+"
		set "I_HPSupportAssistant=+"
		set "I_IntelGraphicsCommandCenter=+"
		set "I_IntelThunderboltController=+"
		set "I_KillerControlCenter=+"
		set "I_NVIDIAControlPanel=+"
		set "I_RealtekAudioControl=+"
		set "I_WavesMaxxAudioProforDell=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: Integrate Windows 11 v21H2/v22H2 Default Inbox Apps Menu
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000" (
	echo.  [ 1] %I_3DViewer% 3D Viewer ^(Microsoft.Microsoft3DViewer^)
  	if "%ImageBuild%" equ "22000" echo.  [ 2] %I_Alarms% Alarms ^& Clock ^(Microsoft.WindowsAlarms^)
  	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [ 2] %I_Alarms% Alarms ^(Microsoft.WindowsAlarms^)
	echo.  [ 3] %I_AmazonAppStore% Amazon App Store ^(Amazon.comServicesLLC.AmazonAppstore^)
  	echo.  [ 4] %I_DesktopAppInstaller% App Installer ^(Microsoft.DesktopAppInstaller^)
  	echo.  [ 5] %I_AV1VideoExtension% AV1 Video Extension ^(Microsoft.AV1VideoExtension^)
	echo.  [ 6] %I_BingSearch% Bing Search ^(Microsoft.BingSearch^)
	echo.  [ 7] %I_Calculator% Calculator ^(Microsoft.WindowsCalculator^)
  	echo.  [ 8] %I_Camera% Camera ^(Microsoft.WindowsCamera^)
	echo.  [ 9] %I_Clipchamp% Clipchamp - Video Editor ^(Clipchamp.Clipchamp^)
  	echo.  [10] %I_Cortana% Cortana ^(Microsoft.549981C3F5F10^)
	echo.  [11] %I_DevHome% Dev Home^(Microsoft.Windows.DevHome^)
	echo.  [12] %I_DirectXRuntime% DirectX ^(Microsoft.DirectXRuntime^)
	echo.  [13] %I_DolbyAudioExtensions% Dolby Audio Extensions ^(Microsoft.DolbyAudioExtensions^)
	echo.  [14] %I_Family% Family ^(MicrosoftCorporationII.MicrosoftFamily^)
	echo.  [15] %I_FeedbackHub% Feedback Hub ^(Microsoft.WindowsFeedbackHub^)
	if "%ImageBuild%" equ "22000" echo.  [16] %I_ZuneVideo% Films ^& TV ^(Microsoft.ZuneVideo^)
  	echo.  [17] %I_GetHelp% Get Help ^(Microsoft.GetHelp^)
  	echo.  [18] %I_HEIFImageExtension% HEIF Image Extensions ^(Microsoft.HEIFImageExtension^)
	echo.  [19] %I_HEVCVideoExtension% HEVC Video Extensions ^(Microsoft.HEVCVideoExtension^)
  	echo.  [20] %I_CommunicationsApps% Mail and Calendar ^(Microsoft.WindowsCommunicationsApps^)
  	echo.  [21] %I_Maps% Maps ^(Microsoft.WindowsMaps^)
  	echo.  [22] %I_Messaging% Messaging ^(Microsoft.Messaging^)
  	echo.  [23] %I_MicrosoftDefender% Microsoft Defender ^(Microsoft.6365217CE6EB4^)
	echo.  [24] %I_Journal% Microsoft Journal ^(Microsoft.MicrosoftJournal^)
  	echo.  [25] %I_Wallet% Microsoft Pay ^(Microsoft.Wallet^)
  	if "%ImageBuild%" equ "22000" echo.  [26] %I_SolitaireCollection% Microsoft Solitaire Collection ^(Microsoft.MicrosoftSolitaireCollection^)
  	echo.  [27] %I_WindowsStore% Microsoft Store ^(Microsoft.WindowsStore^)
	echo.  [28] %I_Todos% Microsoft To Do ^(Microsoft.Todos^)
	echo.  [29] %I_Whiteboard% Microsoft Whiteboard ^(Microsoft.Whiteboard^)
  	echo.  [30] %I_MinecraftEducationEdition% Minecraft Education ^(Microsoft.MinecraftEducationEdition^)
	echo.  [31] %I_MixedRealityPortal% Mixed Reality Portal ^(Microsoft.MixedReality.Portal^)
  	echo.  [32] %I_MPEG2VideoExtension% MPEG-2 Video Extension ^(Microsoft.MPEG2VideoExtension^)
	echo.  [33] %I_OneConnect% Mobile Plans ^(Microsoft.OneConnect^)
  	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [34] %I_ZuneVideo% Movies ^& TV ^(Microsoft.ZuneVideo^)
	echo.  [35] %I_BingNews% News ^(Microsoft.BingNews^)
	echo.  [36] %I_Notepad% Notepad ^(Microsoft.WindowsNotepad^)
	echo.  [37] %I_OfficeHub% Office ^(Microsoft.MicrosoftOfficeHub^)
	echo.  [38] %I_OfficeOneNote% OneNote ^(Microsoft.Office.OneNote^)
  	echo.  [39] %I_D3DMappingLayers% OpenGL ^& OpenCL Compatibility Pack ^(Microsoft.D3DMappingLayers^)
	echo.  [40] %I_OutlookForWindows% Outlook for Windows ^(Microsoft.OutlookForWindows^)
	echo.  [41] %I_Paint3D% Paint 3D ^(Microsoft.MSPaint^)
	echo.  [42] %I_Paint% Paint ^(Microsoft.Paint^)
  	echo.  [43] %I_People% People ^(Microsoft.People^)
  	echo.  [44] %I_Photos% Photos ^(Microsoft.Windows.Photos^)
	echo.  [45] %I_PowerAutomateDesktop% Power Automate ^(Microsoft.PowerAutomateDesktop^)
	echo.  [46] %I_MicrosoftPowerBI% Power BI ^(Microsoft.MicrosoftPowerBIForWindows^)
  	echo.  [47] %I_Print3D% Print 3D ^(Microsoft.Print3D^)
  	echo.  [48] %I_QuickAssist% Quick Assist ^(MicrosoftCorporationII.QuickAssist^)
	echo.  [49] %I_RawImageExtension% Raw Image Extension ^(Microsoft.RawImageExtension^)
	echo.  [50] %I_SkypeApp% Skype ^(Microsoft.SkypeApp^)
  	if "%ImageBuild%" equ "22000" echo.  [51] %I_ScreenSketch% Snip ^& Sketch ^(Microsoft.ScreenSketch^)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [51] %I_ScreenSketch% Snipping Tool ^(Microsoft.ScreenSketch^)
  	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [52] %I_SolitaireCollection% Solitaire Collection ^(Microsoft.MicrosoftSolitaireCollection^)
	echo.  [53] %I_StickyNotes% Sticky Notes ^(Microsoft.MicrosoftStickyNotes^)
  	echo.  [54] %I_StorePurchaseApp% Store Experience Host ^(Microsoft.StorePurchaseApp^)
	echo.  [55] %I_Teams% Teams ^(Microsoft.WindowsTeams^)
  	echo.  [56] %I_Terminal% Terminal ^(Microsoft.WindowsTerminal^)
	echo.  [57] %I_Getstarted% Tips ^(Microsoft.Getstarted^)
  	echo.  [58] %I_SoundRecorder% Voice Recorder ^(Microsoft.WindowsSoundRecorder^)
  	echo.  [59] %I_VP9VideoExtensions% VP9 Video Extensions ^(Microsoft.VP9VideoExtensions^)
  	echo.  [60] %I_BingWeather% Weather ^(Microsoft.BingWeather^)
  	echo.  [61] %I_WebMediaExtensions% Web Media Extensions ^(Microsoft.WebMediaExtensions^)
  	echo.  [62] %I_WebpImageExtension% Webp Image Extensions ^(Microsoft.WebpImageExtension^)
	echo.  [63] %I_WindowsDefender% Windows Defender ^(Microsoft.SecHealthUI_8wekyb3d8bbwe^)
	echo.  [64] %I_ZuneMusic% Windows Media Player ^(Microsoft.ZuneMusic^)
	echo.  [65] %I_WindowsSubsystemForAndroid% Windows Subsystem For Android ^(WSA^) ^(MicrosoftCorporationII.WindowsSubsystemForAndroid^)
	echo.  [66] %I_WindowsSubsystemForLinux% Windows Subsystem For Linux ^(WSL^) ^(MicrosoftCorporationII.WindowsSubsystemForLinux^)
	echo.  [67] %I_ClientWebExperience% Windows Web Experience Pack ^(MicrosoftWindows.Client.WebExperience^)
	echo.  [68] %I_GamingApp% Xbox App^(Microsoft.GamingApp^)
  	echo.  [69] %I_XboxGamingOverlay% Xbox Game Bar ^(Microsoft.XboxGamingOverlay^)
  	echo.  [70] %I_XboxGameOverlay% Xbox Game Bar Plugin ^(Microsoft.XboxGameOverlay^)
  	echo.  [71] %I_XboxSpeechToTextOverlay% Xbox Game Speech Window ^(Microsoft.XboxSpeechToTextOverlay^)
  	echo.  [72] %I_XboxIdentityProvider% Xbox Identity Provider ^(Microsoft.XboxIdentityProvider^)
  	echo.  [73] %I_XboxTCUI% Xbox Live ^(Microsoft.Xbox.TCUI^)
  	echo.  [74] %I_YourPhone% Your Phone ^(Microsoft.YourPhone^)
	echo.
	echo.  [75] %I_AMDLink% AMD Link
	echo.  [76] %I_HPSupportAssistant% HP Support Assistant 9
	echo.  [77] %I_IntelGraphicsCommandCenter% Intel Graphics Command Center
	echo.  [78] %I_IntelThunderboltController% Intel Thunderbolt Controller
	echo.  [79] %I_KillerControlCenter% Rivet Networks Killer Control Center
	echo.  [80] %I_NVIDIAControlPanel% NVIDIA Control Panel
	echo.  [81] %I_RealtekAudioControl% Realtek Audio Console
	echo.  [82] %I_WavesMaxxAudioProforDell% Waves MaxxAudio Pro for Dell 2020
	echo.
	echo.  [A]    All Inbox Apps
	echo.  [X]    Go Back
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" ( if "%I_3DViewer%" equ "+" ( set "I_3DViewer=-" ) else ( set "I_3DViewer=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_AmazonAppStore%" equ "+" ( set "I_AmazonAppStore=-" ) else ( set "I_AmazonAppStore=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_DesktopAppInstaller%" equ "+" ( set "I_DesktopAppInstaller=-" ) else ( set "I_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_AV1VideoExtension%" equ "+" ( set "I_AV1VideoExtension=-" ) else ( set "I_AV1VideoExtension=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_BingSearch%" equ "+" ( set "I_BingSearch=-" ) else ( set "I_BingSearch=+" ) )
	if "!MenuChoice!" equ "7" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_Camera%" equ "+" ( set "I_Camera=-" ) else ( set "I_Camera=+" ) )
	if "!MenuChoice!" equ "9" ( if "%I_Clipchamp%" equ "+" ( set "I_Clipchamp=-" ) else ( set "I_Clipchamp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%I_Cortana%" equ "+" ( set "I_Cortana=-" ) else ( set "I_Cortana=+" ) )
	if "!MenuChoice!" equ "11" ( if "%I_DevHome%" equ "+" ( set "I_DevHome=-" ) else ( set "I_DevHome=+" ) )
	if "!MenuChoice!" equ "12" ( if "%I_DirectXRuntime%" equ "+" ( set "I_DirectXRuntime=-" ) else ( set "I_DirectXRuntime=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_DolbyAudioExtensions%" equ "+" ( set "I_DolbyAudioExtensions=-" ) else ( set "I_DolbyAudioExtensions=+" ) )
	if "!MenuChoice!" equ "14" ( if "%I_Family%" equ "+" ( set "I_Family=-" ) else ( set "I_Family=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_FeedbackHub%" equ "+" ( set "I_FeedbackHub=-" ) else ( set "I_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "16" if "%ImageBuild%" equ "22000" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "17" ( if "%I_GetHelp%" equ "+" ( set "I_GetHelp=-" ) else ( set "I_GetHelp=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_HEIFImageExtension%" equ "+" ( set "I_HEIFImageExtension=-" ) else ( set "I_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "19 ( if "%I_HEVCVideoExtension%" equ "+" ( set "I_HEVCVideoExtension=-" ) else ( set "I_HEVCVideoExtension=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_Maps%" equ "+" ( set "I_Maps=-" ) else ( set "I_Maps=+" ) )
	if "!MenuChoice!" equ "22" ( if "%I_Messaging%" equ "+" ( set "I_Messaging=-" ) else ( set "I_Messaging=+" ) )
	if "!MenuChoice!" equ "23" ( if "%I_MicrosoftDefender%" equ "+" ( set "I_MicrosoftDefender=-" ) else ( set "I_MicrosoftDefender=+" ) )
	if "!MenuChoice!" equ "24" ( if "%I_Journal%" equ "+" ( set "I_Journal=-" ) else ( set "I_Journal=+" ) )
	if "!MenuChoice!" equ "25" ( if "%I_Wallet%" equ "+" ( set "I_Wallet=-" ) else ( set "I_Wallet=+" ) )
	if "!MenuChoice!" equ "26" if "%ImageBuild%" equ "22000" ( if "%I_SolitaireCollection%" equ "+" ( set "I_SolitaireCollection=-" ) else ( set "I_SolitaireCollection=+" ) )
	if "!MenuChoice!" equ "27" ( if "%I_WindowsStore%" equ "+" ( set "I_WindowsStore=-" ) else ( set "I_WindowsStore=+" ) )
	if "!MenuChoice!" equ "28" ( if "%I_Todos%" equ "+" ( set "I_Todos=-" ) else ( set "I_Todos=+" ) )
	if "!MenuChoice!" equ "29" ( if "%I_Whiteboard%" equ "+" ( set "I_Whiteboard=-" ) else ( set "I_Whiteboard=+" ) )
	if "!MenuChoice!" equ "30" ( if "%I_MinecraftEducationEdition%" equ "+" ( set "I_MinecraftEducationEdition=-" ) else ( set "I_MinecraftEducationEdition=+" ) )
	if "!MenuChoice!" equ "31" ( if "%I_MixedRealityPortal%" equ "+" ( set "I_MixedRealityPortal=-" ) else ( set "I_MixedRealityPortal=+" ) )
	if "!MenuChoice!" equ "32" ( if "%I_MPEG2VideoExtension%" equ "+" ( set "I_MPEG2VideoExtension=-" ) else ( set "I_MPEG2VideoExtension=+" ) )
	if "!MenuChoice!" equ "33" ( if "%I_OneConnect%" equ "+" ( set "I_OneConnect=-" ) else ( set "I_OneConnect=+" ) )
	if "!MenuChoice!" equ "34" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "35" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "36" ( if "%I_Notepad%" equ "+" ( set "I_Notepad=-" ) else ( set "I_Notepad=+" ) )
	if "!MenuChoice!" equ "37" ( if "%I_OfficeHub%" equ "+" ( set "I_OfficeHub=-" ) else ( set "I_OfficeHub=+" ) )
	if "!MenuChoice!" equ "38" ( if "%I_OfficeOneNote%" equ "+" ( set "I_OfficeOneNote=-" ) else ( set "I_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "39" ( if "%I_D3DMappingLayers%" equ "+" ( set "I_D3DMappingLayers=-" ) else ( set "I_D3DMappingLayers=+" ) )
	if "!MenuChoice!" equ "40" ( if "%I_OutlookForWindows%" equ "+" ( set "I_OutlookForWindows=-" ) else ( set "I_OutlookForWindows=+" ) )
	if "!MenuChoice!" equ "41" ( if "%I_Paint3D%" equ "+" ( set "I_Paint3D=-" ) else ( set "I_Paint3D=+" ) )
	if "!MenuChoice!" equ "42" ( if "%I_Paint%" equ "+" ( set "I_Paint=-" ) else ( set "I_Paint=+" ) )
	if "!MenuChoice!" equ "43" ( if "%I_People%" equ "+" ( set "I_People=-" ) else ( set "I_People=+" ) )
	if "!MenuChoice!" equ "44" ( if "%I_Photos%" equ "+" ( set "I_Photos=-" ) else ( set "I_Photos=+" ) )
	if "!MenuChoice!" equ "45" ( if "%I_PowerAutomateDesktop%" equ "+" ( set "I_PowerAutomateDesktop=-" ) else ( set "I_PowerAutomateDesktop=+" ) )
	if "!MenuChoice!" equ "46" ( if "%I_MicrosoftPowerBI%" equ "+" ( set "I_MicrosoftPowerBI=-" ) else ( set "I_MicrosoftPowerBI=+" ) )
	if "!MenuChoice!" equ "47" ( if "%I_Print3D%" equ "+" ( set "I_Print3D=-" ) else ( set "I_Print3D=+" ) )
	if "!MenuChoice!" equ "48" ( if "%I_QuickAssist%" equ "+" ( set "I_QuickAssist=-" ) else ( set "I_QuickAssist=+" ) )
	if "!MenuChoice!" equ "49" ( if "%I_RawImageExtension%" equ "+" ( set "I_RawImageExtension=-" ) else ( set "I_RawImageExtension=+" ) )
	if "!MenuChoice!" equ "50" ( if "%I_SkypeApp%" equ "+" ( set "I_SkypeApp=-" ) else ( set "I_SkypeApp=+" ) )
	if "!MenuChoice!" equ "51" ( if "%I_ScreenSketch%" equ "+" ( set "I_ScreenSketch=-" ) else ( set "I_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "52" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" ( if "%I_SolitaireCollection%" equ "+" ( set "I_SolitaireCollection=-" ) else ( set "I_SolitaireCollection=+" ) )
	if "!MenuChoice!" equ "53" ( if "%I_StickyNotes%" equ "+" ( set "I_StickyNotes=-" ) else ( set "I_StickyNotes=+" ) )
	if "!MenuChoice!" equ "54" ( if "%I_StorePurchaseApp%" equ "+" ( set "I_StorePurchaseApp=-" ) else ( set "I_StorePurchaseApp=+" ) )
	if "!MenuChoice!" equ "55" ( if "%I_Teams%" equ "+" ( set "I_Teams=-" ) else ( set "I_Teams=+" ) )
	if "!MenuChoice!" equ "56" ( if "%I_Terminal%" equ "+" ( set "I_Terminal=-" ) else ( set "I_Terminal=+" ) )
	if "!MenuChoice!" equ "57" ( if "%I_Getstarted%" equ "+" ( set "I_Getstarted=-" ) else ( set "I_Getstarted=+" ) )
	if "!MenuChoice!" equ "58" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "59" ( if "%I_VP9VideoExtensions%" equ "+" ( set "I_VP9VideoExtensions=-" ) else ( set "I_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "60" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "61" ( if "%I_WebMediaExtensions%" equ "+" ( set "I_WebMediaExtensions=-" ) else ( set "I_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "62" ( if "%I_WebpImageExtension%" equ "+" ( set "I_WebpImageExtension=-" ) else ( set "I_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "63" ( if "%I_WindowsDefender%" equ "+" ( set "I_WindowsDefender=-" ) else ( set "I_WindowsDefender=+" ) )
	if "!MenuChoice!" equ "64" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "65" ( if "%I_WindowsSubsystemForAndroid%" equ "+" ( set "I_WindowsSubsystemForAndroid=-" ) else ( set "I_WindowsSubsystemForAndroid=+" ) )
	if "!MenuChoice!" equ "66" ( if "%I_WindowsSubsystemForLinux%" equ "+" ( set "I_WindowsSubsystemForLinux=-" ) else ( set "I_WindowsSubsystemForLinux=+" ) )
	if "!MenuChoice!" equ "67" ( if "%I_ClientWebExperience%" equ "+" ( set "I_ClientWebExperience=-" ) else ( set "I_ClientWebExperience=+" ) )
	if "!MenuChoice!" equ "68" ( if "%I_GamingApp%" equ "+" ( set "I_GamingApp=-" ) else ( set "I_GamingApp=+" ) )
	if "!MenuChoice!" equ "69" ( if "%I_XboxGamingOverlay%" equ "+" ( set "I_XboxGamingOverlay=-" ) else ( set "I_XboxGamingOverlay=+" ) )
	if "!MenuChoice!" equ "70" ( if "%I_XboxGameOverlay%" equ "+" ( set "I_XboxGameOverlay=-" ) else ( set "I_XboxGameOverlay=+" ) )
	if "!MenuChoice!" equ "71" ( if "%I_XboxSpeechToTextOverlay%" equ "+" ( set "I_XboxSpeechToTextOverlay=-" ) else ( set "I_XboxSpeechToTextOverlay=+" ) )
	if "!MenuChoice!" equ "72" ( if "%I_XboxIdentityProvider%" equ "+" ( set "I_XboxIdentityProvider=-" ) else ( set "I_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "73" ( if "%I_XboxTCUI%" equ "+" ( set "I_XboxTCUI=-" ) else ( set "I_XboxTCUI=+" ) )
	if "!MenuChoice!" equ "74" ( if "%I_YourPhone%" equ "+" ( set "I_YourPhone=-" ) else ( set "I_YourPhone=+" ) )

	if "!MenuChoice!" equ "75" ( if "%I_AMDLink%" equ "+" ( set "I_AMDLink=-" ) else ( set "I_AMDLink=+" ) )
	if "!MenuChoice!" equ "76" ( if "%I_HPSupportAssistant%" equ "+" ( set "I_HPSupportAssistant=-" ) else ( set "I_HPSupportAssistant=+" ) )
	if "!MenuChoice!" equ "77" ( if "%I_IntelGraphicsCommandCenter%" equ "+" ( set "I_IntelGraphicsCommandCenter=-" ) else ( set "I_IntelGraphicsCommandCenter=+" ) )
	if "!MenuChoice!" equ "78" ( if "%I_IntelThunderboltController%" equ "+" ( set "I_IntelThunderboltController=-" ) else ( set "I_IntelThunderboltController=+" ) )
	if "!MenuChoice!" equ "79" ( if "%I_KillerControlCenter%" equ "+" ( set "I_KillerControlCenter=-" ) else ( set "I_KillerControlCenter=+" ) )
	if "!MenuChoice!" equ "80" ( if "%I_NVIDIAControlPanel%" equ "+" ( set "I_NVIDIAControlPanel=-" ) else ( set "I_NVIDIAControlPanel=+" ) )
	if "!MenuChoice!" equ "81" ( if "%I_RealtekAudioControl%" equ "+" ( set "I_RealtekAudioControl=-" ) else ( set "I_RealtekAudioControl=+" ) )
	if "!MenuChoice!" equ "82" ( if "%I_WavesMaxxAudioProforDell%" equ "+" ( set "I_WavesMaxxAudioProforDell=-" ) else ( set "I_WavesMaxxAudioProforDell=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_3DViewer=+"
		set "I_Alarms=+"
		set "I_AmazonAppStore=+"
		set "I_AV1VideoExtension=+"
		set "I_BingNews=+"
		set "I_BingSearch=+"
		set "I_BingWeather=+"
		set "I_Calculator=+"
		set "I_Camera=+"
		set "I_ClientWebExperience=+"
		set "I_Clipchamp=+"
		set "I_CommunicationsApps=+"
		set "I_Cortana=+"
		set "I_D3DMappingLayers=+"
		set "I_DesktopAppInstaller=+"
		set "I_DevHome=+"
		set "I_DirectXRuntime=+"
		set "I_DolbyAudioExtensions=+"
		set "I_Family=+"
		set "I_FeedbackHub=+"
		set "I_GamingApp=+"
		set "I_GetHelp=+"
		set "I_Getstarted=+"
		set "I_HEIFImageExtension=+"
		set "I_HEVCVideoExtension=+"
		set "I_Journal=+"
		set "I_Maps=+"
		set "I_Messaging=+"
		set "I_MicrosoftDefender=+"
		set "I_MicrosoftPowerBI=+"
		set "I_MinecraftEducationEdition=+"
		set "I_MixedRealityPortal=+"
		set "I_MPEG2VideoExtension=+"
		set "I_Notepad=+"
		set "I_OfficeHub=+"
		set "I_OfficeOneNote=+"
		set "I_OneConnect=+"
		set "I_OutlookForWindows=+"
		set "I_Paint=+"
		set "I_Paint3D=+"
		set "I_People=+"
		set "I_Photos=+"
		set "I_PowerAutomateDesktop=+"
		set "I_Print3D=+"
		set "I_QuickAssist=+"
		set "I_RawImageExtension=+"
		set "I_ScreenSketch=+"
		set "I_SkypeApp=+"
		set "I_SolitaireCollection=+"
		set "I_SoundRecorder=+"
		set "I_StickyNotes=+"
		set "I_StorePurchaseApp=+"
		set "I_Teams=+"
		set "I_Terminal=+"
		set "I_Todos=+"
		set "I_VP9VideoExtensions=+"
		set "I_Wallet=+"
		set "I_WebMediaExtensions=+"
		set "I_WebpImageExtension=+"
		set "I_Whiteboard=+"
		set "I_WindowsDefender=+"
		set "I_WindowsStore=+"
		set "I_WindowsSubsystemForAndroid=+"
		set "I_WindowsSubsystemForLinux=+"
		set "I_XboxGameOverlay=+"
		set "I_XboxGamingOverlay=+"
		set "I_XboxIdentityProvider=+"
		set "I_XboxSpeechToTextOverlay=+"
		set "I_XboxTCUI=+"
		set "I_YourPhone=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"

		set "I_AMDLink=+"
		set "I_HPSupportAssistant=+"
		set "I_IntelGraphicsCommandCenter=+"
		set "I_IntelThunderboltController=+"
		set "I_KillerControlCenter=+"
		set "I_NVIDIAControlPanel=+"
		set "I_RealtekAudioControl=+"
		set "I_WavesMaxxAudioProforDell=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: Returning to Select Microsoft Default Inbox Apps Menu
goto :SelectInboxAppsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Default Inbox Apps
::-------------------------------------------------------------------------------------------
:IntInboxApps

setlocal

:: Setting Default Inbox Apps Appx and License files path
if "%SelectedSourceOS%" equ "w81" set "Apps=%Apps%\w81"
if "%SelectedSourceOS%" equ "w10" set "Apps=%Apps%\w10"
if "%SelectedSourceOS%" equ "w11" set "Apps=%Apps%\w10"

set Alarms_Appx=
set AmazonAppStore_Appx=
set AV1VideoExtension_Appx=
set BingFinance_Appx=
set BingFoodDrink_Appx=
set BingHealthFitness_Appx=
set BingMaps_Appx=
set BingNews_Appx=
set BingSports_Appx=
set BingSearch_Appx=
set BingTravel_Appx=
set BingWeather_Appx=
set Calculator_Appx=
set Camera_Appx=
set ClientWebExperience_Appx=
set Clipchamp_Appx=
set CommunicationsApps_Appx=
set Cortana_Appx=
set D3DMappingLayers_Appx=
set DesktopAppInstaller_Appx=
set DevHome_Appx=
set DirectXRuntime_Appx=
set DolbyAudioExtensions_Appx=
set Family_Appx=
set FeedbackHub_Appx=
set GamingApp_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_Appx=
set HelpAndTips_Appx=
set HEVCVideoExtension_Appx=
set Journal_Appx=
set Maps_Appx=
set Messaging_Appx=
set MicrosoftDefender_Appx=
set MicrosoftPowerBI_Appx=
set MinecraftEducationEdition_Appx=
set MixedRealityPortal_Appx=
set MixedRealityViewer_Appx=
set MPEG2VideoExtension_Appx=
set Notepad_Appx=
set OfficeHub_Appx=
set OfficeOneNote_Appx=
set OneConnect_Appx=
set OutlookForWindows_Appx=
set Paint_Appx=
set Paint3D_Appx=
set People_Appx=
set Photos_Appx=
set PowerAutomateDesktop_Appx=
set Print3D_Appx=
set QuickAssist_Appx=
set RawImageExtension_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set SkypeApp_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set StorePurchaseApp_Appx=
set Teams_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set Whiteboard_Appx=
set WindowsDefender_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set WindowsSubsystemForLinux_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set AMDLink_Appx=
set HPSupportAssistant_Appx=
set IntelGraphicsCommandCenter_Appx=
set IntelThunderboltController_Appx=
set KillerControlCenter_Appx=
set NVIDIAControlPanel_Appx=
set RealtekAudioControl_Appx=
set WavesMaxxAudioProforDell_Appx=

set "Alarms_License=/LicensePath:%AppLicense%\Microsoft.WindowsAlarms_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "AmazonAppStore_License=/LicensePath:%AppLicense%\Amazon.comServicesLLC.AmazonAppstore_bvztej1py64t8.xml"
set "AV1VideoExtension_License=/LicensePath:%AppLicense%\Microsoft.AV1VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "BingFinance_License=/LicensePath:%AppLicense%\Microsoft.BingFinance_8wekyb3d8bbwe.xml"
set "BingFoodDrink_License=/LicensePath:%AppLicense%\Microsoft.BingFoodAndDrink_8wekyb3d8bbwe.xml"
set "BingHealthFitness_License=/LicensePath:%AppLicense%\Microsoft.BingHealthAndFitness_8wekyb3d8bbwe.xml"
set "BingMaps_License=/LicensePath:%AppLicense%\Microsoft.BingMaps_8wekyb3d8bbwe.xml"
set "BingNews_License=/LicensePath:%AppLicense%\Microsoft.BingNews_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "BingSearch_License=/LicensePath:%AppLicense%\Microsoft.BingSearch_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "BingSports_License=/LicensePath:%AppLicense%\Microsoft.BingSports_8wekyb3d8bbwe.xml"
set "BingTravel_License=/LicensePath:%AppLicense%\Microsoft.BingTravel_8wekyb3d8bbwe.xml"
set "BingWeather_License=/LicensePath:%AppLicense%\Microsoft.BingWeather_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Calculator_License=/LicensePath:%AppLicense%\Microsoft.WindowsCalculator_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Camera_License=/LicensePath:%AppLicense%\Microsoft.WindowsCamera_8wekyb3d8bbwe.xml"
set "ClientWebExperience_License=/LicensePath:%AppLicense%\MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy.xml"
set "Clipchamp_License=/LicensePath:%AppLicense%\Clipchamp.Clipchamp_yxz26nhyzhsrt.xml"
set "CommunicationsApps_License=/LicensePath:%AppLicense%\Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Cortana_License=/LicensePath:%AppLicense%\Microsoft.549981c3f5f10_8wekyb3d8bbwe.xml"
set "D3DMappingLayers_License=/LicensePath:%AppLicense%\Microsoft.D3DMappingLayers_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "DesktopAppInstaller_License=/LicensePath:%AppLicense%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.xml"
set "DevHome_License=/LicensePath:%AppLicense%\Microsoft.Windows.DevHome_8wekyb3d8bbwe.xml"
set "DirectXRuntime_License=/LicensePath:%AppLicense%\Microsoft.DirectXRuntime_8wekyb3d8bbwe.xml"
set "DolbyAudioExtensions_License=/LicensePath:%AppLicense%\Microsoft.DolbyAudioExtensions_8wekyb3d8bbwe.xml"
set "Family_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.MicrosoftFamily_8wekyb3d8bbwe.xml"
set "FeedbackHub_License=/LicensePath:%AppLicense%\Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe.xml"
set "GamingApp_License=/LicensePath:%AppLicense%\Microsoft.GamingApp_8wekyb3d8bbwe.xml"
set "GetHelp_License=/LicensePath:%AppLicense%\Microsoft.GetHelp_8wekyb3d8bbwe.xml"
set "Getstarted_License=/LicensePath:%AppLicense%\Microsoft.Getstarted_8wekyb3d8bbwe.xml"
set "HEIFImageExtension_License=/LicensePath:%AppLicense%\Microsoft.HEIFImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "HelpAndTips_License=/LicensePath:%AppLicense%\Microsoft.HelpAndTips_8wekyb3d8bbwe.xml"
set "HEVCVideoExtension_License=/LicensePath:%AppLicense%\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Journal_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftJournal_8wekyb3d8bbwe.xml"
set "Maps_License=/LicensePath:%AppLicense%\Microsoft.WindowsMaps_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Messaging_License=/LicensePath:%AppLicense%\Microsoft.Messaging_8wekyb3d8bbwe.xml"
set "MicrosoftDefender_License=/LicensePath:%AppLicense%\Microsoft.6365217CE6EB4_8wekyb3d8bbwe.xml"
set "MicrosoftPowerBI_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftPowerBIForWindows_8wekyb3d8bbwe.xml"
set "MinecraftEducationEdition_License=/LicensePath:%AppLicense%\Microsoft.MinecraftEducationEdition_8wekyb3d8bbwe.xml"
set "MixedRealityPortal_License=/LicensePath:%AppLicense%\Microsoft.MixedReality.Portal_8wekyb3d8bbwe.xml"
set "MixedRealityViewer_License=/LicensePath:%AppLicense%\Microsoft.Microsoft3DViewer_8wekyb3d8bbwe.xml"
set "MPEG2VideoExtension_License=/LicensePath:%AppLicense%\Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Notepad_License=/LicensePath:%AppLicense%\Microsoft.WindowsNotepad_8wekyb3d8bbwe.xml"
set "OfficeHub_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe.xml"
set "OfficeOneNote_License=/LicensePath:%AppLicense%\Microsoft.Office.OneNote_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "OneConnect_License=/LicensePath:%AppLicense%\Microsoft.OneConnect_8wekyb3d8bbwe.xml"
set "OutlookForWindows_License=/LicensePath:%AppLicense%\Microsoft.OutlookForWindows_8wekyb3d8bbwe.xml"
set "Paint_License=/LicensePath:%AppLicense%\Microsoft.Paint_8wekyb3d8bbwe.xml"
set "Paint3D_License=/LicensePath:%AppLicense%\Microsoft.MSPaint_8wekyb3d8bbwe.xml"
set "People_License=/LicensePath:%AppLicense%\Microsoft.People_8wekyb3d8bbwe.xml"
set "Photos_License=/LicensePath:%AppLicense%\Microsoft.Windows.Photos_8wekyb3d8bbwe.xml"
set "PowerAutomateDesktop_License=/LicensePath:%AppLicense%\Microsoft.PowerAutomateDesktop_8wekyb3d8bbwe.xml"
set "Print3D_License=/LicensePath:%AppLicense%\Microsoft.Print3D_8wekyb3d8bbwe.xml"
set "QuickAssist_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe.xml"
set "RawImageExtension_License=/LicensePath:%AppLicense%\Microsoft.RawImageExtension_8wekyb3d8bbwe.xml"
set "Reader_License=/LicensePath:%AppLicense%\Microsoft.Reader_8wekyb3d8bbwe.xml"
set "ReadingList_License=/LicensePath:%AppLicense%\Microsoft.WindowsReadingList_8wekyb3d8bbwe.xml"
set "Scan_License=/LicensePath:%AppLicense%\Microsoft.WindowsScan_8wekyb3d8bbwe.xml"
set "ScreenSketch_License=/LicensePath:%AppLicense%\Microsoft.ScreenSketch_8wekyb3d8bbwe.xml"
set "SkypeApp_License=/LicensePath:%AppLicense%\Microsoft.SkypeApp_kzf8qxf38zg5c_%SelectedSourceOS%.xml"
set "SolitaireCollection_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe.xml"
set "SoundRecorder_License=/LicensePath:%AppLicense%\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "StickyNotes_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe.xml"
set "StorePurchaseApp_License=/LicensePath:%AppLicense%\Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml"
set "Teams_License=/LicensePath:%AppLicense%\MicrosoftTeams_8wekyb3d8bbwe.xml"
set "Terminal_License=/LicensePath:%AppLicense%\Microsoft.WindowsTerminal_8wekyb3d8bbwe.xml"
set "Todos_License=/LicensePath:%AppLicense%\Microsoft.Todos_8wekyb3d8bbwe.xml"
set "VP9VideoExtensions_License=/LicensePath:%AppLicense%\Microsoft.VP9VideoExtensions_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Wallet_License=/LicensePath:%AppLicense%\Microsoft.Wallet_8wekyb3d8bbwe.xml"
set "WebMediaExtensions_License=/LicensePath:%AppLicense%\Microsoft.WebMediaExtensions_8wekyb3d8bbwe.xml"
set "WebpImageExtension_License=/LicensePath:%AppLicense%\Microsoft.WebpImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Whiteboard_License=/LicensePath:%AppLicense%\Microsoft.Whiteboard_8wekyb3d8bbwe.xml"
set "WindowsDefender_License=/LicensePath:%AppLicense%\Microsoft.SecHealthUI_8wekyb3d8bbwe.xml"
set "WindowsStore_License=/LicensePath:%AppLicense%\Microsoft.WindowsStore_8wekyb3d8bbwe.xml"
set "WindowsSubsystemForAndroid_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe.xml"
set "WindowsSubsystemForLinux_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe.xml"
set "Xbox_License=/LicensePath:%AppLicense%\Microsoft.XboxApp_8wekyb3d8bbwe.xml"
set "XboxGameOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxGameOverlay_8wekyb3d8bbwe.xml"
set "XboxGamingOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxGamingOverlay_8wekyb3d8bbwe.xml"
set "XboxIdentityProvider_License=/LicensePath:%AppLicense%\Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml"
set "XboxLiveGames_License=/LicensePath:%AppLicense%\Microsoft.XboxLIVEGames_8wekyb3d8bbwe.xml"
set "XboxSpeechToTextOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bbwe.xml"
set "XboxTCUI_License=/LicensePath:%AppLicense%\Microsoft.Xbox.TCUI_8wekyb3d8bbwe.xml"
set "YourPhone_License=/LicensePath:%AppLicense%\Microsoft.YourPhone_8wekyb3d8bbwe.xml"
set "ZuneMusic_License=/LicensePath:%AppLicense%\Microsoft.ZuneMusic_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "ZuneVideo_License=/LicensePath:%AppLicense%\Microsoft.ZuneVideo_8wekyb3d8bbwe_%SelectedSourceOS%.xml"

set "AMDLink_License=/LicensePath:%AppLicense%\AdvancedMicroDevicesInc-2.AMDLink_0a9344xs7nr4m.xml"
set "HPSupportAssistant_License=/LicensePath:%AppLicense%\AD2F1837.HPSupportAssistant_v10z8vjag6ke6.xml"
set "IntelGraphicsCommandCenter_License=/LicensePath:%AppLicense%\AppUp.IntelGraphicsExperience_8j3eq9eme6ctt.xml"
set "IntelThunderboltController_License=/LicensePath:%AppLicense%\AppUp.ThunderboltControlCenter_8j3eq9eme6ctt.xml"
set "KillerControlCenter_License=/LicensePath:%AppLicense%\RivetNetworks.KillerControlCenter_rh07ty8m5nkag.xml"
set "NVIDIAControlPanel_License=/LicensePath:%AppLicense%\NVIDIACorp.NVIDIAControlPanel_56jybvy8sckqj.xml"
set "RealtekAudioControl_License=/LicensePath:%AppLicense%\RealtekSemiconductorCorp.RealtekAudioControl_dt26b99r8h8gj.xml"
set "WavesMaxxAudioProforDell_License=/LicensePath:%AppLicense%\WavesAudio.MaxxAudioProforDell2020_fh4rh281wavaa.xml"

set AdvertisingXaml_Appx=
set MediaPlayReadyClient22_Appx=
set NETNativeFramework16_Appx=
set NETNativeFramework17_Appx=
set NETNativeFramework22_Appx=
set NETNativeRuntime16_Appx=
set NETNativeRuntime17_Appx=
set NETNativeRuntime22_Appx=
set ServicesStoreEngagement_Appx=
set UIXaml20_Appx=
set UIXaml21_Appx=
set UIXaml22_Appx=
set UIXaml23_Appx=
set UIXaml24_Appx=
set UIXaml25_Appx=
set UIXaml26_Appx=
set UIXaml27_Appx=
set UIXaml28_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibs14_Appx=
set VCLibsUWPDesktop14_Appx=
set WinAppRuntime11_Appx=
set WinAppRuntime12_Appx=
set WinAppRuntime13_Appx=
set WinAppRuntime14_Appx=
set WinJS20_Appx=

cls
echo.===============================================================================
echo. 		  MSMG ToolKit - Integrate Microsoft Default Inbox Apps
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Checking whether Microsoft Default Inbox Apps folder is empty

if not exist "%Apps%\*.appx" (
	echo.Microsoft Default Inbox Apps .Appx files are missing...
	echo.
	echo.Please copy the missing files to ^<Packs\Apps\%SelectedSourceOS%^> folder...
	echo.
	goto :Stop
)

:: Getting Microsoft Default Inbox Apps files full pathnames
cd /d "%Apps%\"

for /f %%i IN ('"dir /b *3DView*.*xbundle" 2^>nul') do if exist %%i set "MixedRealityViewer_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Alarms*.*xbundle" 2^>nul') do if exist %%i set "Alarms_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *AmazonAppstore*.*xbundle" 2^>nul') do if exist %%i set "AmazonAppStore_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *AV1VideoExtension*xbundle" 2^>nul') do if exist %%i set "AV1VideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFinance*.*xbundle" 2^>nul') do if exist %%i set "BingFinance_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFoodAndDrink*.*xbundle" 2^>nul') do if exist %%i set "BingFoodDrink_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingHealthAndFitness*.*xbundle" 2^>nul') do if exist %%i set "BingHealthFitness_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingMaps*.*xbundle" 2^>nul') do if exist %%i set "BingMaps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingNews*.*xbundle" 2^>nul') do if exist %%i set "BingNews_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingSearch*.*xbundle" 2^>nul') do if exist %%i set "BingSearch_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingSports*.*xbundle" 2^>nul') do if exist %%i set "BingSports_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingTravel*.*xbundle" 2^>nul') do if exist %%i set "BingTravel_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingWeather*.*xbundle" 2^>nul') do if exist %%i set "BingWeather_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Calculator*.*xbundle" 2^>nul') do if exist %%i set "Calculator_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Camera*.*xbundle" 2^>nul') do if exist %%i set "Camera_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Client.WebExperience*.*xbundle" 2^>nul') do if exist %%i set "ClientWebExperience_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Clipchamp*.*xbundle" 2^>nul') do if exist %%i set "Clipchamp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommunicationsApps*.*xbundle" 2^>nul') do if exist %%i set "CommunicationsApps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.549981C3F5F10*.*xbundle" 2^>nul') do if exist %%i set "Cortana_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *D3DMappingLayers*.*appx" 2^>nul') do if exist %%i set "D3DMappingLayers_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DesktopAppInstaller*.*xbundle" 2^>nul') do if exist %%i set "DesktopAppInstaller_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Windows.DevHome*.*xbundle" 2^>nul') do if exist %%i set "DevHome_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DirectXRuntime*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "DirectXRuntime_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DolbyAudioExtensions*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "DolbyAudioExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MicrosoftCorporationII.MicrosoftFamily*.*xbundle" 2^>nul') do if exist %%i set "Family_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *FeedbackHub*.*xbundle" 2^>nul') do if exist %%i set "FeedbackHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GamingApp*.*xbundle" 2^>nul') do if exist %%i set "GamingApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GetHelp*.*xbundle" 2^>nul') do if exist %%i set "GetHelp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Getstarted*.*xbundle" 2^>nul') do if exist %%i set "Getstarted_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*.*xbundle" 2^>nul') do if exist %%i set "HEIFImageExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HelpAndTips*.*xbundle" 2^>nul') do if exist %%i set "HelpAndTips_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*.*xbundle" 2^>nul') do if exist %%i set "HEVCVideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MicrosoftJournal*.*xbundle" 2^>nul') do if exist %%i set "Journal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsMaps*.*xbundle" 2^>nul') do if exist %%i set "Maps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Messaging*.*xbundle" 2^>nul') do if exist %%i set "Messaging_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.6365217CE6EB4*%ImageArchitecture%*.msix" 2^>nul') do if exist %%i set "MicrosoftDefender_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.MicrosoftPowerBIForWindows*.*xbundle" 2^>nul') do if exist %%i set "MicrosoftPowerBI_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.MinecraftEducationEdition*.*xbundle" 2^>nul') do if exist %%i set "MinecraftEducationEdition_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MixedReality.Portal*.*xbundle" 2^>nul') do if exist %%i set "MixedRealityPortal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*.*xbundle" 2^>nul') do if exist %%i set "MPEG2VideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsNotepad*.*xbundle" 2^>nul') do if exist %%i set "Notepad_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OfficeHub*.*xbundle" 2^>nul') do if exist %%i set "OfficeHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Office.OneNote*.*xbundle" 2^>nul') do if exist %%i set "OfficeOneNote_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneConnect*.*xbundle" 2^>nul') do if exist %%i set "OneConnect_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OutlookForWindows*%ImageArchitecture%*.msix" 2^>nul') do if exist %%i set "OutlookForWindows_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Paint*.*xbundle" 2^>nul') do if exist %%i set "Paint_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MSPaint*.*xbundle" 2^>nul') do if exist %%i set "Paint3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *People*.*xbundle" 2^>nul') do if exist %%i set "People_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Windows.Photos*.*xbundle" 2^>nul') do if exist %%i set "Photos_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *PowerAutomateDesktop*.*xbundle" 2^>nul') do if exist %%i set "PowerAutomateDesktop_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Print3D*.*xbundle" 2^>nul') do if exist %%i set "Print3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *QuickAssist*.*xbundle" 2^>nul') do if exist %%i set "QuickAssist_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *RawImageExtension*.*xbundle" 2^>nul') do if exist %%i set "RawImageExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Reader*.*xbundle" 2^>nul') do if exist %%i set "Reader_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ReadingList*.*xbundle" 2^>nul') do if exist %%i set "ReadingList_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Scan*.*xbundle" 2^>nul') do if exist %%i set "Scan_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ScreenSketch*.*xbundle" 2^>nul') do if exist %%i set "ScreenSketch_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Skype*.*xbundle" 2^>nul') do if exist %%i set "SkypeApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SolitaireCollection*.*xbundle" 2^>nul') do if exist %%i set "SolitaireCollection_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SoundRecorder*.*xbundle" 2^>nul') do if exist %%i set "SoundRecorder_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StickyNotes*.*xbundle" 2^>nul') do if exist %%i set "StickyNotes_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StorePurchaseApp*.*xbundle" 2^>nul') do if exist %%i set "StorePurchaseApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Teams*.*msix" 2^>nul') do if exist %%i set "Teams_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Terminal*.*xbundle" 2^>nul') do if exist %%i set "Terminal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Todos*.*xbundle" 2^>nul') do if exist %%i set "Todos_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*.*xbundle" 2^>nul') do if exist %%i set "VP9VideoExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Wallet*.*xbundle" 2^>nul') do if exist %%i set "Wallet_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebMediaExtensions*.*xbundle" 2^>nul') do if exist %%i set "WebMediaExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*.*xbundle" 2^>nul') do if exist %%i set "WebpImageExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Whiteboard*.*xbundle" 2^>nul') do if exist %%i set "Whiteboard_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.SecHealthUI*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "WindowsDefender_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsStore*.*xbundle" 2^>nul') do if exist %%i set "WindowsStore_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsSubsystemForAndroid*.*xbundle" 2^>nul') do if exist %%i set "WindowsSubsystemForAndroid_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsSubsystemForLinux*.*xbundle" 2^>nul') do if exist %%i set "WindowsSubsystemForLinux_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxApp*.*xbundle" 2^>nul') do if exist %%i set "Xbox_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGameOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxGameOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGamingOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxGamingOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxIdentityProvider*.*xbundle" 2^>nul') do if exist %%i set "XboxIdentityProvider_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxLIVEGames*.*xbundle" 2^>nul') do if exist %%i set "XboxLiveGames_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxSpeechToTextOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxSpeechToTextOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Xbox.TCUI*.*xbundle" 2^>nul') do if exist %%i set "XboxTCUI_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *YourPhone*.*xbundle" 2^>nul') do if exist %%i set "YourPhone_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneMusic*.*xbundle" 2^>nul') do if exist %%i set "ZuneMusic_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneVideo*.*xbundle" 2^>nul') do if exist %%i set "ZuneVideo_Appx=%Apps%\%%i"

for /f %%i IN ('"dir /b *AMDLink*.*msix" 2^>nul') do if exist %%i set "AMDLink_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HPSupportAssistant*.*xbundle" 2^>nul') do if exist %%i set "HPSupportAssistant_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *IntelGraphicsExperience*.*xbundle" 2^>nul') do if exist %%i set "IntelGraphicsCommandCenter_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ThunderboltControlCenter*.*xbundle" 2^>nul') do if exist %%i set "IntelThunderboltController_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *KillerControlCenter*.*xbundle" 2^>nul') do if exist %%i set "KillerControlCenter_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *NVIDIAControlPanel*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "NVIDIAControlPanel_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *RealtekAudioControl*.*xbundle" 2^>nul') do if exist %%i set "RealtekAudioControl_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MaxxAudioProforDell*.*xbundle" 2^>nul') do if exist %%i set "WavesMaxxAudioProforDell_Appx=%Apps%\%%i"

for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*%ImageArchitecture%*.Appx" 2^>nul') do set "AdvertisingXaml_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b *PlayReadyClient*%ImageArchitecture%*.appx" 2^>nul') do set "MediaPlayReadyClient22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.6*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeFramework16_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.7*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeFramework17_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeFramework22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.6*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeRuntime16_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.7*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeRuntime17_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*%ImageArchitecture%*.appx" 2^>nul') do set "NETNativeRuntime22_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "arm" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*arm*.appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "arm64" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*arm64*.appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "x86" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*x86*.appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "x64" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*x64*.appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml20_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml21_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.2*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.3*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml23_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.4*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml24_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.5*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml25_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.6*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml26_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.7*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml27_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.8*%ImageArchitecture%*.appx" 2^>nul') do set "UIXaml28_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00_*%ImageArchitecture%*.appx" 2^>nul') do set "VCLibs12_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00_*%ImageArchitecture%*.appx" 2^>nul') do set "VCLibs14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.110.00.UWPDesktop*%ImageArchitecture%*.appx" 2^>nul') do set "VCLibsUWPDesktop11_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00.UWPDesktop*%ImageArchitecture%*.appx" 2^>nul') do set "VCLibsUWPDesktop12_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*%ImageArchitecture%*.appx" 2^>nul') do set "VCLibsUWPDesktop14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WindowsAppRuntime.1.1*%ImageArchitecture%*.msix" 2^>nul') do set "WinAppRuntime11_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WindowsAppRuntime.1.2*%ImageArchitecture%*.msix" 2^>nul') do set "WinAppRuntime12_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WindowsAppRuntime.1.3*%ImageArchitecture%*.msix" 2^>nul') do set "WinAppRuntime13_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WindowsAppRuntime.1.4*%ImageArchitecture%*.msix" 2^>nul') do set "WinAppRuntime14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WinJS.2*.appx" 2^>nul') do set "WinJS20_Appx=/DependencyPackagePath:%Apps%\%%i"

cd /d "%ROOT%\"

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Default Inbox Apps###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Default Inbox Apps###################################
echo.-------------------------------------------------------------------------------

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.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		:: Integrating Windows 8.1 Default Inbox Apps to Install Image File
		if "%SelectedSourceOS%" equ "w81" (
			if "%I_Alarms%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms and Clock", "%Alarms_Appx%", "%VCLibs12_Appx%", "%Alarms_License%"
			if "%I_BingFinance%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Finance", "%BingFinance_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFinance_License%"
			if "%I_BingFoodDrink%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Food and Drink", "%BingFoodDrink_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFoodDrink_License%"
			if "%I_BingHealthFitness%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Health and Fitness", "%BingHealthFitness_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingHealthFitness_License%"
			if "%I_BingMaps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Maps", "%BingMaps_Appx%", "%VCLibs12_Appx%", "%BingMaps_License%"
			if "%I_BingNews%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing News", "%BingNews_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingNews_License%"
			if "%I_BingSports%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Sports", "%BingSports_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingSports_License%"
			if "%I_BingTravel%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Travel", "%BingTravel_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingTravel_License%"
			if "%I_BingWeather%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Weather", "%BingWeather_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingWeather_License%"
			if "%I_Calculator%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", "%Calculator_Appx%", "%VCLibs12_Appx%", "%Calculator_License%"
			if "%I_CommunicationsApps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calender, Mail and People", "%CommunicationsApps_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%CommunicationsApps_License%"
			if "%I_HelpAndTips%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Help and Tips", "%HelpAndTips_Appx%", "%VCLibs12_Appx%", "%HelpAndTips_License%"
			if "%I_OneNote%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office OneNote", "%OneNote_Appx%", "%VCLibs12_Appx%", "%OneNote_License%"
			if "%I_Reader%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reader", "%Reader_Appx%", "%VCLibs12_Appx%", "%Reader_License%"
			if "%I_ReadingList%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reading List", "%ReadingList_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%ReadingList_License%"
			if "%I_Scan%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Scan", "%Scan_Appx%", "%VCLibs12_Appx%", "%Scan_License%"
			if "%I_SkypeApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype App", "%SkypeApp_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%SkypeApp_License%"
			if "%I_SoundRecorder%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sound Recorder", "%SoundRecorder_Appx%", "%VCLibs12_Appx%", "%SoundRecorder_License%"
			if "%I_XboxLiveGames%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live Games", "%XboxLiveGames_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%XboxLiveGames_License%"
			if "%I_ZuneMusic%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Music", "%ZuneMusic_Appx%", "%MediaPlayReadyClient22_Appx% %VCLibs12_Appx% %WinJS20_Appx%", "%ZuneMusic_License%"
			if "%I_ZuneVideo%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Video", "%ZuneVideo_Appx%", "%MediaPlayReadyClient22_Appx% %VCLibs12_Appx% %WinJS20_Appx%", "%ZuneVideo_License%"
		)

		:: Integrating Windows 10/11 Default Inbox Apps to Install Image
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if "%I_Alarms%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms and Clock", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx% %WinAppRuntime12_Appx%", "%Alarms_License%"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx% %WinAppRuntime13_Appx%", "%Alarms_License%"
			)
			if "%I_AmazonAppStore%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Amazon App Store", "%AmazonAppStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "/SkipLicense"
			if "%I_AV1VideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "AV1 Video Extension", "%AV1VideoExtension_Appx%", "", "%AV1VideoExtension_License%"
			if "%I_BingNews%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "News", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%BingNews_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "News", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingNews_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "News", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%BingNews_License%"
			)
			if "%I_BingSearch%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Search", "%BingSearch_Appx%", "%VCLibs14_Appx%", "%BingNews_License%"
			if "%I_BingWeather%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Weather", "%BingWeather_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%BingWeather_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Weather", "%BingWeather_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%BingWeather_License%"
			)
			if "%I_Calculator%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", "%Calculator_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%Calculator_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", "%Calculator_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Calculator_License%"
			)
			if "%I_Camera%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Camera", "%Camera_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Camera_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Camera", "%Camera_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Camera_License%"
			)
			if "%I_ClientWebExperience%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Web Experience Pack", "%ClientWebExperience_Appx%", "%VCLibs14_Appx%", "%ClientWebExperience_License%"
			if "%I_Clipchamp%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Clipchamp - Video Editor", "%Clipchamp_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Clipchamp_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Clipchamp - Video Editor", "%Clipchamp_Appx%", "", "%Clipchamp_License%"
			)
			if "%I_CommunicationsApps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mail and Calendar", "%CommunicationsApps_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%CommunicationsApps_License%"
			if "%I_Cortana%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Cortana", "%Cortana_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Cortana_License%"
			if "%I_D3DMappingLayers%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "OpenGL and OpenCL Compatibility Pack", "%D3DMappingLayers_Appx%", "", "%D3DMappingLayers_License%"
			if "%I_DesktopAppInstaller%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "App Installer", "%DesktopAppInstaller_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"
			if "%I_DevHome%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Dev Home", "%DevHome_Appx%", "%VCLibsUWPDesktop14_Appx% %WinAppRuntime13_Appx%", "/SkipLicense"
			if "%I_DirectXRuntime%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "DirectX Runtime", "%DirectXRuntime_Appx%", "", "/SkipLicense"
			if "%I_DolbyAudioExtensions%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Dolby Audio Extensions", "%DolbyAudioExtensions_Appx%", "", "%DolbyAudioExtensions_License%"
			if "%I_Family%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Family", "%Family_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Family_License%"
			if "%I_FeedbackHub%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Feedback Hub", "%FeedbackHub_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%FeedbackHub_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Feedback Hub", "%FeedbackHub_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%FeedbackHub_License%"
			)
			if "%I_GamingApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox App", "%GamingApp_Appx%", "%UIXaml23_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%GamingApp_License%"
			if "%I_GetHelp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Help", "%GetHelp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%GetHelp_License%"
			if "%I_Getstarted%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Tips", "%Getstarted_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Getstarted_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Tips", "%Getstarted_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Getstarted_License%"
			)
			if "%I_HEIFImageExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extensions", "%HEIFImageExtension_Appx%", "", "%HEIFImageExtension_License%"
			if "%I_HEVCVideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extensions", "%HEVCVideoExtension_Appx%", "", "%HEVCVideoExtension_License%"
			if "%I_Journal%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Journal", "%Journal_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Journal_License%"
			if "%I_Maps%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Maps", "%Maps_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml23_Appx% %VCLibs14_Appx%", "%Maps_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Maps", "%Maps_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%Maps_License%"
			)
			if "%I_Messaging%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Messaging", "%Messaging_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %UIXaml20_Appx% %VCLibs14_Appx%", "%Messaging_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Messaging", "%Messaging_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%Messaging_License%"
			)
			if "%I_MicrosoftDefender%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Defender", "%MicrosoftDefender_Appx%", "", "/SkipLicense"
			if "%I_MicrosoftPowerBI%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Power BI", "%MicrosoftPowerBI_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MicrosoftPowerBI_License%"
			if "%I_MinecraftEducationEdition%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Minecraft Education", "%MinecraftEducationEdition_Appx%", "%VCLibsUWPDesktop14_Appx%", "%MinecraftEducationEdition_License%"
			if "%I_MixedRealityPortal%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mixed Reality Portal", "%MixedRealityPortal_Appx%", "%VCLibs14_Appx%", "%MixedRealityPortal_License%"
			if "%I_MixedRealityViewer%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "3D Viewer", "%MixedRealityViewer_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MixedRealityViewer_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "3D Viewer", "%MixedRealityViewer_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MixedRealityViewer_License%"
			)
			if "%I_MPEG2VideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG-2 Video Extension", "%MPEG2VideoExtension_Appx%", "", "%MPEG2VideoExtension_License%"
			if "%I_Notepad%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Notepad", "%Notepad_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Notepad_License%"
			if "%I_OfficeHub%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "My Office", "%OfficeHub_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OfficeHub_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office", "%OfficeHub_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OfficeHub_License%"
			)
			if "%I_OfficeOneNote%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "OneNote", "%OfficeOneNote_Appx%", "%VCLibs14_Appx%", "%OfficeOneNote_License%"
			if "%I_OneConnect%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mobile Plans", "%OneConnect_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OneConnect_License%"
			if "%I_OutlookForWindows%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Outlook For Windows", "%OutlookForWindows_Appx%", "", ""%OutlookForWindows_License%"
			if "%I_Paint%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paint", "%Paint_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Paint_License%"
			if "%I_Paint3D%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paint 3D", "%Paint3D_Appx%", "%UIXaml20_Appx% %VCLibs14_Appx%", "%Paint3D_License%"
			if "%I_People%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "People", "%People_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%People_License%"
			if "%I_Photos%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Photos", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Photos_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Photos", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %ServicesStoreEngagement_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Photos_License%"
			)
			if "%I_PowerAutomateDesktop%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Power Automate", "%PowerAutomateDesktop_Appx%", "%VCLibsUWPDesktop14_Appx%", "%PowerAutomateDesktop_License%"
			if "%I_Print3D%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Print 3D", "%Print3D_Appx%", "%VCLibs14_Appx%", "%Print3D_License%"
			if "%I_QuickAssist%" equ "+" if "%ImageBuild%" geq "22621" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Quick Assist", "%QuickAssist_Appx%", "%VCLibsUWPDesktop14_Appx%", "%QuickAssist_License%"
			if "%I_RawImageExtension%" equ "+" (
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Raw Image Extension", "%RawImageExtension_Appx%", "%VCLibs14_Appx%", "%RawImageExtension_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Raw Image Extension", "%RawImageExtension_Appx%", "", "%RawImageExtension_License%"
			)
			if "%I_ScreenSketch%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Snip and Sketch", "%ScreenSketch_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Snipping Tool", "%ScreenSketch_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx% %WinAppRuntime13_Appx%", "%ScreenSketch_License%"
			)
			if "%I_SkypeApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype", "%SkypeApp_Appx%", "", "%SkypeApp_License%"
			if "%I_SolitaireCollection%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Solitaire Collection", "%SolitaireCollection_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%SolitaireCollection_License%"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Solitaire Collection", "%SolitaireCollection_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%SolitaireCollection_License%"
			)
			if "%I_SoundRecorder%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Voice Recorder", "%SoundRecorder_Appx%", "%UIXaml23_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Voice Recorder", "%SoundRecorder_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
			)
			if "%I_StickyNotes%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sticky Notes", "%StickyNotes_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StickyNotes_License%"
			if "%I_StorePurchaseApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Store Experience Host", "%StorePurchaseApp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%StorePurchaseApp_License%"
			if "%I_Teams%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Teams", "%Teams_Appx%", "", "/SkipLicense"
			if "%I_Terminal%" equ "+" (
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Terminal", "%Terminal_Appx%", "%VCLibs14_Appx%", "%Terminal_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Terminal", "%Terminal_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx%", "%Terminal_License%"
				call :MountImageRegistry "%InstallMount%\%%i"
				reg add "HKLM\TK_SYSTEM\ControlSet001\Services\condrv" /v "Start" /t REG_DWORD /d "2" /f >nul
				call :UnMountImageRegistry
			)
			if "%I_Todos%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft To Do", "%Todos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %ServicesStoreEngagement_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Todos_License%"
			if "%I_VP9VideoExtensions%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extensions", "%VP9VideoExtensions_Appx%", "", "%VP9VideoExtensions_License%"
			if "%I_Wallet%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Pay", "%Wallet_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Wallet_License%"
			if "%I_WebMediaExtensions%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Web Media Extensions", "%WebMediaExtensions_Appx%", "%VCLibs14_Appx%", "%WebMediaExtensions_License%"
			if "%I_WebpImageExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extensions", "%WebpImageExtension_Appx%", "", "%WebpImageExtension_License%"
			if "%I_Whiteboard%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Whiteboard", "%Whiteboard_Appx%", "", "%Whiteboard_License%"
			if "%I_WindowsDefender%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Defender Dashboard", "%WindowsDefender_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsDefender_License%"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Defender Dashboard", "%WindowsDefender_Appx%", "%UIXaml27_Appx% %VCLibs14_Appx%", "%WindowsDefender_License%"
			)
			if "%I_WindowsStore%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Store", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Microsoft Store", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
			)
			if "%I_WindowsSubsystemForAndroid%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Subsystem For Android", "%WindowsSubsystemForAndroid_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "/SkipLicense"
			if "%I_WindowsSubsystemForLinux%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Subsystem For Linux", "%WindowsSubsystemForLinux_Appx%", "", "%WindowsSubsystemForLinux_License%"
			if "%I_Xbox%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox App - Xbox Console Companion", "%Xbox_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Xbox_License%"
			if "%I_XboxGameOverlay%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Bar Plugin", "%XboxGameOverlay_Appx%", "%VCLibs14_Appx%", "%XboxGameOverlay_License%"
			if "%I_XboxGamingOverlay%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Bar", "%XboxGamingOverlay_Appx%", "%UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%XboxGamingOverlay_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Bar", "%XboxGamingOverlay_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%XboxGamingOverlay_License%"
			)
			if "%I_XboxIdentityProvider%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Identity Provider", "%XboxIdentityProvider_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxIdentityProvider_License%"
			if "%I_XboxSpeechToTextOverlay%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Speech Window", "%XboxSpeechToTextOverlay_Appx%", "%VCLibs14_Appx%", "%XboxSpeechToTextOverlay_License%"
			if "%I_XboxTCUI%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live", "%XboxTCUI_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxTCUI_License%"
			if "%I_YourPhone%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Your Phone", "%YourPhone_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%YourPhone_License%"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Your Phone", "%YourPhone_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx% %WinAppRuntime13_Appx%", "%YourPhone_License%"
			)
			if "%I_ZuneMusic%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Groove Music", "%ZuneMusic_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
					set PackageName=
					for /f "tokens=2 delims=: " %%a in ('%DISM% /Image:%InstallMount%\%%i /Get-ProvisionedAppxPackages ^| find /I "PackageName : Microsoft.ZuneMusic"') do (set PackageName=%%a)
					if "!PackageName!" neq "" %DISM% /Image:"%InstallMount%\%%i" /Remove-ProvisionedAppxPackage /PackageName:!PackageName! >nul
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Media Player", "%ZuneMusic_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
				)
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Windows Media Player", "%ZuneMusic_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
			)
			if "%I_ZuneVideo%" equ "+" (
				if "%ImageBuild%" equ "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Movies and TV", "%ZuneVideo_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Movies and TV", "%ZuneVideo_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Films and TV", "%ZuneVideo_Appx%", "%UIXaml28_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Movies and TV", "%ZuneVideo_Appx%", "%UIXaml28_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
			)

			if "%I_AMDLink%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "AMD Link", "%AMDLink_Appx%", "%VCLibsUWPDesktop14_Appx%", "%AMDLink_License%"
			if "%I_HPSupportAssistant%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HP Support Assistant 9", "%HPSupportAssistant_Appx%", "%NETNativeFramework13_Appx% %NETNativeRuntime13_Appx% %NETNativeFramework14_Appx% %NETNativeRuntime14_Appx% %VCLibs14_Appx%", "%HPSupportAssistant_License%"
			if "%I_IntelGraphicsCommandCenter%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Intel Graphics Command Center", "%IntelGraphicsCommandCenter_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%IntelGraphicsCommandCenter_License%"
			if "%I_IntelThunderboltController%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Intel Thunderbolt Controller", "%IntelThunderboltController_Appx%", "%NETNativeFramework21_Appx% %NETNativeRuntime21_Appx% %VCLibs14_Appx%", "%IntelThunderboltController_License%"
			if "%I_KillerControlCenter%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Rivet Networks Killer Control Center", "%KillerControlCenter_Appx%", "", "%KillerControlCenter_License%"
			if "%I_NVIDIAControlPanel%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "NVIDIA Control Panel", "%NVIDIAControlPanel_Appx%", "", "%NVIDIAControlPanel_License%"
			if "%I_RealtekAudioControl%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Realtek Audio Console", "%RealtekAudioControl_Appx%", "%VCLibs14_Appx%", "%RealtekAudioControl_License%"
			if "%I_WavesMaxxAudioProforDell%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Waves MaxxAudio Pro for Dell 2020", "%WavesMaxxAudioProforDell_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%WavesMaxxAudioProforDell_License%"

			echo.-------------------------------------------------------------------------------
			echo.Optimizing Microsoft Default Inbox Apps...
			echo.-------------------------------------------------------------------------------
			%DISM% /Image:"%InstallMount%\%%i" /Optimize-ProvisionedAppxPackages
			echo.
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Default Inbox Apps##########################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Apps=

set Alarms_Appx=
set AmazonAppStore_Appx=
set AV1VideoExtension_Appx=
set BingFinance_Appx=
set BingFoodDrink_Appx=
set BingHealthFitness_Appx=
set BingMaps_Appx=
set BingNews_Appx=
set BingSports_Appx=
set BingTravel_Appx=
set BingWeather_Appx=
set Calculator_Appx=
set Camera_Appx=
set ClientWebExperience_Appx=
set Clipchamp_Appx=
set CommunicationsApps_Appx=
set Cortana_Appx=
set D3DMappingLayers_Appx=
set DesktopAppInstaller_Appx=
set DevHome_Appx=
set DirectXRuntime_Appx=
set DolbyAudioExtensions_Appx=
set Family_Appx=
set FeedbackHub_Appx=
set GamingApp_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_Appx=
set HelpAndTips_Appx=
set HEVCVideoExtension_Appx=
set Journal_Appx=
set Maps_Appx=
set Messaging_Appx=
set MicrosoftDefender_Appx=
set MicrosoftPowerBI_Appx=
set MinecraftEducationEdition_Appx=
set MixedRealityPortal_Appx=
set MixedRealityViewer_Appx=
set MPEG2VideoExtension_Appx=
set Notepad_Appx=
set OfficeHub_Appx=
set OfficeOneNote_Appx=
set OneConnect_Appx=
set OutlookForWindows_Appx=
set Paint_Appx=
set Paint3D_Appx=
set People_Appx=
set Photos_Appx=
set PowerAutomateDesktop_Appx=
set Print3D_Appx=
set QuickAssist_Appx=
set RawImageExtension_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set SkypeApp_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set StorePurchaseApp_Appx=
set Teams_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set Whiteboard_Appx=
set WindowsDefender_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set WindowsSubsystemForLinux_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set AMDLink_Appx=
set HPSupportAssistant_Appx=
set IntelGraphicsCommandCenter_Appx=
set IntelThunderboltController_Appx=
set KillerControlCenter_Appx=
set NVIDIAControlPanel_Appx=
set RealtekAudioControl_Appx=
set WavesMaxxAudioProforDell_Appx=

set AdvertisingXaml_Appx=
set MediaPlayReadyClient22_Appx=
set NETNativeFramework16_Appx=
set NETNativeFramework17_Appx=
set NETNativeFramework22_Appx=
set NETNativeRuntime16_Appx=
set NETNativeRuntime17_Appx=
set NETNativeRuntime22_Appx=
set ServicesStoreEngagement_Appx=
set UIXaml20_Appx=
set UIXaml21_Appx=
set UIXaml22_Appx=
set UIXaml23_Appx=
set UIXaml24_Appx=
set UIXaml25_Appx=
set UIXaml26_Appx=
set UIXaml27_Appx=
set UIXaml28_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibs14_Appx=
set VCLibsUWPDesktop14_Appx=
set WinAppRuntime11_Appx=
set WinAppRuntime12_Appx=
set WinAppRuntime13_Appx=
set WinAppRuntime14_Appx=
set WinJS20_Appx=

endlocal

:: Resetting Microsoft Default Inbox Apps status flags
for %%i in (I_3DViewer,I_Alarms,I_AmazonAppStore,I_AV1VideoExtension,I_BingFinance,I_BingFoodDrink,I_BingHealthFitness,I_BingMaps,I_BingNews,I_BingSearch,I_BingSports,I_BingTravel,I_BingWeather,I_Calculator,I_Camera,I_ClientWebExperience,I_Clipchamp,I_CommunicationsApps,I_Cortana,I_D3DMappingLayers,I_DesktopAppInstaller,I_DevHome,I_DirectXRuntime,I_DolbyAudioExtensions,I_Family,I_FeedbackHub,I_GamingApp,I_GetHelp,I_Getstarted,I_HEIFImageExtension,I_HelpAndTips,I_HEVCVideoExtension,I_Journal,I_Maps,I_Messaging,I_MicrosoftDefender,I_MicrosoftPowerBI,I_MinecraftEducationEdition,I_MixedRealityPortal,I_MPEG2VideoExtension,I_Notepad,I_OfficeHub,I_OfficeOneNote,I_OneConnect,I_OutlookForWindows,I_Paint,I_Paint3D,I_People,I_Photos,I_PowerAutomateDesktop,I_Print3D,I_QuickAssist,I_RawImageExtension,I_Reader,I_ReadingList,I_Scan,I_ScreenSketch,I_SkypeApp,I_SolitaireCollection,I_SoundRecorder,I_StickyNotes,I_StorePurchaseApp,I_Teams,I_Terminal,I_Todos,I_VP9VideoExtensions,I_Wallet,I_WebMediaExtensions,I_WebpImageExtension,I_Whiteboard,I_WindowsDefender,I_WindowsStore,I_WindowsSubsystemForAndroid,I_WindowsSubsystemForLinux,I_Xbox,I_XboxGameOverlay,I_XboxGamingOverlay,I_XboxIdentityProvider,I_XboxLiveGames,I_XboxSpeechToTextOverlay,I_XboxTCUI,I_YourPhone,I_ZuneMusic,I_ZuneVideo,I_AMDLink,I_HPSupportAssistant,I_IntelGraphicsCommandCenter,I_IntelThunderboltController,I_KillerControlCenter,I_NVIDIAControlPanel,I_RealtekAudioControl,I_WavesMaxxAudioProforDell) do (
	set "%%i=-"
)

:: Returning to Integrate Microsoft Default Inbox Apps Menu
goto :IntInboxAppsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows 8.1 Media Center Generic Activation Tokens to Install Image
::-------------------------------------------------------------------------------------------
:IntWMCGActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo. MSMG ToolKit - Integrate Windows 8.1 Media Center Generic Activation Tokens
	echo.===============================================================================
	echo.
	echo.
	echo.                            I N F O R M A T I O N
	echo.                            =====================
	echo.
	echo.  Windows 8.1 Media Center Generic Activation Tokens are Generic Tokens data
	echo.  files that have been extracted from an Un-Activated Windows 8.0 Pro WMC
	echo.  OS upgraded to Windows 8.1 Pro WMC OS through Windows Store upgrade method.
	echo.
	echo.  Since Windows 8.1 Pro OS doesn't accepts Windows 8.0 Pro WMC or WMC Add-on
	echo.  Keys to install the OS, These Generic Tokens helps to make Windows Setup to
	echo.  accept and install Windows 8.0 Pro WMC or WMC Add-on Keys for installation.
	echo.
	echo.  Later the installed OS can be directly activated through Online or Phone
	echo.  activation method.
	echo.
	echo.
	echo.  To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntCustomFeaturesMenu
)

setlocal

cls
echo.===============================================================================
echo.  MSMG ToolKit - Integrate Windows 8.1 Media Center Generic Activation Tokens
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows 8.1 Media Center Generic Activation Tokens#####
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows 8.1 Media Center Generic Activation Tokens#############
echo.-------------------------------------------------------------------------------
echo.

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if "%ImageEdition%" equ "ProfessionalWMC" call :ApplyImage "%WMCGActTokens%", 1, "%InstallMount%\%%i"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows 8.1 Media Center Generic Activation Tokens####
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Pre-Activation Data
::-------------------------------------------------------------------------------------------
:IntPreActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - Integrate Windows 8.1 Pre-Activation Data
	echo.===============================================================================
	echo.
	echo. MSMG ToolKit will allow you to integrate your system activation details to
	echo. Windows Installation Disc Image to perform auto activation of system without
	echo. any need to activate online or through phone activation.
	echo.
	echo. Note: When you make any changes to your System Hardware, then the activation
	echo. status will be Lost.
	echo.
	echo. Requirements:
	echo. -------------
	echo. 1^) Windows Product Key
	echo.
	echo. 2^) Latest Pre-Activated Tokens files from Windows Activated System Drive
	echo.
	echo.    - "data.dat" from "<%SytemDrive%\Windows\System32\spp\store>" folder
	echo.    - "tokens.dat" from "<%SytemDrive%\Windows\System32\spp\store>" folder
	echo.    - "cache.dat" from "<%SytemDrive%\Windows\System32\spp\store>" folder
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntCustomFeaturesMenu
)

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - Integrate Windows 8.1 Pre-Activation Data
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Settings Windows Pre-Activation Details folder path
set "PreActTokens=%PreActTokens%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Windows Pre-Activation Token data files exist
if not exist "%PreActTokens%\data.dat" if not exist "%PreActTokens%\cache.dat" if not exist "%PreActTokens%\tokens.dat" (
	echo.Windows Pre-Activation Token files folder ^<Packs\PreActTokens\%SelectedSourceOS%\%ImageArchitecture%^> is empty
	echo.
	choice /C:YN /N /M "Do you want to copy Activation files from System Folder? ['Y'es/'N'o] : "
	if errorlevel 2 (
		echo.
		echo.Please copy Pre-Activation Token files to respective folder...
		goto :Stop
	)
	if errorlevel 1 (
		echo.
		echo.Copying Pre-Activation Token files from ^<System32\Spp\store\2.0^>
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\data.dat" %PreActTokens% >nul
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\tokens.dat" %PreActTokens% >nul
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\cache\cache.dat" %PreActTokens% >nul
	)
)

cls
echo.===============================================================================
echo.           MSMG ToolKit - Integrate Windows 8.1 Pre-Activation Data
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows 8.1 Pre-Activation Data########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting Windows 8.1 Activation Product Key Details#########################
echo.-------------------------------------------------------------------------------
echo.
set /p ProductKey=Enter the Product Key with the '-'s : 
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows 8.1 Pre-Activation Data################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows 8.1 Product Key [%ProductKey%]...
		echo.-------------------------------------------------------------------------------
		%DISM% /Image:"%InstallMount%\%%i" /Set-ProductKey:%ProductKey%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.Integrating Windows 8.1 Pre-Activated Token files...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Copying Windows 8.1 Pre-Activated Token files...
		Xcopy /O /H /R /K /Y %PreActTokens%\tokens.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\data.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\cache.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0\cache"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows 8.1 Pre-Activation Data#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set PreActTokens=
set ProductKey=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Terminal Server Patch
::-------------------------------------------------------------------------------------------
:IntCustomTerminalServer

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Microsoft Terminal Server Patch
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Terminal Server path according to selected Source OS
set "CustomTerminalServer=%CustomTerminalServer%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Microsoft Terminal Server Patch Pack file exist
if not exist "%CustomTerminalServer%\termsrv.dll" (
	echo.Microsoft Terminal Server Patch file "termsrv.dll" not found...
	echo.
	echo.Please copy the above file to ^<Custom\TerminalServer\%SelectedSourceOS%\%ImageArchitecture%^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Terminal Server Patch########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Terminal Server Patch################################
echo.-------------------------------------------------------------------------------

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.
		echo.-------------------------------------------------------------------------------
		echo.Copying Patched Microsoft Terminal Server [termsrv.dll] file...
		echo.-------------------------------------------------------------------------------
		echo.
		%XCopy% %CustomTerminalServer%\*.* "%InstallMount%\%%i\Windows\System32"
		echo.
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Terminal Server Patch Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d "0" /f >nul
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fSingleSessionPerUser" /t REG_DWORD /d "0" /f >nul
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Terminal Server Patch#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CustomTerminalServer=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom UxTheme Patch
::-------------------------------------------------------------------------------------------
:IntCustomUxTheme

setlocal

cls
echo.===============================================================================
echo.                MSMG ToolKit - Integrate Custom UxTheme Patch
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Custom UxTheme Patch Pack files path according to selected Source OS
set "CustomUxTheme=%CustomUxTheme%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom UxTheme Patch Pack file exist
if "%SelectedSourceOS%" equ "w7" (
	for %%i in (themeservice.dll, themeui.dll, uxtheme.dll) do (
		if not exist "%CustomUxTheme%\%%i" (
			echo.Custom UxTheme Patch file "%%i" not found...
			echo.
			echo.Please copy the above file to ^<Custom\UxTheme\%SelectedSourceOS%\%ImageArchitecture%^> folder...
			goto :Stop
		)
	)
)

:: Checking whether Custom UxTheme Patch Pack file exist
if "%SelectedSourceOS%" neq "w7" (
	for %%i in (themeui.dll, UXInit.dll, uxtheme.dll) do (
		if not exist "%CustomUxTheme%\%%i" (
			echo.Custom UxTheme Patch file "%%i" not found...
			echo.
			echo.Please copy the above file to ^<Custom\UxTheme\%SelectedSourceOS%\%ImageArchitecture%^> folder...
			goto :Stop
		)
	)
)
echo.-------------------------------------------------------------------------------
echo.####Started Integrating Custom UxTheme Patch###################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Custom UxTheme Patch###########################################
echo.-------------------------------------------------------------------------------

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.
		echo.Copying Custom UxTheme Patch files...
		echo.
		%XCopy% %CustomUxTheme%\*.* "%InstallMount%\%%i\Windows\System32"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Custom UxTheme Patch##################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CustomUxTheme=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom Windows Recovery Image
::-------------------------------------------------------------------------------------------
:IntCustomRecoveryImage

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Custom Windows Recovery Image
echo.===============================================================================
echo.

:: Checking whether Source Windows Recovery Image is selected
if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.Windows Recovery Image is selected...
	echo.
	echo.Please skip Windows Recovery Image while selecting Source...
	goto :Stop
)

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Custom Windows Recovery Image file path according to selected Source OS
set "RecoveryImage=%CustomRecoveryImage%\%SelectedSourceOS%\%ImageArchitecture%\winre.wim"

:: Checking whether Custom Windows Recovery Image file exist
if not exist "%RecoveryImage%" (
	echo.Custom Windows Recovery Image file "winre.wim" not found...
	echo.
	echo.Please copy the above file to ^<Custom\RecoveryImage\%SelectedSourceOS%\%ImageArchitecture%^> folder...
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####Started Integrating Custom Windows Recovery Image##########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Custom Windows Recovery Image##################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]====================
		if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
		echo.
		echo.Copying Custom Windows Recovery Environment ^(WinRE^) Image...
		copy /y "%RecoveryImage%" "%InstallMount%\%%i\Windows\System32\Recovery" >nul
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Custom Windows Recovery Image#########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set RecoveryImage=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom Default User Account Pictures
::-------------------------------------------------------------------------------------------
:IntUAP

setlocal

cls
echo.===============================================================================
echo.        MSMG ToolKit - Integrate Custom Default User Account Pictures
echo.===============================================================================
echo.

:: Setting Custom User Account Pictures path according to selected Source OS
set "UAP=%UAP%\%SelectedSourceOS%"

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.Custom Default User Account Pictures Pack file "user.bmp" not found...
		echo.
		echo.Please copy the above file to ^<Packs\UAP\%SelectedSourceOS%^> folder...
		goto :Stop
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.Custom Default User Account Pictures Pack file "user.bmp" not found...
		echo.
		echo.Please copy the above file to ^<Packs\UAP\%SelectedSourceOS%^> folder...
		goto :Stop
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w81" (
	for %%i in (guest.bmp, guest.png, user.bmp, user.png, user-40.png, user-200.png) do (
		if not exist "%UAP%\%%i" (
			echo.Custom Default User Account Pictures Pack file "%%i" not found...
			echo.
			echo.Please copy the above file to ^<Packs\UAP\%SelectedSourceOS%^> folder...
			goto :Stop
		)
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	for %%i in (guest.bmp, guest.png, user.bmp, user.png, user-32.png, user-40.png, user-48.png, user-192.png, user-200.png) do (
		if not exist "%UAP%\%%i" (
			echo.Custom Default User Account Pictures Pack file "%%i" not found...
			echo.
			echo.Please copy the above file to ^<Packs\UAP\%SelectedSourceOS%^> folder...
			goto :Stop
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Custom Default User Account Pictures###################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Custom Default User Account Pictures###########################
echo.-------------------------------------------------------------------------------

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.
		echo.Copying Custom Default User Account Pictures files...
		echo.

		if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server Core" (
			if "%ImageInstallationType%" neq "Server" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
			if "%ImageInstallationType%" equ "Server" %XCopy% %UAP%\user.bmp "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
		)

		if "%SelectedSourceOS%" neq "w7" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Custom Default User Account Pictures##################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set UAP=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom System Files
::-------------------------------------------------------------------------------------------
:IntCustomFiles

setlocal

cls
echo.===============================================================================
echo.                MSMG ToolKit - Integrate Custom System Files
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Custom System files path according to selected Source OS
set "CustomFiles=%CustomFiles%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom System files Pack file exist
for /f %%i in ('dir /b /s /a:-d "%CustomFiles%\*.*" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.Custom System files Pack folder is empty...
		echo.
		echo.Please copy the custom files to ^<Custom\Files\%SelectedSourceOS%\%ImageArchitecture%^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Custom System Files####################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Custom System Files############################################
echo.-------------------------------------------------------------------------------

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.
		echo.Copying Custom System files...
		echo.
		%XCopy% %CustomFiles%\*.* "%InstallMount%\%%i"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Custom System Files###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CustomFiles=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom Fonts
::-------------------------------------------------------------------------------------------
:IntCustomFonts

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Integrate Custom Fonts
echo.===============================================================================
echo.

:: Checking whether Custom Fonts Pack file exist
for /f %%i in ('dir /b /s /a:-d "%CustomFonts%\*.ttf" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.Custom Fonts Pack folder is empty...
		echo.
		echo.Please copy the font files to ^<Custom\Fonts^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Custom Fonts###########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Custom Fonts###################################################
echo.-------------------------------------------------------------------------------

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.
		call :MountImageRegistry "%InstallMount%\%%i"
		PowerShell -Executionpolicy Bypass -File "%Bin%\AddFonts.ps1" -mountPath "%InstallMount%\%%i\Windows\Fonts" -fontsPath "%CustomFonts%"
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Custom Fonts##########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Win32Calc Metro Skin
::-------------------------------------------------------------------------------------------
:IntWin32CalcMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Microsoft Win32Calc Metro Skin
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\Win32Calc"

:: Checking whether Microsoft Win32Calc Metro Skin Pack file exist
if not exist "%Skins%\Win32Calc.exe.res" (
	echo.Microsoft Win32Calc Metro Skin Pack file "Win32Calc.exe.res" not found...
	echo.
	echo.Please copy the above file to ^<Packs\Skins\Win32Calc^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Microsoft Win32Calc Metro Skin#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Microsoft Win32Calc Metro Skin#################################
echo.-------------------------------------------------------------------------------

copy /y "%ResourceHacker%" "%Temp%" >nul

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.
		echo.Copying Microsoft Win32Calc files to Temporary Folder...
		if "%ImageArchitecture%" equ "x86" copy /y "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc_x.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc64_x.exe" >nul
			copy /y "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" "%Temp%\Win32Calc32_x.exe" >nul
		)

		echo.
		echo.Applying Microsoft Win32Calc Metro Skin to [Win32Calc.exe] file...
		if "%ImageArchitecture%" equ "x86" (
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc_x.exe", "%Temp%\Win32Calc.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc_x.exe"
		)

		if "%ImageArchitecture%" equ "x64" (
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc32_x.exe", "%Temp%\Win32Calc32.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc32_x.exe"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc64_x.exe", "%Temp%\Win32Calc64.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc64_x.exe"
		)

		echo.
		echo.Copying Patched Microsoft Win32Calc files...
		if "%ImageArchitecture%" equ "x86" move /y "%Temp%\Win32Calc.exe" "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			move /y "%Temp%\Win32Calc64.exe" "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" >nul
			move /y "%Temp%\Win32Calc32.exe" "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" >nul
		)
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Microsoft Win32Calc Metro Skin########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Skins=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Icons Skin
::-------------------------------------------------------------------------------------------
:IntWIconsSkin

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - Integrate Windows Icons Skin
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\Icons"

:: Checking whether Windows Icons Skin Pack file exist
for %%i in (cmd.exe.res, imageres.dll.res, imagesp1.dll.res, mydocs.dll.res, snippingtool.exe.res, shell32.dll.res, taskmgr.exe.res, win32calc.exe.res, zipfldr.dll.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows Icons Skin Pack file "%%i" not found...
		echo.
		echo.Please copy the above file to ^<Packs\Skins\Icons^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Icons Skin#####################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Processing Windows Icons Resource Skin#####################################
echo.-------------------------------------------------------------------------------
echo.
echo.Copying Windows Icons resource files...
copy /y "%ResourceHacker%" "%Temp%" >nul

copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\cmd.exe" "%Temp%\cmd.bak" >nul
copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\SnippingTool.exe" "%Temp%\SnippingTool.bak" >nul
if exist "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" "%Temp%\win32calc.bak" >nul

if "%ImageArchitecture%" equ "x64" (
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\cmd.exe" "%Temp%\cmd_wow64.bak" >nul
	if exist "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" "%Temp%\win32calc_wow64.bak" >nul
)

if "%ImageBuild%" leq "17763" (
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\imageres.dll" "%Temp%\imageres.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\imagesp1.dll" "%Temp%\imagesp1.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\mydocs.dll" "%Temp%\mydocs.bak" >nul
	rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\shell32.dll" "%Temp%\shell32.bak" >nul
	rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\taskmgr.exe" "%Temp%\taskmgr.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\zipfldr.dll" "%Temp%\zipfldr.bak" >nul
	
	if "%ImageArchitecture%" equ "x64" (
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imageres.dll" "%Temp%\imageres_wow64.bak" >nul
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imagesp1.dll" "%Temp%\imagesp1_wow64.bak" >nul
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\mydocs.dll" "%Temp%\mydocs_wow64.bak" >nul
		rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\taskmgr.exe" "%Temp%\taskmgr_wow64.bak" >nul
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\zipfldr.dll" "%Temp%\zipfldr_wow64.bak" >nul
	)
	echo.
	echo.Patching [\Windows\System32\imageres.dll] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres.bak", "%Temp%\imageres.dll", "%Skins%\imageres.dll.res" ,,,
	call :RemoveFile "%Temp%\imageres.bak"
	echo.Patching [\Windows\System32\imagesp1.dll] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1.bak", "%Temp%\imagesp1.dll", "%Skins%\imagesp1.dll.res" ,,,
	call :RemoveFile "%Temp%\imagesp1.bak"
	echo.Patching [\Windows\System32\mydocs.dll] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs.bak", "%Temp%\mydocs.dll", "%Skins%\mydocs.dll.res" ,,,
	call :RemoveFile "%Temp%\mydocs.bak"
	rem echo.Patching [\Windows\System32\shell32.dll] file...
	rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\shell32.bak", "%Temp%\shell32.dll", "%Skins%\shell32.dll.res" ,,,
	rem call :RemoveFile "%Temp%\shell32.bak"
	rem echo.Patching [\Windows\System32\taskmgr.exe] file...
	rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr.bak", "%Temp%\taskmgr.exe", "%Skins%\taskmgr.exe.res" ,,,
	rem call :RemoveFile "%Temp%\taskmgr.bak"
	echo.Patching [\Windows\System32\zipfldr.dll] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr.bak", "%Temp%\zipfldr.dll", "%Skins%\zipfldr.dll.res" ,,,
	call :RemoveFile "%Temp%\zipfldr.bak"

	if "%ImageArchitecture%" equ "x64" (
		echo.Patching [\Windows\SysWOW64\imageres.dll] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres_wow64.bak", "%Temp%\imageres_wow64.dll", "%Skins%\imageres.dll.res" ,,,
		call :RemoveFile "%Temp%\imageres_wow64.bak"
		echo.Patching [\Windows\SysWOW64\imagesp1.dll] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1_wow64.bak", "%Temp%\imagesp1_wow64.dll", "%Skins%\imagesp1.dll.res" ,,,
		call :RemoveFile "%Temp%\imagesp1_wow64.bak"
		echo.Patching [\Windows\SysWOW64\mydocs.dll] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs_wow64.bak", "%Temp%\mydocs_wow64.dll", "%Skins%\mydocs.dll.res" ,,,
		call :RemoveFile "%Temp%\mydocs_wow64.bak"
		rem echo.Patching [\Windows\SysWOW64\taskmgr.exe] file...
		rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr_wow64.bak", "%Temp%\taskmgr_wow64.exe", "%Skins%\taskmgr.exe.res" ,,,
		rem call :RemoveFile "%Temp%\taskmgr_wow64.bak"
		echo.Patching [\Windows\SysWOW64\zipfldr.dll] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr_wow64.bak", "%Temp%\zipfldr_wow64.dll", "%Skins%\zipfldr.dll.res" ,,,
		call :RemoveFile "%Temp%\zipfldr_wow64.bak"
	)
)

echo.Patching [\Windows\System32\cmd.exe] file...
"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\cmd.bak", "%Temp%\cmd.exe", "%Skins%\cmd.exe.res" ,,,
call :RemoveFile "%Temp%\cmd.bak"
echo.Patching [\Windows\System32\SnippingTool.exe] file...
"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\SnippingTool.bak", "%Temp%\SnippingTool.exe", "%Skins%\snippingtool.exe.res" ,,,
call :RemoveFile "%Temp%\SnippingTool.bak"

if exist "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" (
	echo.Patching [\Windows\System32\win32calc.exe] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\win32calc.bak", "%Temp%\win32calc.exe", "%Skins%\win32calc.exe.res" ,,,
	call :RemoveFile "%Temp%\win32calc.bak"
)

if "%ImageArchitecture%" equ "x64" (
	echo.Patching [\Windows\SysWOW64\cmd.exe] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\cmd_wow64.bak", "%Temp%\cmd_wow64.exe", "%Skins%\cmd.exe.res" ,,,
	call :RemoveFile "%Temp%\cmd_wow64.bak"

	if exist "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" (
		echo.Patching [\Windows\SysWOW64\win32calc.exe] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\win32calc_wow64.bak", "%Temp%\win32calc_wow64.exe", "%Skins%\win32calc.exe.res" ,,,
		call :RemoveFile "%Temp%\win32calc_wow64.bak"
	)
)

if "%ImageBuild%" geq "18363" (
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imageres.dll.mun" "%Temp%\imageres.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imagesp1.dll.mun" "%Temp%\imagesp1.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\mydocs.dll.mun" "%Temp%\mydocs.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\shell32.dll.mun" "%Temp%\shell32.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\taskmgr.exe.mun" "%Temp%\taskmgr.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\zipfldr.dll.mun" "%Temp%\zipfldr.bak" >nul
	echo.
	echo.Patching [\Windows\SystemResources\imageres.dll.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres.bak", "%Temp%\imageres.dll.mun", "%Skins%\imageres.dll.res" ,,,
	call :RemoveFile "%Temp%\imageres.bak"
	echo.Patching [\Windows\SystemResources\imagesp1.dll.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1.bak", "%Temp%\imagesp1.dll.mun", "%Skins%\imagesp1.dll.res" ,,,
	call :RemoveFile "%Temp%\imagesp1.bak"
	echo.Patching [\Windows\SystemResources\mydocs.dll.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs.bak", "%Temp%\mydocs.dll.mun", "%Skins%\mydocs.dll.res" ,,,
	call :RemoveFile "%Temp%\mydocs.bak"
	echo.Patching [\Windows\SystemResources\shell32.dll.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\shell32.bak", "%Temp%\shell32.dll.mun", "%Skins%\shell32.dll.res" ,,,
	call :RemoveFile "%Temp%\shell32.bak"
	echo.Patching [\Windows\SystemResources\taskmgr.exe.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr.bak", "%Temp%\taskmgr.exe.mun", "%Skins%\taskmgr.exe.res" ,,,
	call :RemoveFile "%Temp%\taskmgr.bak"
	echo.Patching [\Windows\SystemResources\zipfldr.dll.mun] file...
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr.bak", "%Temp%\zipfldr.dll.mun", "%Skins%\zipfldr.dll.res" ,,,
	call :RemoveFile "%Temp%\zipfldr.bak"
)
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Icons Skin#############################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.Copying Patched Windows Icons files...
		echo.
		echo.Copying [\Windows\System32\cmd.exe] file...
		copy /y "%Temp%\cmd.exe" "%InstallMount%\%%i\Windows\System32\cmd.exe" >nul
		echo.Copying [\Windows\System32\SnippingTool.exe] file...
		copy /y "%Temp%\SnippingTool.exe" "%InstallMount%\%%i\Windows\System32\SnippingTool.exe" >nul

		if exist "%InstallMount%\%%i\Windows\System32\win32calc.exe" (
			echo.Copying [\Windows\System32\win32calc.exe] file...
			copy /y "%Temp%\win32calc.exe" "%InstallMount%\%%i\Windows\System32\win32calc.exe" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.Copying [\Windows\SysWOW64\cmd.exe] file...
			copy /y "%Temp%\cmd_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\cmd.exe" >nul

			if exist "%InstallMount%\%%i\Windows\SysWOW64\win32calc.exe" (
				echo.Copying [\Windows\SysWOW64\win32calc.exe] file...
				copy /y "%Temp%\Win32Calc_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" >nul
			)
		)

		if "%ImageBuild%" leq "17763" (
			echo.Copying [\Windows\System32\imageres.dll] file...
			copy /y "%Temp%\imageres.dll" "%InstallMount%\%%i\Windows\System32\imageres.dll" >nul
			echo.Copying [\Windows\System32\imagesp1.dll] file...
			copy /y "%Temp%\imagesp1.dll" "%InstallMount%\%%i\Windows\System32\imagesp1.dll" >nul
			echo.Copying [\Windows\System32\mydocs.dll] file...
			copy /y "%Temp%\mydocs.dll" "%InstallMount%\%%i\Windows\System32\mydocs.dll" >nul
			rem echo.Copying [\Windows\System32\shell32.dll] file...
			rem copy /y "%Temp%\shell32.dll" "%InstallMount%\%%i\Windows\System32\shell32.dll" >nul
			rem echo.Copying [\Windows\System32\taskmgr.exe] file...
			rem copy /y "%Temp%\taskmgr.exe" "%InstallMount%\%%i\Windows\System32\taskmgr.exe" >nul
			echo.Copying [\Windows\System32\zipfldr.dll] file...
			copy /y "%Temp%\zipfldr.dll" "%InstallMount%\%%i\Windows\System32\zipfldr.dll" >nul

			if "%ImageArchitecture%" equ "x64" (
				echo.Copying [\Windows\SysWOW64\imageres.dll] file...
				copy /y "%Temp%\imageres_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\imageres.dll" >nul
				echo.Copying [\Windows\SysWOW64\imagesp1.dll] file...
				copy /y "%Temp%\imagesp1_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\imagesp1.dll" >nul
				echo.Copying [\Windows\SysWOW64\mydocs.dll] file...
				copy /y "%Temp%\mydocs_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\mydocs.dll" >nul
				rem echo.Copying [\Windows\SysWOW64\taskmgr.exe] file...
				rem copy /y "%Temp%\taskmgr_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\taskmgr.exe" >nul
				echo.Copying [\Windows\SysWOW64\zipfldr.dll] file...
				copy /y "%Temp%\zipfldr_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\zipfldr.dll" >nul
			)
		)

		if "%ImageBuild%" geq "18363" (
			echo.Copying [\Windows\SystemResources\imageres.dll.mun] file...
			copy /y "%Temp%\imageres.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\imageres.dll.mun" >nul
			echo.Copying [\Windows\SystemResources\imagesp1.dll.mun] file...
			copy /y "%Temp%\imagesp1.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\imagesp1.dll.mun" >nul
			echo.Copying [\Windows\SystemResources\mydocs.dll.mun] file...
			copy /y "%Temp%\mydocs.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\mydocs.dll.mun" >nul
			echo.Copying [\Windows\SystemResources\shell32.dll.mun] file...
			copy /y "%Temp%\shell32.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\shell32.dll.mun" >nul
			echo.Copying [\Windows\SystemResources\taskmgr.exe.mun] file...
			copy /y "%Temp%\taskmgr.exe.mun" "%InstallMount%\%%i\Windows\SystemResources\taskmgr.exe.mun" >nul
			echo.Copying [\Windows\SystemResources\zipfldr.dll.mun] file...
			copy /y "%Temp%\zipfldr.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\zipfldr.dll.mun" >nul
		)
	)
)

for %%f in (cmd; cmd_wow64; imageres; imageres_wow64; imagesp1; imagesp1_wow64; SnippingTool; SnippingTool_wow64; shell32; shell32_wow64; taskmgr; taskmgr_wow64; Win32Calc; Win32Calc_wow64; zipfldr; zipfldr_wow64; ResourceHacker.exe; ResourceHacker.ini; ResourceHacker.log) do (
	call :RemoveFile "%Temp%\%%f"
	call :RemoveFile "%Temp%\%%f.bak"
	call :RemoveFile "%Temp%\%%f.dll"
	call :RemoveFile "%Temp%\%%f.exe"
	call :RemoveFile "%Temp%\%%f.dll.mun"
	call :RemoveFile "%Temp%\%%f.exe.mun"
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Icons Skin####################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Skins=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Photo Viewer Metro Skin
::-------------------------------------------------------------------------------------------
:IntWPVMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Windows Photo Viewer Metro Skin
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\PhotoViewer"

:: Checking whether Windows Photo Viewer Metro Skin Pack file exist
for %%i in (PhotoViewer.dll.res, photowiz.dll.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows Photo Viewer Metro Skin Pack file "%%i" not found...
		echo.
		echo.Please copy the above file to ^<Packs\Skins\PhotoViewer^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Photo Viewer Metro Skin########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Photo Viewer Metro Skin################################
echo.-------------------------------------------------------------------------------

copy /y "%ResourceHacker%" "%Temp%" >nul

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.
		echo.Copying Windows Photo Viewer files to Temporary Folder...
		if "%ImageArchitecture%" equ "x86" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer64_x.dll" >nul
			copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer32_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz64_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\SysWOW64\photowiz.dll" "%Temp%\photowiz32_x.dll" >nul
		)

		echo.
		if "%ImageArchitecture%" equ "x86" (
			echo.Applying Windows Photo Viewer Metro Skin to [PhotoViewer.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer_x.dll", "%Temp%\PhotoViewer.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer_x.dll"
			echo.
			echo.Applying Windows Photo Viewer Metro Skin to [photowiz.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz_x.dll", "%Temp%\photowiz.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz_x.dll"
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.Applying Windows Photo Viewer Metro Skin to [PhotoViewer.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer32_x.dll", "%Temp%\PhotoViewer32.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer64_x.dll", "%Temp%\PhotoViewer64.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer64_x.dll"
			echo.
			echo.Applying Windows Photo Viewer Metro Skin to [photowiz.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz32_x.dll", "%Temp%\photowiz32.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz64_x.dll", "%Temp%\photowiz64.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz64_x.dll"
		)

		echo.
		echo.Copying Patched Windows Photo Viewer files...
		if "%ImageArchitecture%" equ "x86" (
			move /y "%Temp%\PhotoViewer.dll" "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\photowiz.dll" "%InstallMount%\%%i\Windows\System32\photowiz.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			move /y "%Temp%\PhotoViewer64.dll" "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\PhotoViewer32.dll" "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\photowiz64.dll" "%InstallMount%\%%i\Windows\System32\photowiz.dll" >nul
			move /y "%Temp%\photowiz32.dll" "%InstallMount%\%%i\Windows\SysWOW64\photowiz.dll" >nul
		)
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Photo Viewer Metro Skin#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Skins=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Media Player Metro Skin
::-------------------------------------------------------------------------------------------
:IntWMPMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - Integrate Windows Media Player Metro Skin
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\MediaPlayer"

:: Checking whether Windows Media Player Metro Skin Pack file exist
for %%i in (setup_wm.exe.res, wmpconfig.exe.res, wmplayer.exe.res, wmploc.dll.res, wmpshare.exe.res, WMPSideShowGadget.exe.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows Media Player Metro Skin Pack file "%%i" not found...
		echo.
		echo.Please copy the above file to ^<Packs\Skins\MediaPlayer^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Started Integrating Windows Media Player Metro Skin########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Integrating Windows Media Player Metro Skin################################
echo.-------------------------------------------------------------------------------

copy /y "%ResourceHacker%" "%Temp%" >nul

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.
		echo.Copying Windows Media Player files to Temporary Folder...
		if "%ImageArchitecture%" equ "x86" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc64_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" "%Temp%\wmploc32_x.dll" >nul
		)

		echo.
		echo.Applying Windows Media Player Metro Skin to [setup_wm.exe] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\setup_wm_x.exe", "%Temp%\setup_wm.exe", "%Skins%\setup_wm.exe.res" ,,,
		call :RemoveFile "%Temp%\setup_wm_x.exe"
		echo.Applying Windows Media Player Metro Skin to [wmpconfig.exe] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpconfig_x.exe", "%Temp%\wmpconfig.exe", "%Skins%\wmpconfig.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpconfig_x.exe"
		echo.Applying Windows Media Player Metro Skin to [wmplayer.exe] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmplayer_x.exe", "%Temp%\wmplayer.exe", "%Skins%\wmplayer.exe.res" ,,,
		call :RemoveFile "%Temp%\wmplayer_x.exe"
		echo.Applying Windows Media Player Metro Skin to [wmpshare.exe] file...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpshare_x.exe", "%Temp%\wmpshare.exe", "%Skins%\wmpshare.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpshare_x.exe"

		if exist "%Temp%\WMPSideShowGadget_x.exe" (
			echo.Applying Windows Media Player Metro Skin to [WMPSideShowGadget.exe] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\WMPSideShowGadget_x.exe", "%Temp%\WMPSideShowGadget.exe", "%Skins%\WMPSideShowGadget.exe.res" ,,,
			call :RemoveFile "%Temp%\WMPSideShowGadget_x.exe"
		)

		if "%ImageArchitecture%" equ "x86" (
			echo.Applying Windows Media Player Metro Skin to [wmploc.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc_x.dll", "%Temp%\wmploc.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc_x.dll"
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.Applying Windows Media Player Metro Skin to [wmploc.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc32_x.dll", "%Temp%\wmploc32.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc64_x.dll", "%Temp%\wmploc64.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc64_x.dll"
		)

		echo.
		echo.Copying Patched Windows Media Player files...
		move /y "%Temp%\setup_wm.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" >nul
		move /y "%Temp%\wmpconfig.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" >nul
		move /y "%Temp%\wmplayer.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" >nul
		move /y "%Temp%\wmpshare.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" >nul
		if exist "%Temp%\WMPSideShowGadget.exe" move /y "%Temp%\WMPSideShowGadget.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" >nul
		if "%ImageArchitecture%" equ "x86" move /y "%Temp%\wmploc.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc64.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc32.dll" "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" >nul
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Integrating Windows Media Player Metro Skin#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Skins=

endlocal

:: Returning to Integrate Custom Features Menu
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Components Menu
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsMenu

:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - Remove Windows Components Menu
	echo.===============================================================================
	echo.
	echo.  [1]   Select Windows Components
	echo.
	echo.  [2]   Start Removing Windows Components
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [C]   Compatibility
	echo.
	echo.  [X]   Go Back
	echo.
	echo.  Components prefixed by * are locked for Compatibility, use the Compatibility
	echo.  menu to unlock the components.
	echo.
	echo.===============================================================================
	echo.
	choice /C:12CX /N /M "Enter Your Choice : "
	if errorlevel 4 goto :RemoveMenu
	if errorlevel 3 goto :ComponentsCompatibilityMenu
	if errorlevel 2 goto :RemoveWindowsComponents
	if errorlevel 1 goto :SelectWindowsComponentsMenu
)

:SelectWindowsComponentsMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - Remove Windows Components Menu
	echo.===============================================================================
	echo.  [1]   Internet
	echo.
	echo.  [2]   Multimedia
	echo.
	echo.  [3]   Network
	echo.
	echo.  [4]   Privacy
	echo.
	echo.  [5]   Remoting
	echo.
	echo.  [6]   System
	echo.
	echo.  [7]   System Apps
	echo.
	if "%ImageFlag%" equ "EnterpriseS" echo.
	if "%ImageFlag%" equ "EnterpriseSN" echo.

	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
		echo.  [8]   Windows Apps
	)
	echo.
	echo.
	echo.  [X]   Go Back
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "Enter Your Choice : "
	if errorlevel 9 goto :RemoveWindowsComponentsMenu
	if errorlevel 8 if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" goto :RemoveWindowsAppsMenu
	if errorlevel 7 goto :RemoveSystemAppsMenu
	if errorlevel 6 goto :RemoveSystemMenu
	if errorlevel 5 goto :RemoveRemotingMenu
	if errorlevel 4 goto :RemovePrivacyMenu
	if errorlevel 3 goto :RemoveNetworkMenu
	if errorlevel 2 goto :RemoveMultimediaMenu
	if errorlevel 1 goto :RemoveInternetMenu
)

:RemoveInternetMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Internet Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - Remove Internet Components Menu
	echo.===============================================================================
	echo.
	if "%SelectedSourceOS%" equ "w10" if "%ImageServicePackBuild%" equ "1" (
		echo.  [1] %C_AdobeFlashForWindows% Adobe Flash for Internet Explorer
		echo.        Adobe Flash Support for Internet Explorer.
		echo.
	)
	echo.  [2] %C_InternetExplorer% Internet Explorer
	echo.        Internet Explorer is an web browser that allows users to view web pages on the Internet.
	echo.        Compatibility : Adobe Installers
	echo.
	echo.  [3] %C_EdgeChromium% Microsoft Edge ^(Chromium^)
	echo.        Chromium-based Microsoft Edge web browser.
	echo.        Compatibility : Recommended
	echo.
	)
	if "%SelectedSourceOS%" equ "w11" (
		echo.  [4] %C_EdgeWebView% Microsoft Edge WebView
		echo.        The Microsoft Edge WebView control allows you to embed web technologies ^(HTML, CSS, and JavaScript^) in
		echo.        your native apps.
		echo.        Depends on    : Microsoft Edge ^(Chromium^)
		echo.        Compatibility : Recommended, Visual Studio
		echo.
	)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   All Internet Components
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" if "%SelectedSourceOS%" equ "w10" if "%ImageServicePackBuild%" equ "1" ( if "%C_AdobeFlashForWindows%" equ "+" ( set "C_AdobeFlashForWindows=-" ) else ( set "C_AdobeFlashForWindows=+" ) )
		if "%%#" equ "2" if "%C_InternetExplorer%" neq "*" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
		if "%%#" equ "3" if "%C_EdgeChromium%" neq "*" (
			if "%C_EdgeChromium%" equ "+" (
				set "C_EdgeChromium=-"
				if "%SelectedSourceOS%" equ "w11" (
					if "%C_EdgeWebView%" neq "*" set "C_EdgeWebView=-"
					set "C_ClientWebExperience=-"
				)
			) else (
				set "C_EdgeChromium=+"
			)
		)
		if "%%#" equ "4" if "%SelectedSourceOS%" equ "w11" if "%C_EdgeWebView%" neq "*" (
			if "%C_EdgeWebView%" equ "+" (
				set "C_ClientWebExperience=-"
				set "C_EdgeWebView=-"
			) else ( 
				if "%C_EdgeChromium%" neq "*" set "C_EdgeChromium=-"
				set "C_EdgeWebView=+"
			)
		)
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		if "%SelectedSourceOS%" equ "w10" if "%ImageServicePackBuild%" equ "1" set "C_AdobeFlashForWindows=-"
		if "%C_InternetExplorer%" neq "*" set "C_InternetExplorer=-"
		if "%C_EdgeChromium%" neq "*" set "C_EdgeChromium=-"
		if "%SelectedSourceOS%" equ "w11" (
			set "C_ClientWebExperience=-"
			if "%C_EdgeWebView%" neq "*" set "C_EdgeWebView=-"
		)
	)

	goto :RemoveInternetMenu
)

:RemoveMultimediaMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Multimedia Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - Remove Multimedia Components Menu
	echo.===============================================================================
	echo.
	echo.  [ 1] %C_FirstLogonAnimation% First Logon Animation
	echo.         The first sign-in animation is a series of messages that display on the screen when signing in after a
	echo.         major update, version change, or few new user accounts.
	echo.         Depends on    : Out-of-box Experience ^(OOBE^)
	echo.
	echo.  [ 2] %C_GameExplorer% Game Explorer
	echo.         Games Explorer is a feature that lets you see all games currently installed on your computer and find
	echo.         other games online.
	echo.         Compatibility : Microsoft Games
	echo.
	echo.  [ 3] %C_LockScreenBackground% Lock Screen Backgrounds
	echo.         Lock screen features a customizable wallpaper with a different image than that displayed on a desktop.
	echo.
	echo.  [ 4] %C_ScreenSavers% Screen Savers
	echo.         Screensavers are computer programs designed to blank the screen or fill it with moving images when you
	echo.         are not using it.
	echo.
	if "%SelectedSourceOS%" equ "w10" (
		echo.  [ 5] %C_SnippingTool% Snipping Tool
		echo.         Snipping Tool is a screenshot utility to take still screenshots of an open window, rectangular areas,
		echo.         a free-form area or the entire screen.
		echo.
	)
	echo.  [ 6] %C_SoundThemes% Sound Themes
	echo.         Various Windows theme shell sounds.
	echo.
	echo.  [ 7] %C_SpeechRecognition% Speech Recognition
	echo.         Speech recognition enables voice commands to control the desktop user interface, dictate text in 
	echo.         electronic documents and email, navigate websites, perform keyboard shortcuts, and operate the mouse cursor.
	echo.
	echo.  [ 8] %C_Wallpapers% Wallpapers Themes
	echo.         Various Windows theme desktop shell wallpapers.
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.  [ 9] %C_WindowsMediaPlayer% Windows Media Player
	if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [ 9] %C_WindowsMediaPlayer% Windows Media Player ^(Legacy^}
	echo.         Windows Media Player is a simple utility tool that lets you play audio and video files.
	echo.
	echo.  [10] %C_WindowsPhotoViewer% Windows Photo Viewer
	echo.         Windows Photo Viewer is a simple utility tool that lets you display image files.
	echo.
	echo.  [11] %C_WindowsThemes% Windows Personalization Themes
	echo.         Various Windows Personalization Themes.
	echo.
	echo.  [12] %C_WindowsTIFFIFilter% Windows TIFF IFilter ^(OCR^)
	echo.         Windows TIFF IFilter processes TIFF images and then provides the recognized text to the caller for
	echo.         building the search index.
	echo.
	echo.  [13] %C_WinSAT% Windows System Assessment  Tool ^(WinSAT^)
	echo.         Windows performance benchmark tool used to assess the performance characteristics and capabilities of a PC.
	echo.         Compatibility : Microsoft Games
	echo.
	echo.
	echo.  [A]    All Multimedia Components
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" (
			if "%C_FirstLogonAnimation%" equ "+" ( 
				set "C_FirstLogonAnimation=-"
			) else ( 
				if "%C_CloudExperienceHost%" neq "*" set "C_CloudExperienceHost=+"
				set "C_FirstLogonAnimation=+"
			)
		)
		if "%%#" equ "2" if "%C_GameExplorer%" neq "*" ( if "%C_GameExplorer%" equ "+" ( set "C_GameExplorer=-" ) else ( set "C_GameExplorer=+" ) )
		if "%%#" equ "3" ( if "%C_LockScreenBackground%" equ "+" ( set "C_LockScreenBackground=-" ) else ( set "C_LockScreenBackground=+" ) )
		if "%%#" equ "4" ( if "%C_ScreenSavers%" equ "+" ( set "C_ScreenSavers=-" ) else ( set "C_ScreenSavers=+" ) )
		if "%%#" equ "5" if "%SelectedSourceOS%" equ "w10" ( if "%C_SnippingTool%" equ "+" ( set "C_SnippingTool=-" ) else ( set "C_SnippingTool=+" ) )
		if "%%#" equ "6" ( if "%C_SoundThemes%" equ "+" ( set "C_SoundThemes=-" ) else ( set "C_SoundThemes=+" ) )
		if "%%#" equ "7" (
			if "%C_SpeechRecognition%" equ "+" ( 
				set "C_Narrator=-"
				set "C_NarratorQuickStart=-"
				set "C_SpeechRecognition=-"
				if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_VoiceAccess=-"
			) else ( 
				set "C_SpeechRecognition=+"
			)
		)
		if "%%#" equ "8" ( if "%C_Wallpapers%" equ "+" ( set "C_Wallpapers=-" ) else ( set "C_Wallpapers=+" ) )
		if "%%#" equ "9" ( if "%C_WindowsMediaPlayer%" equ "+" ( set "C_WindowsMediaPlayer=-" ) else ( set "C_WindowsMediaPlayer=+" ) )
		if "%%#" equ "10" ( if "%C_WindowsPhotoViewer%" equ "+" ( set "C_WindowsPhotoViewer=-" ) else ( set "C_WindowsPhotoViewer=+" ) )
		if "%%#" equ "11" ( if "%C_WindowsThemes%" equ "+" ( set "C_WindowsThemes=-" ) else ( set "C_WindowsThemes=+" ) )
		if "%%#" equ "12" ( if "%C_WindowsTIFFIFilter%" equ "+" ( set "C_WindowsTIFFIFilter=-" ) else ( set "C_WindowsTIFFIFilter=+" ) )
		if "%%#" equ "13" if "%C_WinSAT%" neq "*" ( if "%C_WinSAT%" equ "+" ( set "C_WinSAT=-" ) else ( set "C_WinSAT=+" ) )
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		set "C_FirstLogonAnimation=-"
		if "%C_GameExplorer%" neq "*" set "C_GameExplorer=-"
		set "C_LockScreenBackground=-"
		set "C_ScreenSavers=-"
		if "%SelectedSourceOS%" equ "w10" set "C_SnippingTool=-"
		set "C_SoundThemes=-"
		set "C_SpeechRecognition=-"
		if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_VoiceAccess=-"
		set "C_Wallpapers=-"
		set "C_WindowsMediaPlayer=-"
		set "C_WindowsPhotoViewer=-"
		set "C_WindowsThemes=-"
		set "C_WindowsTIFFIFilter=-"
		if "%C_WinSAT%" neq "*" set "C_WinSAT=-"
	)

	goto :RemoveMultimediaMenu
)

:RemoveNetworkMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Network Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - Remove Network Components Menu
	echo.===============================================================================
	echo.
	echo.  [1] %C_OfflineFiles% Offline Files
	echo.        Offline Files is a feature of Sync Center that makes network files available to a user, even if the
	echo.        is unavailable. This is useful if you use a laptop to connect to a network connection to the server 
	echo.        workplace network.
	echo.        Compatibility : Application Guard / Containers
	echo.
	echo.  [2] %C_OpenSSH% OpenSSH
	echo.        Open-source connectivity tool for remote login that uses the Secure Shell ^(SSH^) protocol.
	echo.
	echo.  [3] %C_RemoteDesktopClient% Remote Desktop Client
	echo.        Microsoft Remote Desktop client allows you can connect to Remote Desktop Services from Windows Server
	echo.        and remote PCs to use and control desktops and apps that your admin has made available to you.
	echo.        Compatibility : Recommended
	echo.
	echo.  [4] %C_RemoteDifferentialCompression% Remote Differential Compression ^(RDC^)
	echo.        Allows data to be synchronized with a remote source using compression techniques to minimize the 
	echo.        amount of data sent across the network.
	echo.  
	echo.  [5] %C_SimpleTCPIPServices% Simple TCP/IP Services
	echo.        Simple TCP/IP Services supports the following TCP/IP services: Character Generator, Daytime, Discard,
	echo.        Echo and Quote of the Day.
	echo.
	echo.  [6] %C_TelnetClient% Telnet Client
	echo.        The Telnet client enables a TCP/IP user to sign on and use applications on a remote system by using
	echo.        a Telnet server application.
	echo.
	echo.  [7] %C_TFTPClient% TFTP Client
	echo.        Trivial File Transfer Protocol ^(TFTP^) is a simple lockstep File Transfer Protocol which allows a client
	echo.        to get a file from or put a file onto a remote host.
	echo.
	echo.  [8] %C_WalletService% Wallet Service
	echo.        Backend needed for the Wallet app, Microsoft Windows payment system.
	echo.
	echo.  [9] %C_WindowsMail% Windows Mail
	echo.        Windows Mail is an email client.
	echo.
	echo.
	echo.
	echo.  [A]   All Network Components
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" if "%C_OfflineFiles%" neq "*" ( if "%C_OfflineFiles%" equ "+" ( set "C_OfflineFiles=-" ) else ( set "C_OfflineFiles=+" ) )
		if "%%#" equ "2" ( if "%C_OpenSSH%" equ "+" ( set "C_OpenSSH=-" ) else ( set "C_OpenSSH=+" ) )
		if "%%#" equ "3" if "%C_RemoteDesktopClient%" neq "*" ( if "%C_RemoteDesktopClient%" equ "+" ( set "C_RemoteDesktopClient=-" ) else ( set "C_RemoteDesktopClient=+" ) )
		if "%%#" equ "4" ( if "%C_RemoteDifferentialCompression%" equ "+" ( set "C_RemoteDifferentialCompression=-" ) else ( set "C_RemoteDifferentialCompression=+" ) )
		if "%%#" equ "5" ( if "%C_SimpleTCPIPServices%" equ "+" ( set "C_SimpleTCPIPServices=-" ) else ( set "C_SimpleTCPIPServices=+" ) )
		if "%%#" equ "6" ( if "%C_TelnetClient%" equ "+" ( set "C_TelnetClient=-" ) else ( set "C_TelnetClient=+" ) )
		if "%%#" equ "7" ( if "%C_TFTPClient%" equ "+" ( set "C_TFTPClient=-" ) else ( set "C_TFTPClient=+" ) )
		if "%%#" equ "8" (
			if "%C_WalletService%" equ "+" (
				set "C_Wallet=-"
				set "C_WalletService=-"
			) else (
				set "C_WalletService=+"
			)
		)
		if "%%#" equ "9" ( if "%C_WindowsMail%" equ "+" ( set "C_WindowsMail=-" ) else ( set "C_WindowsMail=+" ) )
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		if "%C_OfflineFiles%" neq "*" set "C_OfflineFiles=-"
		set "C_OpenSSH=-"
		if "%C_RemoteDesktopClient%" neq "*" set "C_RemoteDesktopClient=-"
		set "C_RemoteDifferentialCompression=-"
		set "C_SimpleTCPIPServices=-"
		set "C_TelnetClient=-"
		set "C_TFTPClient=-"
		set "C_Wallet=-"
		set "C_WalletService=-"
		set "C_WindowsMail=-"
	)

	goto :RemoveNetworkMenu
)

:RemovePrivacyMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Privacy Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - Remove Privacy Components Menu
	echo.===============================================================================
	echo.
	echo.  [ 1] %C_AssignedAccess% Assigned Access
	echo.         An administrator can use assigned access to limit an existing user account to use only one installed 
	echo.         Windows that you choose. This can be useful to set up single-function devices, such a resturtant menus
	echo.         or display at trade shows.
	echo.
	echo.  [ 2] %C_CEIP% Customer Experience Improvement Program ^(SQM^)
	echo.         Windows Customer Experience Improvement Program ^(SQM^) collects information about how Microsoft 
	echo.         customers use programs about some of the problems they encounter. Microsoft uses this information to
	echo.         improve the products and features customers use most often and to help solve problems.
	echo.
	echo.  [ 3] %C_FaceRecognition% Face Recognition ^(Windows Hello Face^)
	echo.         Windows Hello Face is a new way to sign in to your devices, apps, online services, and networks.
	echo.         It is more secure as it uses "biometric authentication" to sign in using your face.
	echo.
	echo.  [ 4] %C_KernelDebugging% Kernel Debugging
	echo.         A kernel debugger is a debugger used to ease debugging and kernel development by the kernel developers.
	echo.         Compatibility : Application Guard / Containers
	echo.
	echo.  [ 5] %C_LocationService% Location Service
	echo.         This service monitors the current location of the system and manages geo-fences ^(a geographical location
	echo.         with associated events^).
	echo.
	echo.  [ 6] %C_PicturePassword% Picture Password
	echo.         Sign in to Windows using a favorite photo. A picture password is a way of logging into Windows that
	echo.         involves using a picture of your choosing and gestures drawn on that picture, instead of a password.
	echo.
	echo.  [ 7] %C_PinEnrollment% Pin Sign-in Support
	echo.         A Microsoft Windows Hello Login Personal Identification Number ^(PIN^) is a set of numbers, or a 
	echo.         combination of letters and numbers, that you choose yourself. Using a PIN is a quick, secure way to sign
	echo.         in to your Windows device. Your PIN is securely stored on your device.
	echo.         Compatibility : Biometric
	echo.
	echo.  [ 8] %C_UnifiedTelemetryClient% Unified Telemetry Client
	echo.         Telemetry data collecting and reporting to Microsoft in order to improve Windows.
	echo.
	echo.  [ 9] %C_WiFiNetworkManager% Wi-Fi Network Manager ^(Wi-Fi Sense^)
	echo.         Provides ability to share your Wi-Fi passowrd automatically with your Outlook, Skype or Facebook contacts,
	echo.         enabling seamless Wi-Fi network usage between friends.
	echo.
	echo.  [10] %C_WindowsErrorReporting% Windows Error Reporting
	echo.         Infrastructure to capture crash dumps and optionally report them to Microsoft.
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.         Compatibility : Out-of-box Experience ^(OOBE^)
	echo.
	echo.  [11] %C_WindowsInsiderHub% Windows Insider Program
	echo.         The Windows Insider Program is a community of millions of Windows biggest fans who get to preview
	echo.         Windows features. While previewing Windows, Insiders can provide feedback and engage directly with
	echo.         Microsoft engineers to help shape the future of Windows.
	echo.
	echo.
	echo.  [A]    All Privacy Components
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" ( 
			if "%C_AssignedAccess%" equ "+" ( 
				set "C_AssignedAccess=-"
				if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" set "C_AssignedAccessLockApp=-"
			) else ( 
				set "C_AssignedAccess=+"
			)
		)
		if "%%#" equ "2" ( if "%C_CEIP%" equ "+" ( set "C_CEIP=-" ) else ( set "C_CEIP=+" ) )
		if "%%#" equ "3" ( if "%C_FaceRecognition%" equ "+" ( set "C_FaceRecognition=-" ) else ( set "C_FaceRecognition=+" ) )
		if "%%#" equ "4" if "%C_KernelDebugging%" neq "*" ( if "%C_KernelDebugging%" equ "+" ( set "C_KernelDebugging=-" ) else ( set "C_KernelDebugging=+" ) )
		if "%%#" equ "5" ( if "%C_LocationService%" equ "+" ( set "C_LocationService=-" ) else ( set "C_LocationService=+" ) )
		if "%%#" equ "6" ( if "%C_PicturePassword%" equ "+" ( set "C_PicturePassword=-" ) else ( set "C_PicturePassword=+" ) )
		if "%%#" equ "7" if "%C_PinEnrollment%" neq "*" ( if "%C_PinEnrollment%" equ "+" ( set "C_PinEnrollment=-" ) else ( set "C_PinEnrollment=+" ) )
		if "%%#" equ "8" ( if "%C_UnifiedTelemetryClient%" equ "+" ( set "C_UnifiedTelemetryClient=-" ) else ( set "C_UnifiedTelemetryClient=+" ) )
		if "%%#" equ "9" ( if "%C_WiFiNetworkManager%" equ "+" ( set "C_WiFiNetworkManager=-" ) else ( set "C_WiFiNetworkManager=+" ) )
		if "%%#" equ "10" if "%C_WindowsErrorReporting%" neq "*" ( if "%C_WindowsErrorReporting%" equ "+" ( set "C_WindowsErrorReporting=-" ) else ( set "C_WindowsErrorReporting=+" ) )
		if "%%#" equ "11" ( if "%C_WindowsInsiderHub%" equ "+" ( set "C_WindowsInsiderHub=-" ) else ( set "C_WindowsInsiderHub=+" ) )
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		set "C_AssignedAccess=-"
		if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" set "C_AssignedAccessLockApp=-"
		set "C_CEIP=-"
		set "C_FaceRecognition=-"
		if "%C_KernelDebugging%" neq "*" set "C_KernelDebugging=-"
		set "C_LocationService=-"
		set "C_PicturePassword=-"
		if "%C_PinEnrollment%" neq "*" set "C_PinEnrollment=-"
		set "C_UnifiedTelemetryClient=-"
		set "C_WiFiNetworkManager=-"
		if "%C_WindowsErrorReporting%" neq "*" set "C_WindowsErrorReporting=-"
		set "C_WindowsInsiderHub=-"
	)

	goto :RemovePrivacyMenu
)

:RemoveRemotingMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Remoting Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - Remove Remoting Components Menu
	echo.===============================================================================
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
		echo.  [1] %C_HomeGroup% HomeGroup
		echo.        A HomeGroup is a group of PCs on a home network that can share files and printers.
		echo.
	)
	echo.  [2] %C_MultiPointConnector% MultiPoint Connector
	echo.        Enables your machine to be monitored and managed by the MultiPoint Manager and Dashboard apps.
	echo.
	echo.  [3] %C_OneDrive% OneDrive Desktop Client
	echo.        OneDrive is a cloud storage, file hosting service that allows users to sync files and later access them
	echo.        from web browser or mobile devices.
	echo.
	echo.  [4] %C_RemoteAssistance% Remote Assistance
	echo.        Offers a convenient way for someone you trust. such as friend or techincal support person to connect to
	echo.        your computer and walk you through a solution.
	echo.
	echo.  [5] %C_RemoteDesktopServer% Remote Desktop Server
	echo.        Remote Desktop Services ^(RDS^) is an umbrella term for features of Microsoft Windows Server that allow
	echo.        users to remotely access graphical desktops and Windows applications.
	echo.        Compatibility : Application Guard / Containers, Hyper-V
	echo.
	echo.  [6] %C_RemoteRegistry% Remote Registry
	echo.        Enables remote users to modify registry settings on this computer.
	echo.
	echo.  [7] %C_WorkFoldersClient% Work Folders Client
	echo.        Allows a user to sync data to their device from their user folder located in the corporation's data center.
	echo.        Includes Active Directory Federation Services ^(ADFS^).
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   All Remoting Components
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" ( if "%C_HomeGroup%" equ "+" ( set "C_HomeGroup=-" ) else ( set "C_HomeGroup=+" ) )
		if "%%#" equ "2" ( if "%C_MultiPointConnector%" equ "+" ( set "C_MultiPointConnector=-" ) else ( set "C_MultiPointConnector=+" ) )
		if "%%#" equ "3" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
		if "%%#" equ "4" ( if "%C_RemoteAssistance%" equ "+" ( set "C_RemoteAssistance=-" ) else ( set "C_RemoteAssistance=+" ) )
		if "%%#" equ "5" if "%C_RemoteDesktopServer%" neq "*" ( if "%C_RemoteDesktopServer%" equ "+" ( set "C_RemoteDesktopServer=-" ) else ( set "C_RemoteDesktopServer=+" ) )
		if "%%#" equ "6" ( if "%C_RemoteRegistry%" equ "+" ( set "C_RemoteRegistry=-" ) else ( set "C_RemoteRegistry=+" ) )
		if "%%#" equ "7" ( if "%C_WorkFoldersClient%" equ "+" ( set "C_WorkFoldersClient=-" ) else ( set "C_WorkFoldersClient=+" ) )
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		if "%SelectedSourceOS%" equ "w10" set "C_HomeGroup=-"
		set "C_MultiPointConnector=-"
		set "C_OneDrive=-"
		set "C_RemoteAssistance=-"
		if "%C_RemoteDesktopServer%" neq "*" set "C_RemoteDesktopServer=-"
		set "C_RemoteRegistry=-"
		set "C_WorkFoldersClient=-"
	)

	goto :RemoveRemotingMenu
)

:RemoveSystemMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client System Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - Remove System Components Menu
	echo.===============================================================================
	echo.
	echo.  [ 1] %C_AccessibilityTools% Accessibility Tools ^(Ease of Access^)
	echo.         Accessibility wizard and tools can be used to configure your system to meet your vision, hearing and
	echo.         mobility needs. Includes basic accessibility features like Filter Keys.
	echo.
	if "%ImageFlag%" equ "EnterpriseS" (
		echo.  [ 2] %C_Calculator% Calculator ^(Legacy^)
		echo.         Windows Win32 Legacy Calculator.
		echo.
	)
	if "%ImageFlag%" equ "EnterpriseSN" (
		echo.  [ 2] %C_Calculator% Calculator ^(Legacy^)
		echo.         Windows Win32 Legacy Calculator.
		echo.
	)
	echo.  [ 3] %C_DeviceLockdown% Device Lockdown ^(Embedded Experience^)
	echo.         Includes Custom Logon, Keyboard Filters, Shell Launcher, Unbranded Boot and Unified Write Filter.
	echo.
	echo.  [ 4] %C_EaseOfAccessCursors% Ease of Access Cursors
	echo.         Mouse Pointers ^(Accessibility Tools^).
	echo.         Depends on    : Accessibility Tools ^(Ease of Access^)
	echo.
	echo.  [ 5] %C_EaseOfAccessThemes% Ease of Access Themes
	echo.         Contains the Ease of Access themes, high contrast variations.
	echo.         Depends on    : Accessibility Tools ^(Ease of Access^)
	echo.
	echo.  [ 6] %C_EasyTransfer% Easy Transfer
	echo.         Helps you move files and settings to a new PC.
	echo.         Compatibility : Windows Upgrade
	echo.
	echo.  [ 7] %C_FileHistory% File History
	echo.         Automatically backups revisions of files contained in Libraries.
	echo.
	if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [ 8] %C_LiveCaptions% Live Captions
		echo.         Live Captions Accessibility Extensions.
		echo.         Depends on    : Accessibility Tools ^(Ease of Access^)
		echo.
	)
	echo.  [ 9] %C_Magnifier% Magnifier
	echo.         Microsoft Magnifier is a a display utility that makes the computer screen more readable by creating a
	echo.         separate window that displays a magnified portion of the screen.
	echo.         Depends on    : Accessibility Tools ^(Ease of Access^)
	echo.
	echo.  [10] %C_ManualSetup% Manual Setup ^(Windows In-Place Upgrade^)
	echo.         In-place upgrade installs Windows 10/11 without previously removing the older version of the operating 
	echo.         system on the client computer. The process automatically maintains existing settings, programs, and data.
	echo.         Compatibility : Windows Upgrade
	echo.
	echo.  [11] %C_Narrator% Narrator
	echo.         Windows Narrator is a a text-to-speech utility that reads what is displayed on the screen, the contents
	echo.         of the active window, menu options, or text that has been typed.
	echo.         Depends on    : Accessibility Tools ^(Ease of Access^), Speech Recognition
	echo.
	if "%SelectedSourceOS%" equ "w10" echo.  [12] %C_Notepad% Notepad
	if "%SelectedSourceOS%" equ "w11" echo.  [12] %C_Notepad% Notepad ^(Legacy^)
	echo.         Windows Notepad is a simple text editor for Windows, it creates and edits plain text documents.
	echo.
	echo.  [13] %C_OnScreenKeyboard% On-Screen Keyboard
	echo.         On-Screen Keyboard displays a virtual keyboard on the computer screen that allows people to type data by
	echo.         using a pointing device or joystick.
	echo.         Depends on    : Accessibility Tools ^(Ease of Access^)
	echo.
	if "%SelectedSourceOS%" equ "w10" (
		echo.  [14] %C_Paint% Paint
		echo.         Paint is a simple raster graphics and editing tool.
		echo.
	)
	if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseS" (
		echo.  [14] %C_Paint% Paint ^(Legacy^)
		echo.         Paint is a simple raster graphics and editing tool.
		echo.
	)
	if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseSN" (
		echo.  [14] %C_Paint% Paint ^(Legacy^)
		echo.         Paint is a simple raster graphics and editing tool.
		echo.
	)
	echo.  [15] %C_ProjFS% Projected File System ^(ProjFS^)
	echo.         Allows apps to create virtual file systems which appear indistingusable from local folders but their
	echo.         entire contents are generated live by the program.
	echo.
	echo.  [16] %C_SecurityCenter% Security Center
	echo.         Security Center is tool to monitor the security and maintenance status of the computer.
	echo.         Depends on    : Windows Defender
	echo.         Compatibility : Application Guard / Containers
	echo.
	echo.  [17] %C_StepsRecorder% Steps Recorder
	echo.         It is a troubleshooting and assistance tool used to record actions taken by a user on a computer.
	echo.         Once recorded, the information can be ent to whatever the person or group is assisting in the
	echo.         troubleshooting.
	echo.
	echo.  [18] %C_StorageSpaces% Storage Spaces
	echo.         Allows you to take multiple disks of different sizes and interfaces and group them together so the
	echo.         operating system sees them as one large disk.
	echo.
	echo.  [19] %C_SystemRestore% System Restore
	echo.         This option takes your pc back to an earlier point in time called a system restore point.
	echo.
	if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [20] %C_VoiceAccess% Voice Access
		echo.         Voice Accessibility Extensions
		echo.         Depends on    : Speech Recognition
		echo.
	)
	echo.  [21] %C_WindowsBackup% Windows Backup
	echo.         It can create folder or system image backups, to be used for recovery when needed.
	echo.
	echo.  [22] %C_WindowsFirewall% Windows Firewall
	echo.         Windows Firewall UI and it's functionality.
	echo.         Compatibility : Application Guard / Containers, Recommended
	echo.
	echo.  [23] %C_WindowsSubsystemForLinux% Windows Subsystem For Linux ^(WSL^)
	echo.         Provides services and environments for running native user-mode Linux shells and tools on Windows.
	echo.
	echo.  [24] %C_WindowsToGo% Windows To Go
	echo.         Prepares portable Windows on a USB mass storage devices such as USB flash drives and external hard disk
	echo.         drives with a fully manageable corporate Windows environment.
	echo.
	echo.  [25] %C_WindowsUpdate% Windows Update
	echo.         Enables a computer to get Windows Updates from Microsoft or WSUS server, add new languages online and to
	echo.         install WUSA MSU update packages.
	echo.         Compatibility : Windows Update
	echo.
	echo.  [26] %C_Wordpad% Wordpad
	echo.         Microsoft WordPad is a rich text editor with some basic word processing features.
	echo.
	echo.
	echo.  [A]    All System Components
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" ( 
			if "%C_AccessibilityTools%" equ "+" (
				set "C_AccessibilityTools=-"
				set "C_EaseOfAccessCursors=-"
				set "C_EaseOfAccessThemes=-"
				if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_LiveCaptions=-"
				set "C_Magnifier=-"
				set "C_Narrator=-"
				set "C_NarratorQuickStart=-"
				set "C_OnScreenKeyboard=-"
			) else (
				set "C_AccessibilityTools=+"
			)
		)
		if "%%#" equ "2" if "%ImageFlag%" equ "EnterpriseS" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
		if "%%#" equ "2" if "%ImageFlag%" equ "EnterpriseSN" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
		if "%%#" equ "3" ( if "%C_DeviceLockdown%" equ "+" ( set "C_DeviceLockdown=-" ) else ( set "C_DeviceLockdown=+" ) )
		if "%%#" equ "4" (
			if "%C_EaseOfAccessCursors%" equ "+" (
				set "C_EaseOfAccessCursors=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_EaseOfAccessCursors=+"
			)
		)
		if "%%#" equ "5" (
			if "%C_EaseOfAccessThemes%" equ "+" (
				set "C_EaseOfAccessThemes=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_EaseOfAccessThemes=+"
			)
		)
		if "%%#" equ "6" if "%C_EasyTransfer%" neq "*" ( if "%C_EasyTransfer%" equ "+" ( set "C_EasyTransfer=-" ) else ( set "C_EasyTransfer=+" ) )
		if "%%#" equ "7" ( if "%C_FileHistory%" equ "+" ( set "C_FileHistory=-" ) else ( set "C_FileHistory=+" ) )
		if "%%#" equ "8" if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_LiveCaptions%" equ "+" (
				set "C_LiveCaptions=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_LiveCaptionss=+"
			)
		)
		if "%%#" equ "9" (
			if "%C_Magnifier%" equ "+" (
				set "C_Magnifier=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_Magnifier=+"
			)
		)
		if "%%#" equ "10" if "%C_ManualSetup%" neq "*" ( if "%C_ManualSetup%" equ "+" ( set "C_ManualSetup=-" ) else ( set "C_ManualSetup=+" ) )
		if "%%#" equ "11" (
			if "%C_Narrator%" equ "+" (
				set "C_Narrator=-"
				set "C_NarratorQuickStart=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_Narrator=+"
				set "C_SpeechRecognition=+"
			)
		)
		if "%%#" equ "12" ( if "%C_Notepad%" equ "+" ( set "C_Notepad=-" ) else ( set "C_Notepad=+" ) )
		if "%%#" equ "13" (
			if "%C_OnScreenKeyboard%" equ "+" (
				set "C_OnScreenKeyboard=-"
			) else (
				set "C_AccessibilityTools=+"
				set "C_OnScreenKeyboard=+"
			)
		)
		if "%%#" equ "14" if "%SelectedSourceOS%" equ "w10" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
		if "%%#" equ "14" if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseS" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
		if "%%#" equ "14" if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseSN" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
		if "%%#" equ "15" ( if "%C_ProjFS%" equ "+" ( set "C_ProjFS=-" ) else ( set "C_ProjFS=+" ) )
		if "%%#" equ "16" if "%C_SecurityCenter%" neq "*" (
			if "%C_SecurityCenter%" equ "+" ( 
				set "C_SecurityCenter=-"
			) else ( 
				set "C_SecurityCenter=+"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
					if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				)
				set "C_WindowsDefender=+"
			)
		)
		if "%%#" equ "17" ( if "%C_StepsRecorder%" equ "+" ( set "C_StepsRecorder=-" ) else ( set "C_StepsRecorder=+" ) )
		if "%%#" equ "18" ( if "%C_StorageSpaces%" equ "+" ( set "C_StorageSpaces=-" ) else ( set "C_StorageSpaces=+" ) )
		if "%%#" equ "19" ( if "%C_SystemRestore%" equ "+" ( set "C_SystemRestore=-" ) else ( set "C_SystemRestore=+" ) )
		if "%%#" equ "20" if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_VoiceAccess%" equ "+" ( 
				set "C_VoiceAccess=-"
			) else ( 
				set "C_SpeechRecognition=+"
				set "C_VoiceAccess=+"
			)
		)
		if "%%#" equ "21" ( if "%C_WindowsBackup%" equ "+" ( set "C_WindowsBackup=-" ) else ( set "C_WindowsBackup=+" ) )
		if "%%#" equ "22" if "%C_WindowsFirewall%" neq "*" ( if "%C_WindowsFirewall%" equ "+" ( set "C_WindowsFirewall=-" ) else ( set "C_WindowsFirewall=+" ) )
		if "%%#" equ "23" ( if "%C_WindowsSubsystemForLinux%" equ "+" ( set "C_WindowsSubsystemForLinux=-" ) else ( set "C_WindowsSubsystemForLinux=+" ) )
		if "%%#" equ "24" ( if "%C_WindowsToGo%" equ "+" ( set "C_WindowsToGo=-" ) else ( set "C_WindowsToGo=+" ) )
		if "%%#" equ "25" if "%C_WindowsUpdate%" neq "*" ( if "%C_WindowsUpdate%" equ "+" ( set "C_WindowsUpdate=-" ) else ( set "C_WindowsUpdate=+" ) )
		if "%%#" equ "26" ( if "%C_Wordpad%" equ "+" ( set "C_Wordpad=-" ) else ( set "C_Wordpad=+" ) )
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		set "C_AccessibilityTools=-"
		if "%ImageFlag%" equ "EnterpriseS" set "C_Calculator=-"
		if "%ImageFlag%" equ "EnterpriseSN" set "C_Calculator=-"
		set "C_DeviceLockdown=-"
		set "C_EaseOfAccessCursors=-"
		set "C_EaseOfAccessThemes=-"
		if "%C_EasyTransfer%" neq "*" set "C_EasyTransfer=-"
		set "C_FileHistory=-"
		if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_LiveCaptions=-"
		set "C_Magnifier=-"
		if "%C_ManualSetup%" neq "*" set "C_ManualSetup=-"
		set "C_Narrator=-"
		set "C_NarratorQuickStart=-"
		set "C_Notepad=-"
		set "C_OnScreenKeyboard=-"
		if "%SelectedSourceOS%" equ "w10" set "C_Paint=-"
		if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseS" set "C_Paint=-"
		if "%SelectedSourceOS%" equ "w11" if "%ImageFlag%" equ "EnterpriseSN" set "C_Paint=-"
		set "C_ProjFS=-"
		if "%C_SecurityCenter%" neq "*" set "C_SecurityCenter=-"
		set "C_StepsRecorder=-"
		set "C_StorageSpaces=-"
		set "C_SystemRestore=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
			if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
		)
		if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_VoiceAccess=-"
		set "C_WindowsBackup=-"
		if "%C_WindowsFirewall%" neq "*" set "C_WindowsFirewall=-"
		set "C_WindowsSubsystemForLinux=-"
		set "C_WindowsToGo=-"
		if "%C_WindowsUpdate%" neq "*" set "C_WindowsUpdate=-"
		set "C_Wordpad=-"
	)

	goto :RemoveSystemMenu
)

:RemoveSystemAppsMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Edition System Apps Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - Remove System Apps Menu
	echo.===============================================================================
	echo.
	echo.  [ 1] %C_AddSuggestedFoldersToLibraryDialog% Add Folder Suggestions Dialog ^(Microsoft.Windows.AddSuggestedFoldersToLibraryDialog^)
	echo.         Add folder suggestions Dialog is a system app that is used to display a dialog box that prompts you to add
	echo.         suggested folders to your libraries so that the apps can see them.
	echo.
	echo.  [ 2] %C_AppResolverUX% App Resolver ^(Microsoft.Windows.AppResolverUX^)
	echo.         App Resolver is a system app that is used to resolve app shortcuts. This app is responsible for finding the
	echo.         correct app to launch when you click on a shortcut icon.
	echo.
	if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" (
		echo.  [ 3] %C_AssignedAccessLockApp% Assigned Access Lock App ^(Microsoft.Windows.AssignedAccessLockApp^)
		echo.         Assigned Access Lock App is a system app used to lock down a Windows device into a single app, the app is
		echo.         launched when assigned access user logs in. This app is used to create and manage Assigned Access sessions,
		echo.         which allow you to lock down a device so that only a single app can be run.
		echo.         Depends on    : Assigned Access
		echo.
	)
	echo.  [ 4] %C_AsyncTextService% Asynchronous Text Service ^(Microsoft.AsyncTextService^)
	echo.         Asynchronous Text Service is a system app which provides intercommunications between built-in apps such as
	echo.         Contacts or provide extensions for Desktop Stickers.
	echo.
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.  [ 5] %C_CallingShellApp% Call ^(Microsoft.Windows.CallingShellApp^)
		echo.         Call Progress app is a system app which provides a new experience for making and receiving calls.
		echo.         The Calling Shell app is a replacement for the old Phone app and includes features such as Wi-Fi calling,
		echo.         VoIP calling, and integration with Microsoft Teams.
		echo.
	)
	echo.  [ 6] %C_OOBENetworkCaptivePortal% Captive Portal Flow ^(Microsoft.Windows.OOBENetworkCaptivePortal^)
	echo.         Captive Portal Flow is a system app that is used to handle captive portal authentication during the 
	echo.         Out-of-Box Experience ^(OOBE^) Phase of Windows Setup. Captive portals are web pages that are displayed by
	echo.         some Wi-Fi networks to require users to accept terms of service or enter credentials before they can
	echo.         can access the internet.
	echo.         Depends on    : Out-of-box Experience ^(OOBE^)
	echo.
	echo.  [ 7] %C_CapturePicker% Capture Picker ^(Microsoft.Windows.CapturePicker^)
	echo.         Capture Picker is a system app that allows you to select an item on the screen to capture screenshots and
	echo.         screen recordings on your device.
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
		echo.  [ 8] %C_PPIProjection% Connect ^(Microsoft.PPIProjection^)
		echo.         Connect is a system app that allows you to wirelessly project your Windows 10 device to another device,
		echo.         such as a TV or projector. It is also used to enable the "Project" menu in the Settings app.
		echo.
	)
	echo.  [ 9] %C_ContentDeliveryManager% Content Delivery Manager ^(Microsoft.Windows.ContentDeliveryManager^)
	echo.         Content Delivery Manager is a system app that is used to deliver content, such as wallpapers, themes, apps
	echo.         and sponsored apps ^(Consumer Experience^), to your Windows device. This app is responsible for downloading
	echo.         and installing the content, as well as keeping it up to date. Removing this disables promoted app 
	echo.         ^(like Candy Crush, Facebook, etc.^), suggestions and Your Phone settings.
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [10] %C_Cortana% Cortana ^(Microsoft.Windows.Cortana^) 
		echo.         Cortana is a personal assistant on Windows 10 device, it contains the Cortana UI, which is the user
		echo.         interface that you see when you interact with Cortana. It also contains the Cortana backend, which is the
		echo.         software that powers Cortana's functionality. Cortana is needed for search UI on Windows 10 Start menu,
		echo.         taskbar and settings search functionality.
		echo.         Compatibility : Shell Search
		echo.
	)
	echo.  [11] %C_CredDialogHost% Credential Dialog ^(Microsoft.CredDialogHost^)
	echo.         Credential Dialog is a system app which provides Authentication ^(Sign-in^) shell support for Windows Hello.
	echo.
	echo.  [12] %C_Win32WebViewHost% Desktop App Web Viewer ^(Microsoft.Win32WebViewHost^)
	echo.         Desktop App Web Viewer is a system app that is used to host web content in Windows device. This app allows
	echo.         you to view web pages in a variety of apps, such as File Explorer, the Settings app, and the Start menu.
	echo.
	echo.  [13] %C_AccountsControl% Email and Accounts ^(Microsoft.AccountsControl^)
	echo.         Email and accounts is a system app that is used to add, manage or remove the Microsoft Accounts that are
	echo.         used to sign in to Microsoft Apps.
	echo.         Compatibility : Microsoft Store
	echo.
	echo.  [14] %C_ECApp% Eye Control ^(Microsoft.ECApp^)
	echo.         Eye Control is a system app that is used to manage Eye Control device settings in Windows device.
	echo.         Depends on    : Windows Mixed Reality
	echo.
	echo.  [15] %C_FileExplorer% File Explorer ^(Legacy^) ^(Microsoft.Windows.FileExplorer^)
	echo.         File Explorer is a system app which is a modern file management app that allows you to view, organize, and
	echo.         access files on your computer.
	echo.
	echo.  [16] %C_FilePicker% File Picker ^(Microsoft.Windows.FilePicker^)
	echo.         File Picker is a system app which is a single, unified interface to let the user to pick files and folders
	echo.         from the file system or from other apps. Using a File Picker your app can access, browse, and save files
	echo.         and folders on the user's system.
	echo.
	echo.  [17] %C_MapControl% Map Control
	echo.         Map Control are core services required for functioning of Map App.
	echo.
	echo.  [18] %C_Edge% Microsoft Edge ^(Legacy^) ^(Microsoft.MicrosoftEdge^)
	echo.         Microsoft Edge is the default web browser present in Windows device.
	echo.
	echo.  [19] %C_EdgeDevToolsClient% Microsoft Edge Dev Tools Client ^(Microsoft.MicrosoftEdgeDevToolsClient^)
	echo.         Microsoft Edge DevTools Client is an extension for Edge browser containing DevTools for web developers.
	echo.         Depends on    : Microsoft Edge ^(Legacy^)
	echo.
	echo.  [20] %C_ParentalControls% Microsoft Family Features ^(ParentalControls^)
	echo.         Microsoft family features is a system app that is used to manage parental controls on Windows device.
	echo.         It allows you to restrict access to websites, apps, and games, as well as set screen time limits.
	echo.
	echo.  [21] %C_NarratorQuickStart% Narrator ^(Microsoft.Windows.NarratorQuickStart^)
	echo.         Narrator Home is a modern Narrator App that reads aloud the text on your screen, making it easier for
	echo.         people who are blind or have low vision to use their computer.
	echo.         Depends on    : Narrator
	echo.
	echo.  [22] %C_OOBENetworkConnectionFlow% Network Connection Flow ^(Microsoft.Windows.OOBENetworkConnectionFlow^)
	echo.         Network Connection Flow is a system app that helps users connect to a network during the Out-of-Box 
	echo.         Experience ^(OOBE^) Phase of Windows Setup.
	echo.         Depends on    : Out-of-box Experience ^(OOBE^)
	echo.
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
		echo.  [23] %C_NcsiUwpApp% Network Connectivity Status Indicator ^(NCSI^) ^(NcsiUwpApp^)
		echo.         Network Connectivity Status Indicator ^(NCSI^) is a system app that is responsible for monitoring the
		echo.         status of your network connection and displaying the network icon in the taskbar. It also performs periodic
		echo.         checks to verify that your network connection is working properly.
		echo.
	)
	echo.  [24] %C_CloudExperienceHost% Out-of-box Experience ^(OOBE^) ^(Microsoft.Windows.CloudExperienceHost^)
	echo.         Out-of-box Experience ^(OOBE^) is a system app which controls the final stage of Windows setup, prompting
	echo.         for user options and setup finalization. It is responsible for providing the user interface for the
	echo.         Microsoft Account sign-in process, as well as for managing the cloud-based features of Windows.
	echo.         It is also invoked after sysprep generalize.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.         Needed for search UI on Windows 10 taskbar and settings search functionality.
		echo.         Compatibility : Microsoft Store, Out-of-box Experience ^(OOBE^), Recommended, Shell Search
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.         Compatibility : Microsoft Store, Out-of-box Experience ^(OOBE^), Recommended
	echo.         WARNING       : Only remove if using fully unattended setup and not connected to the internet during
	echo.                         setup, or enable SkipMACHINE unattended options.
	echo.
	echo.  [25] %C_PinningConfirmationDialog% Pinning Confirmation Dialog ^(Microsoft.Windows.PinningConfirmationDialog^)
	echo.         Pinning Confirmation Dialog is a system app that is used to display a confirmation dialog box when you try 
	echo.         to pin an app to the Start or taskbar. The dialog box asks you to confirm that you want to pin the app and
	echo.         also allows you to choose where to pin the app.
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
		echo.  [26] %C_QuickAssist% Quick Assist
		echo.         Quick Assist is a built-in modern remote assistance tool that allows you to share your screen with someone
		echo.         else so they can help you troubleshoot a problem or provide technical support.
		echo.
	)
	echo.  [27] %C_RetailDemoContent% Retail Demo Content
	echo.         Retail Demo Content is a set of files that are included in Windows device that are used to create a retail
	echo.         demo experience. Useful for retail stores to advertise and show off Windows devices. This content includes
	echo.         things like videos, images, and apps that can be used to show off the features of Windows device to 
	echo.         potential customers.
	echo.
	echo.  [28] %C_XGpuEjectDialog% Safely Remove Device ^(Microsoft.Windows.XGpuEjectDialog^)
	echo.         Safely Remove Device is a system app that is used to display a dialog box when you need to eject an external
	echo.         graphics card ^(eGPU^) from your computer.
	echo.
	echo.  [29] %C_SettingSync% Setting Sync
	echo.         Setting Sync is a feature that allows you to sync your settings across multiple devices. This means that 
	echo.         if you change a setting on one device, the change will be reflected on all of your other devices that are
	echo.         signed in to the same Microsoft account.
	echo.
	echo.  [30] %C_ShellExperienceHost% Shell Experience Host ^(ShellExperienceHost^)
	echo.         Windows Shell Experience is a Windows system process that is responsible for providing Universal App
	echo.         integration in the Windows Shell ^(Windows Explorer^), notably the taskbar. It is responsible for 
	echo.         presenting universal apps in a windowed interface and gives Windows 10/11 its characteristic GUI features
	echo.         such as the Start Button and Start Menu, the Action Center, and flyouts for the clock, network connection,
	echo.         and battery icons, and other taskbar elements.
	if "%ImageBuild%" equ "17763" (
		echo.         Needed for search UI on Windows 10 taskbar and settings search functionality.
		echo.         Compatibility : Recommended, Shell Search
	)
	if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" echo.         Compatibility : Recommended
	if "%ImageBuild%" equ "17763" (
		echo.         WARNING       : Only remove if using alternative Start Menu programs like Open Shell, Start 10/11,
		echo.                         StartIsBackAll.
	)
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [31] %C_InputApp% Shell Input Application ^(InputApp^)
		echo.         Input App is a system app that is used to provide Support for Alternative User Input Text Input Processor
		echo.         ^(TIP^) and the Language Bar. Enables advanced user input services in applications ^(Pen and Ink, Speech etc.^)
		echo.         Compatibility : Microsoft Office, Recommended, Touch Screen Devices
		echo.
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
		echo.  [32] %C_UndockedDevKit% Shell Services ^(MicrosoftWindows.UndockedDevKit^)
		echo.         Undocked Dev Kit ^(Shell Services^) is a system app that is used to develop and test Windows apps that are
		echo.         designed to run on detachable devices, such as tablets and laptops. It is needed for Settings -^> System -^>
		echo.         About Window. Needed for search UI on Windows 10/11 explorer, taskbar and settings search functionality.
		echo.         Compatibility : Out-of-box Experience ^(OOBE^), Recommended, Shell Search
		echo.
	)
	echo.  [33] %C_SkypeORTC% Skype ORTC
	echo.         Skype ORTC is a set of APIs that allow developers to add real-time communication features to their
	echo.         applications. It is based on the Open Real-Time Communication ^(ORTC^) standard, which is a royalty-free,
	echo.         open-source specification for the real-time communication.
	echo.
	echo.  [34] %C_SmartScreen% SmartScreen ^(Microsoft.Windows.AppRep.ChxApp^)
	echo.         Windows Defender SmartScreen provides phishing and malware filter, designed to help protect against attacks
	echo.         by scanning URLs accessed by a user against a blacklist of websites containing known threats.
	echo.
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.  [35] %C_StartMenuExperienceHost% Start Menu ^(Microsoft.Windows.StartMenuExperienceHost^)
		echo.         Start Menu Experience Host is a system app responsible for managing the Start menu, including the live
		echo.         tiles, the search bar, and the power button.
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Shell Experience Host
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.         Compatibility : Recommended, Shell Search
		echo.         WARNING       : Only remove if using alternative Start Menu programs like Open Shell, Start 10/11 and
		echo.                         StartIsBackAll.
		echo.
	)
	if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
		echo.  [36] %C_SecureAssessmentBrowser% Take a Test ^(Microsoft.Windows.SecureAssessmentBrowser^)
		echo.         Take a Test is a web-based application that allows users to take assessments on various topics, such as
		echo.         security awareness, compliance and IT proficiency.
		echo.
	)
	echo.  [37] %C_WebcamExperience% Webcam Experience
	echo.         Webcam Experience is a component of the Media Feature Pack that provides the user experience for webcams
	echo.         on Windows device. It includes the Camera app, which allows you to take photos and videos, and the Camera
	echo.         settings, which allow you to adjust the settings of your webcam.
	echo.
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
		echo.  [38] %C_WebView2Runtime% WebView2 Runtime
		echo.         WebView2 Runtime is a redistributable runtime that serves as the underlying ^(or backing^) web platform for
		echo.         WebView2 apps. It is a stripped-down version of the Microsoft Edge Chromium web browser that is optimized
		echo.         for performance and security. WebView2 Runtime is used by a variety of apps, including Microsoft Office,
		echo.         Microsoft Power BI, and Visual Studio. It allows developers to embed web content, such as HTML, CSS, and
		echo.         JavaScript, into their native apps. This makes it possible to create hybrid apps that have the look and
		echo.         feel of a native app, but that can also access the web.
		echo.         Compatibility : Recommended
		echo.
	)
	echo.  [39] %C_CBSPreview% Windows Barcode Preview ^(Windows.CBSPreview^)
	echo.         The Windows Barcode Preview App is a built-in app that allows you to preview barcodes that you scan with
	echo.         your device's camera.
	echo.
	echo.  [40] %C_LockApp% Windows Default Lock Screen ^(Microsoft.LockApp^)
	echo.         Windows Default Lock Screen is the screen that you see when you first turn on your computer or when you
	echo.         wake it up from sleep. It can also be displayed when you lock your computer.
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" echo.  [41] %C_WindowsDefender% Windows Defender ^(Microsoft.Windows.SecHealthUI^)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.  [41] %C_WindowsDefender% Windows Defender ^(Microsoft.SecHealthUI^)
	echo.         Windows Defender is a built-in antivirus program which is designed to protect your computer from malware,
	echo.         including viruses, spyware, and ransomware. It also includes the Windows Security Center App which is a
	echo.         system app that is used to provide the Security Health Dashboard. The Security Health Dashboard is a 
	echo.         central location where you can view the security status of your computer, including information about
	echo.         your Antivirus software, Windows Defender, and other security settings.
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft UI Xaml 2.4, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" echo.  [42] %C_ClientCBS% Windows Feature Experience Pack ^(MicrosoftWindows.Client.CBS^)
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [42] %C_ClientCBS% Windows Feature Experience Pack - Desktop ^(MicrosoftWindows.Client.CBS^)
		echo.         Windows Feature Experience Pack is a system process that is responsible for managing the installation and
		echo.         servicing of Windows apps and features. It includes the Input App, Screen Clipping and Windows 11
		echo.         centered Start Menu functionality.
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.         Compatibility : Shell Search
		echo.
	)
	echo.  [43] %C_BioEnrollment% Windows Hello Setup ^(Microsoft.BioEnrollment^)
	echo.         Windows Hello Setup is a system app that is used to enroll and manage biometric data, such as fingerprints
	echo.         and facial scans, for use with Windows Hello. This app is responsible for creating and storing your 
	echo.         fingerprint or facial recognition templates, as well as for authenticating you when you sign in to your
	echo.         computer or device.
	echo.         Compatibility : Biometric
	echo.
	echo.  [44] %C_WindowsMixedReality% Windows Mixed Reality ^(WMR^)
	echo.         Windows Mixed Reality ^(WMR^) is a platform which provides augmented reality and virtual reality experiences
	echo.         with compatible head-mounted displays. It is a combination of both virtual reality ^(VR^) and augmented
	echo.         reality ^(AR^), like Microsoft Holo Lens.
	echo.
	echo.  [45] %C_PrintDialog% Windows Print ^(Windows.PrintDialog^)
	echo.         The Print Dialog is a pre-configured dialog box that allows users to select a printer, choose the pages to
	echo.         print, and determine other print-related settings. It is a simple solution for printer and print-related
	echo.         settings, instead of configuring your own dialog box.
	echo.         Compatibility : Printing
	echo.
	echo.  [46] %C_WindowsReaderPDF% Windows Reader ^(PDF^)
	echo.         Windows PDF Reader is a simple and easy-to-use PDF file viewer based on Microsoft Edge.
	echo.
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
		echo.  [47] %C_SearchApp% Windows Search ^(Microsoft.Windows.Search^)
		echo.         Search is a system app that is used to power the search function in Windows device.
		echo.         It is responsible for indexing your files, folders, and apps so that you can quickly find what you are
		echo.         looking for. Needed for search UI on Windows 10/11 explorer, taskbar and settings search functionality.
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.         Compatibility : Recommended, Shell Search
		echo.
	)
	echo.  [48] %C_PeopleExperienceHost% Windows Shell Experience ^(Microsoft.Windows.PeopleExperienceHost^)
	echo.         Windows Shell Experience is a system app that is used to manage the People app.
	echo.         It also provides the underlying infrastructure for other features in Windows, such as the People Bar and
	echo.         the People Tile in the Start menu.
	echo.
	echo.  [49] %C_AADBrokerPlugin% Work or School Account ^(Microsoft.AAD.BrokerPlugin^)
	echo.         Work or school Account is a Windows system app that is part of the Azure Active Directory ^(AAD^) WAM plugin.
	echo.         The AAD WAM plugin is responsible for handling authentication requests for AAD-enabled applications. When
	echo.         you in to an AAD-enabled application, the AAD WAM plugin will communicate with Azure Active Directory to
	echo.         validate your credentials and obtain an access token. It is needed for Windows Store Sign in and/or app
	echo.         installs ^(free apps can be installed without signing in^) and depends on Azure Active Directory
	echo.         Compatibility : Microsoft Store
	echo.
	echo.  [50] %C_XboxGameCallableUI% Xbox Game Callable User Interface ^(Microsoft.XboxGameCallableUI^)
	echo.         Xbox Game Callable User Interface is a system app that is used to provide a common UI for Xbox games to
	echo.         interact with other apps and services on Windows. It is a core component of the Xbox Play Anywhere program,
	echo.         which allows Xbox games to be played on both Windows and Xbox consoles.
	echo.
	echo.
	echo.  [A]    All System Apps Components
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" ( if "%C_AddSuggestedFoldersToLibraryDialog%" equ "+" ( set "C_AddSuggestedFoldersToLibraryDialog=-" ) else ( set "C_AddSuggestedFoldersToLibraryDialog=+" ) )
		if "%%#" equ "2" ( if "%C_AppResolverUX%" equ "+" ( set "C_AppResolverUX=-" ) else ( set "C_AppResolverUX=+" ) )
		if "%%#" equ "3" if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" (
			if "%C_AssignedAccessLockApp%" equ "+" ( 
				set "C_AssignedAccessLockApp=-"
			) else ( 
				set "C_AssignedAccess=+"
				set "C_AssignedAccessLockApp=+"
			)
		)
		if "%%#" equ "4" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
		if "%%#" equ "5" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" ( if "%C_CallingShellApp%" equ "+" ( set "C_CallingShellApp=-" ) else ( set "C_CallingShellApp=+" ) )
		if "%%#" equ "6" (
			if "%C_OOBENetworkCaptivePortal%" equ "+" ( 
				set "C_OOBENetworkCaptivePortal=-"
			) else ( 
				if "%C_CloudExperienceHost%" neq "*" set "C_CloudExperienceHost=+"
				set "C_OOBENetworkCaptivePortal=+"
			)
		)
		if "%%#" equ "7" (
			if "%C_CapturePicker%" equ "+" (
				set "C_CapturePicker=-"
				set "C_ScreenSketch=-"
			) else (
				set "C_CapturePicker=+"
			)
		)
		if "%%#" equ "8" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
		if "%%#" equ "9" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
		if "%%#" equ "10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%C_Cortana%" neq "*" ( if "%C_Cortana%" equ "+" ( set "C_Cortana=-" ) else ( set "C_Cortana=+" ) )
		if "%%#" equ "11" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
		if "%%#" equ "12" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
		if "%%#" equ "13" if "%C_AccountsControl%" neq "*" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
		if "%%#" equ "14" ( 
			if "%C_ECApp%" equ "+" ( 
				set "C_ECApp=-" 
			) else ( 
				set "C_ECApp=+" 
				set "C_WindowsMixedReality=+"
			) 
		)
		if "%%#" equ "15" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
		if "%%#" equ "16" ( if "%C_FilePicker%" equ "+" ( set "C_FilePicker=-" ) else ( set "C_FilePicker=+" ) )
		if "%%#" equ "17" (
			if "%C_MapControl%" equ "+" ( 
				set "C_MapControl=-"
				set "C_Maps=-"
			) else (
				set "C_MapControl=+"
			)
		)
		if "%%#" equ "18" (
			if "%C_Edge%" equ "+" ( 
				set "C_Edge=-"
				set "C_EdgeDevToolsClient=-"
			) else (
				set "C_Edge=+"
			)
		)
		if "%%#" equ "19" (
			if "%C_EdgeDevToolsClient%" equ "+" ( 
				set "C_EdgeDevToolsClient=-"
			) else (
				set "C_Edge=+"
				set "C_EdgeDevToolsClient=+"
			)
		)
		if "%%#" equ "20" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
		if "%%#" equ "21" (
			if "%C_NarratorQuickStart%" equ "+" ( 
				set "C_NarratorQuickStart=-"
			) else (
				set "C_Narrator=+"
				set "C_NarratorQuickStart=+"
				set "C_SpeechRecognition=+"
			)
		)
		if "%%#" equ "22" (
			if "%C_OOBENetworkConnectionFlow%" equ "+" ( 
				set "C_OOBENetworkConnectionFlow=-"
			) else ( 
				if "%C_CloudExperienceHost%" neq "*" set "C_CloudExperienceHost=+"
				set "C_OOBENetworkConnectionFlow=+"
			)
		)
		if "%%#" equ "23" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" ( if "%C_NcsiUwpApp%" equ "+" ( set "C_NcsiUwpApp=-" ) else ( set "C_NcsiUwpApp=+" ) )
		if "%%#" equ "24" if "%C_CloudExperienceHost%" neq "*" (
			if "%C_CloudExperienceHost%" equ "+" ( 
				set "C_CloudExperienceHost=-"
				set "C_FirstLogonAnimation=-"
				set "C_OOBENetworkCaptivePortal=-"
				set "C_OOBENetworkConnectionFlow=-"
			) else ( 
				set "C_CloudExperienceHost=+"
			)
		)
		if "%%#" equ "25" ( if "%C_PinningConfirmationDialog%" equ "+" ( set "C_PinningConfirmationDialog=-" ) else ( set "C_PinningConfirmationDialog=+" ) )
		if "%%#" equ "26" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
		if "%%#" equ "27" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
		if "%%#" equ "28" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
		if "%%#" equ "29" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
		if "%%#" equ "30" if "%C_ShellExperienceHost%" neq "*" (
			if "%C_ShellExperienceHost%" equ "+" ( 
				set "C_ShellExperienceHost=-"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_StartMenuExperienceHost%" neq "*" set "C_StartMenuExperienceHost=-"
			) else ( 
				set "C_ShellExperienceHost=+"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "31" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%C_InputApp%" neq "*" ( if "%C_InputApp%" equ "+" ( set "C_InputApp=-" ) else ( set "C_InputApp=+" ) )
		if "%%#" equ "32" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_UndockedDevKit%" neq "*" ( if "%C_UndockedDevKit%" equ "+" ( set "C_UndockedDevKit=-" ) else ( set "C_UndockedDevKit=+" ) )
		if "%%#" equ "33" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
		if "%%#" equ "34" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
		if "%%#" equ "35" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_StartMenuExperienceHost%" neq "*" (
			if "%C_StartMenuExperienceHost%" equ "+" ( 
				set "C_StartMenuExperienceHost=-"
			) else ( 
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_ShellExperienceHost%" neq "*" set "C_ShellExperienceHost=+"
				set "C_StartMenuExperienceHost=+"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "36" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
		if "%%#" equ "37" ( if "%C_WebcamExperience%" equ "+" ( set "C_WebcamExperience=-" ) else ( set "C_WebcamExperience=+" ) )
		if "%%#" equ "38" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (	if "%C_WebView2Runtime%" equ "+" ( set "C_WebView2Runtime=-" ) else ( set "C_WebView2Runtime=+" ) )
		if "%%#" equ "39" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
		if "%%#" equ "40" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
		if "%%#" equ "41" (
			if "%C_WindowsDefender%" equ "+" ( 
				if "%C_SecurityCenter%" neq "*" set "C_SecurityCenter=-"
				set "C_WindowsDefender=-"
			) else ( 
				set "C_WindowsDefender=+"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
					if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				)
			)
		)
		if "%%#" equ "42" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_ClientCBS%" neq "*" (
			if "%C_ClientCBS%" equ "+" (
				set "C_ClientCBS=-"
			) else (
				set "C_ClientCBS=+"
				set "C_Getstarted=-"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "43" if "%C_BioEnrollment%" neq "*" (
			if "%C_BioEnrollment%" equ "+" (
				set "C_BioEnrollment=-"
			) else (
				set "C_BioEnrollment=+"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "44" (
			if "%C_WindowsMixedReality%" equ "+" ( 
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19041" set "C_3DViewer=-"
				set "C_ECApp=-"
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19041" if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
				set "C_WindowsMixedReality=-"
			) else ( 
				set "C_WindowsMixedReality=+"
			)
		)
		if "%%#" equ "45" if "%C_PrintDialog%" neq "*" ( if "%C_PrintDialog%" equ "+" ( set "C_PrintDialog=-" ) else ( set "C_PrintDialog=+" ) )
		if "%%#" equ "46" ( if "%C_WindowsReaderPDF%" equ "+" ( set "C_WindowsReaderPDF=-" ) else ( set "C_WindowsReaderPDF=+" ) )
		if "%%#" equ "47" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
			if "%C_SearchApp%" equ "+" (
				set "C_SearchApp=-"
			) else (
				set "C_SearchApp=+"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "48" (
			if "%C_PeopleExperienceHost%" equ "+" ( 
				set "C_People=-"
				set "C_PeopleExperienceHost=-"
			) else (
				set "C_PeopleExperienceHost=+"
			)
		)
		if "%%#" equ "49" if "%C_AADBrokerPlugin%" neq "*" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
		if "%%#" equ "50" (
			if "%C_XboxGameCallableUI%" equ "+" ( 
				set "C_SolitaireCollection=-"
				set "C_XboxGameCallableUI=-"
			) else (
				set "C_XboxGameCallableUI=+"
			)
		)
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19041" set "C_3DViewer=-"
		if "%C_AADBrokerPlugin%" neq "*" set "C_AADBrokerPlugin=-"
		if "%C_AccountsControl%" neq "*" set "C_AccountsControl=-"
		set "C_AddSuggestedFoldersToLibraryDialog=-"
		set "C_AppResolverUX=-"
		if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		if "%C_BioEnrollment%" neq "*" set "C_BioEnrollment=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_CallingShellApp=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_ClientCBS%" neq "*" set "C_ClientCBS=-"
		if "%C_CloudExperienceHost%" neq "*" set "C_CloudExperienceHost=-"
		set "C_ContentDeliveryManager=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%C_Cortana%" neq "*" set "C_Cortana=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_FilePicker=-"
		if "%C_CloudExperienceHost%" neq "*" set "C_FirstLogonAnimation=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_ClientCBS%" neq "*" set "C_Getstarted=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%C_InputApp%" neq "*" set "C_InputApp=-"
		set "C_LockApp=-"
		set "C_Maps=-"
		set "C_MapControl=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19041" if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_NcsiUwpApp=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_PinningConfirmationDialog=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" set "C_PPIProjection=-"
		if "%C_PrintDialog%" neq "*" set "C_PrintDialog=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_ScreenSketch=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" set "C_SearchApp=-"
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" set "C_SecureAssessmentBrowser=-"
		if "%C_SecurityCenter%" neq "*" set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		if "%C_ShellExperienceHost%" neq "*" set "C_ShellExperienceHost=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_SolitaireCollection=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_StartMenuExperienceHost%" neq "*" set "C_StartMenuExperienceHost=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_UndockedDevKit%" neq "*" set "C_UndockedDevKit=-"
		set "C_WebcamExperience=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_WebView2Runtime=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
		set "C_XGpuEjectDialog=-"
	)

	goto :RemoveSystemAppsMenu
)

:RemoveWindowsAppsMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2, Windows 11 v21H2/v22H2 Client Windows Apps Menu
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - Remove Windows Apps Menu
	echo.===============================================================================
	echo.
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.  [ 1] %C_3DViewer% 3D Viewer ^(Microsoft.Microsoft3DViewer^)
		echo.         The 3D Viewer is a 3D computer graphics viewer and augmented reality app. It supports the .fbx, .3mf, .obj, and .stl and many more
		echo.         file formats.
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.0, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime,  Windows Mixed Reality
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.  [ 2] %C_Alarms% Alarms ^& Clock ^(Microsoft.WindowsAlarms^)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [ 2] %C_Alarms% Alarms ^(Microsoft.WindowsAlarms^)
	echo.         The Alarms ^& Clock is a app which allows you to set alarms, timers and reminders. It also includes a stopwatch and a world clock.
	echo.         It also provides the underlying infrastructure for other features in Windows such as the Focus Sessions feature in the
	echo.         Alarms ^& Clock app.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft UI Xaml 2.0, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [ 3] %C_DesktopAppInstaller% App Installer ^(Microsoft.DesktopAppInstaller^)
	echo.         The App Installer is a app responsible for the installation and maintenance of windows apps packaged in .appx or .appxbundle, msix
	echo.         or msixbundle format.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22000"	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631"	echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
	echo.         Compatibility : Modern App Support
	echo.
	echo.  [ 4] %C_CalculatorApp% Calculator ^(Microsoft.WindowsCalculator^)
	echo.         The Calculator is a simple yet powerful calculator app that includes standard, scientific, programmer, and graphing calculator 
	echo.         functionality as well as a set of converters between various units of measurement and currencies.
	if "%ImageBuild%" equ "17763" 	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045"	echo.         Depends on    : Microsoft UI Xaml 2.0, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631"	echo.         Depends on    : Microsoft UI Xaml 2.4, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [ 5] %C_Camera% Camera ^(Microsoft.WindowsCamera^)
	echo.         The Camera is a simple yet powerful camera app that allows you to take photos and videos and it also includes features such as HDR, 
	echo.         panorama, and timer.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045"	echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631"	echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [ 6] %C_Clipchamp% Clipchamp - Video Editor ^(Clipchamp.Clipchamp^)
		echo.         The Clipchamp is a powerful video editing app that can be used to create a variety of videos, from simple social media clips to
		echo.         more complex marketing videos. It is a great option for users who want to create videos without having to learn complex video
		echo.         editing software.
		echo.
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
		echo.  [ 7] %C_Cortana% Cortana ^(Microsoft.549981C3F5F10^)
		echo.         The Cortana is a digital assistant that can help you with a variety of tasks, such as setting reminders, making appointments
		echo.         and searching the web. It is also integrated with other Windows features, such as the Start menu and the lock screen.
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Microsoft Visual C++ 2015 UWP Desktop Runtime,
		echo.         Compatibility : Shell Search
		echo.
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [ 8] %C_Family% Family ^(MicrosoftCorporationII.MicrosoftFamily^)
		echo.         The Microsoft Family app is a feature that allows parents to manage their children's screen time and online activity on windows
		echo.         devices. It is available as part of the Microsoft Family Safety app.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Desktop Runtime
		echo.
	)
	echo.  [ 9] %C_FeedbackHub% Feedback Hub ^(Microsoft.WindowsFeedbackHub^)
	echo.         The Feedback Hub is a app for you to provide feedback to Microsoft about Windows, including problems you are experiencing,
	echo.         suggestions for improvement, and new features you would like to see.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft UI Xaml 2.0,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.0, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" equ "22000" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.4, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.7, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
		echo.  [10] %C_ZuneVideo% Films ^& TV ^(Microsoft.ZuneVideo^)
		echo.         The Films ^& TV is a media player app that allows you to watch videos, including movies, TV shows, and music videos.
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft UI Xaml 2.4, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	echo.  [11] %C_GetHelp% Get Help ^(Microsoft.GetHelp^)
	echo.         The Get Help is a app for you to get help with Windows, including troubleshooting problems, finding answers to questions, and
	echo.         getting in touch with Microsoft support.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.7, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
		echo.  [12] %C_ZuneMusic% Groove Music ^(Microsoft.ZuneMusic^)
		echo.         The Groove Music is a media player app that allows you to listen to music, including songs, albums, and playlists.
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft UI Xaml 2.4, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	echo.  [13] %C_HEIFImageExtension% HEIF Image Extensions ^(Microsoft.HEIFImageExtension^)
	echo.         The HEIF Image Extension enables Windows devices to read and write files that use the High Efficiency Image File ^(HEIF^) format.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [14] %C_HEVCVideoExtension% HEVC Video Extension ^(Microsoft.HEVCVideoExtension^)
		echo.         The HEVC Video Extension enables Windows device to play High Efficiency Video Coding ^(HEVC^) videos.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	echo.  [15] %C_CommunicationsApps% Mail and Calendar ^(Microsoft.WindowsCommunicationsApps^)
	echo.         The Mail and Calendar apps help you stay up to date on your email, manage your schedule and stay in touch with people you care about
	echo.         the most. Designed for both work and home, these apps help you communicate quickly and focus on what's important across all your
	echo.         accounts.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft Advertising SDK for XAML, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [16] %C_Maps% Maps ^(Microsoft.WindowsMaps^)
	echo.         The Windows Maps is a map and navigation app that allows you to find your way around, get directions, and explore new places.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Map Control, Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Map Control, Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, 
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Map Control, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [17] %C_Messaging% Messaging ^(Microsoft.Messaging^)
		echo.         The Microsoft Messaging app allows you to send and receive text messages, photos, and videos to other people who are using the app.
		if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
			echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft UI Xaml 2.0, 
			echo.                         Microsoft Visual C++ 2015 UWP Runtime
		)
		echo.
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [18] %C_ZuneMusic% Media Player ^(Microsoft.ZuneMusic^)
		echo.         The Media Player is a media player app that allows you to listen to music, including songs, albums, and playlists, and watch videos,
		echo.         including movies, TV shows, and music videos.
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, 
		echo.                         Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" equ "17763" (
		echo.  [19] %C_NETNativeFramework16% Microsoft .NET Native Framework Package 1.6 ^(Microsoft.NET.Native.Framework.1.6^)
		echo.         The Microsoft .NET Native Framework is a technology that allows .NET developers to create apps that run natively on Windows devices.
		echo.         This means that .NET Native apps are typically faster and more efficient than traditional .NET apps that are compiled to bytecode.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [20] %C_NETNativeFramework17% Microsoft .NET Native Framework Package 1.7 ^(Microsoft.NET.Native.Framework.1.7^)
		echo.         The Microsoft .NET Native Framework is a technology that allows .NET developers to create apps that run natively on Windows devices.
		echo.         This means that .NET Native apps are typically faster and more efficient than traditional .NET apps that are compiled to bytecode.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.  [21] %C_NETNativeFramework22% Microsoft .NET Native Framework Package 2.2 ^(Microsoft.NET.Native.Framework.2.2^)
		echo.         The Microsoft .NET Native Framework is a technology that allows .NET developers to create apps that run natively on Windows devices.
		echo.         This means that .NET Native apps are typically faster and more efficient than traditional .NET apps that are compiled to bytecode.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" equ "17763" (
		echo.  [22] %C_NETNativeRuntime16% Microsoft .NET Native Runtime Package 1.6 ^(Microsoft.NET.Native.Runtime.1.6^)
		echo.         The Microsoft .NET Native Runtime is a component of the .NET Native Framework that is responsible for running .NET Native apps.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [23] %C_NETNativeRuntime17% Microsoft .NET Native Runtime Package 1.7 ^(Microsoft.NET.Native.Runtime.1.7^)
		echo.         The Microsoft .NET Native Runtime is a component of the .NET Native Framework that is responsible for running .NET Native apps.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.  [24] %C_NETNativeRuntime22% Microsoft .NET Native Runtime Package 2.2 ^(Microsoft.NET.Native.Runtime.2.2^)
		echo.         The Microsoft .NET Native Runtime is a component of the .NET Native Framework that is responsible for running .NET Native apps.
		echo.         Compatibility : Modern App Support
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [25] %C_AdvertisingXaml% Microsoft Advertising SDK for XAML ^(Microsoft.Advertising.Xaml^)
		echo.         The Microsoft Advertising Framework for XAML The Microsoft Advertising Framework for XAML provides APIs to serve banner and video
		echo.         interstitial advertisements in apps.
		echo.
		echo.  [26] %C_ServicesStoreEngagement% Microsoft Engagement Framework ^(Microsoft.Services.Store.Engagement^)
		echo.         The Microsoft Engagement Framework is a set of APIs that allows developers to engage with their users through the Microsoft Store.
		echo.         Depends on    : Microsoft Store
		echo.
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [27] %C_BingNews% Microsoft News ^(Microsoft.BingNews^)
		echo.         The Bing News is a news aggregator app that allows you to see news headlines from a variety of sources.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [28] %C_Wallet% Microsoft Pay ^(Microsoft.Wallet^)
		echo.         The Microsoft Pay is a mobile payment and digital wallet service app by Microsoft that allowed users to make payments and store
		echo.         loyalty cards on certain mobile devices.
		if "%ImageBuild%" equ "17763" (
			echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime,
			echo.                         Wallet Service
		)
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
			echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
			echo.                         Wallet Service
		)
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
		echo.  [29] %C_SolitaireCollection% Microsoft Solitaire Collection ^(Microsoft.MicrosoftSolitaireCollection^)
		echo.         The Microsoft Solitaire Collection app is a collection of classic card games, including Klondike, Spider, FreeCell, and Pyramid.
		if "%ImageBuild%" equ "17763" (
			echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Advertising SDK for XAML,
			echo.                         Microsoft Engagement Framework, Microsoft Visual C++ 2015 UWP Runtime, Xbox Game Callable User Interface
		)
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
			echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime,
			echo.                         Xbox Game Callable User Interface
		)
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
			echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
			echo.                         Xbox Game Callable User Interface
		)
		if "%ImageBuild%" equ "22000" (
			echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
			echo.                         Xbox Game Callable User Interface
		)
		echo.
	)
	echo.  [30] %C_WindowsStoreCore% Microsoft Store - Core
	echo.         Microsoft Store core services required for functioning of Microsoft Store App.
	echo.         Compatibility : Microsoft Store
	echo.
	echo.  [31] %C_WindowsStore% Microsoft Store ^(Microsoft.WindowsStore^)
	echo.         The Microsoft Store is a digital distribution platform where you can download and install apps, games, movies, and TV shows.
	if "%ImageBuild%" equ "17763" (
	echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Store - Core,
	echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
	echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Store - Core,
	echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
	echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Store - Core,
	echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" equ "22000" (
	echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Store - Core, Microsoft UI Xaml 2.4,
	echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
	echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Store - Core, Microsoft UI Xaml 2.7,
	echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.         Compatibility : Microsoft Store
	echo.
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [32] %C_Todos% Microsoft To Do ^(Microsoft.Todos^)
		echo.         The Microsoft To-Do is a task management app that allows you to create, organize, and track tasks.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.  [33] %C_UIXaml20% Microsoft UI Xaml 2.0 ^(Microsoft.UI.Xaml.2.0^)
		echo.         Microsoft UI Xaml is a Windows process that runs in the background and is responsible for managing the Windows UI Xaml ^(XAML^)
		echo.         framework in Windows. Microsoft UI Xaml is a markup language used to create user interfaces for Windows applications.
		echo.         It is based on the Extensible Application Markup Language ^(XAML^) and it provides a rich set of features for creating interactive
		echo.         user interfaces.
		echo.
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [34] %C_UIXaml24% Microsoft UI Xaml 2.4 ^(Microsoft.UI.Xaml.2.4^)
		echo.         Microsoft UI Xaml is a Windows process that runs in the background and is responsible for managing the Windows UI Xaml ^(XAML^)
		echo.         framework in Windows. Microsoft UI Xaml is a markup language used to create user interfaces for Windows applications.
		echo.         It is based on the Extensible Application Markup Language ^(XAML^) and it provides a rich set of features for creating interactive
		echo.         user interfaces.
		echo.
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [35] %C_UIXaml27% Microsoft UI Xaml 2.7 ^(Microsoft.UI.Xaml.2.7^)
		echo.         Microsoft UI Xaml is a Windows process that runs in the background and is responsible for managing the Windows UI Xaml ^(XAML^)
		echo.         framework in Windows. Microsoft UI Xaml is a markup language used to create user interfaces for Windows applications.
		echo.         It is based on the Extensible Application Markup Language ^(XAML^) and it provides a rich set of features for creating interactive
		echo.         user interfaces.
		echo.
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.  [36] %C_VCLibs140UWPDesktop% Microsoft Visual C++ 2015 UWP Desktop Runtime Package ^(Microsoft.VCLibs.140.00.UWPDesktop^)
		echo.         The Microsoft Visual C++ 2015 UWP Desktop Runtime Package is a redistributable package that contains the Universal Windows Platform
		echo.         ^(UWP^) runtime libraries for Visual C++ 2015. These libraries are required to run UWP applications that were built using
		echo.         Visual Studio 2015 on a desktop PC.
		echo.         Compatibility : Modern App Support, Out-of-box Experience ^(OOBE^), Touch Screen Devices
		echo.
	)
	echo.  [37] %C_VCLibs140UWP% Microsoft Visual C++ 2015 UWP Runtime Package ^(Microsoft.VCLibs.140.00^)
	echo.         The Microsoft Visual C++ 2015 UWP Runtime Package is a redistributable package that contains the Universal Windows Platform ^(UWP^)
	echo.         runtime libraries for Visual C++ 2015. These libraries are required to run UWP applications that were built using Visual Studio 2015.
	echo.         Compatibility : Modern App Support, Touch Screen Devices
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageArchitecture%" equ "x64" (
		echo.  [38] %C_MixedRealityPortal% Mixed Reality Portal ^(Microsoft.MixedReality.Portal^)
		echo.         The Mixed Reality Portal is a app which allows users to configure and manage their mixed reality ^(MR^) devices.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Windows Mixed Reality
		echo.
	)
	if "%ImageBuild%" equ "17763" (
		echo.  [39] %C_3DViewer% Mixed Reality Viewer ^(Microsoft.Microsoft3DViewer^)
		echo.         The 3D Viewer is a 3D computer graphics viewer and augmented reality app. It supports the .fbx, .3mf, .obj, and .stl and many more
		echo.         file formats.
		echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Windows Mixed Reality
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [40] %C_OneConnect% Mobile Plans ^(Microsoft.OneConnect^)
		echo.         The Mobile Plans is a app that allows users to connect to their corporate networks and resources from their personal devices.
		if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [41] %C_ZuneVideo% Movies ^& TV ^(Microsoft.ZuneVideo^)
		echo.         The Movies ^& TV is a media player app that allows you to watch videos, including movies, TV shows, and music videos.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [41] %C_ZuneVideo% Movies ^& TV ^(Microsoft.ZuneVideo^)
		echo.         The Movies ^& TV is a media player app that allows you to watch videos, including movies, TV shows, and music videos.
		echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [42] %C_NotepadApp% Notepad ^(Microsoft.WindowsNotepad^)
		echo.         The Notepad is a basic text editor app that can be used to create and edit text files.
		if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
		echo.
	)
	if "%ImageBuild%" equ "17763" echo.  [43] %C_OfficeHub% My Office ^(Microsoft.MicrosoftOfficeHub^)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" echo.  [43] %C_OfficeHub% Office ^(Microsoft.MicrosoftOfficeHub^)
	echo.         The Office app provides a central location for accessing and managing your Office applications and documents on Windows devices.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
	if "%ImageBuild%" equ "22000" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [44] %C_OfficeOneNote% OneNote ^(Microsoft.Office.OneNote^)
		echo.         The OneNote app allows users to take notes in a variety of ways, including text, images, audio, and video. Users can also create
		echo.         notebooks, sections, and pages to organize their notes.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
		echo.  [45] %C_Paint3D% Paint 3D ^(Microsoft.MSPaint^)
		echo.         The Paint 3D is a powerful tool that can be used to create a variety of 3D models and animations. It is a great option for users
		echo.         who want to create 3D content without having to learn a complex 3D modeling software.
		if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft UI Xaml 2.0, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [46] %C_Paint% Paint ^(Microsoft.Paint^)
		echo.         Paint is a simple raster graphics editor app.
		if "%ImageBuild%" equ "22000" 	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Desktop Runtime
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631"	echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
		echo.
	)
	echo.  [47] %C_People% People ^(Microsoft.People^)
	echo.         The People is a app that allows users to organize and link contacts from different email accounts.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Advertising SDK for XAML,
		echo.                         Microsoft Engagement Framework, Microsoft Visual C++ 2015 UWP Runtime, Windows Shell Experience
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Windows Shell Experience
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Windows Shell Experience,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.
	echo.  [48] %C_Photos% Photos ^(Microsoft.Windows.Photos^)
	echo.         The Photos is a simple and yet powerful photo and video viewer and editor app.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.0,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.4,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [49] %C_PowerAutomateDesktop% Power Automate ^(Microsoft.PowerAutomateDesktop^)
		echo.         The Power Automate Desktop is a desktop automation app that allows you to automate repetitive tasks on your Windows computer.
		echo.         It is a part of Microsoft Power Automate, which is a cloud-based automation platform.
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		echo.  [50] %C_Print3D% Print 3D ^(Microsoft.Print3D^)
		echo.         The Print 3D is a set of APIs that allows developers to create 3D printing applications.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [51] %C_QuickAssist% Quick Assist ^(MicrosoftCorporationII.QuickAssist^)
		echo.         The Quick Assist is a remote assistance app that allows you to connect to another computer and help them with their problem.
		echo.
		echo.  [52] %C_RawImageExtension% Raw Image Extension ^(Microsoft.RawImageExtension^)
		echo.         The Raw Image Extension enables Windows devices to view and edit RAW images. RAW images are unprocessed images that contain all of
		echo.         the data captured by the camera's sensor. This means that RAW images offer more flexibility when it comes to editing, as you can
		echo.         adjust the white balance, exposure, and other settings to get the perfect image.
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
		echo.  [53] %C_SkypeApp% Skype ^(Microsoft.SkypeApp^)
		echo.         The Skype is a VoIP ^(voice over internet protocol^) and instant messaging ^(IM^) app that allows users to make voice and video calls,
		echo.         and send messages, share files with other users.
		if "%ImageBuild%" equ "17763" 	echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.  [54] %C_ScreenSketch% Snip ^& Sketch ^(Microsoft.ScreenSketch^)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.  [54] %C_ScreenSketch% Snipping Tool ^(Microsoft.ScreenSketch^)
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.         The Snip ^& Sketch is a app to capture screenshots and annotate them.
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         The Snipping Tool is a app to capture screenshots and videos, and to annotate them.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Capture Picker, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Capture Picker, Microsoft UI Xaml 2.0, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" equ "22000" (
		echo.         Depends on    : Capture Picker, Microsoft UI Xaml 2.4, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Microsoft Visual C++ 2015 UWP Desktop Runtime
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         Depends on    : Capture Picker, Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
		echo.  [55] %C_SolitaireCollection% Solitaire Collection ^(Microsoft.MicrosoftSolitaireCollection^)
		echo.         The Solitaire Collection app is a collection of classic card games, including Klondike, Spider, FreeCell, and Pyramid.
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Xbox Game Callable User Interface
		echo.
	)
	echo.  [56] %C_StickyNotes% Sticky Notes ^(Microsoft.MicrosoftStickyNotes^)
	echo.         The Sticky Notes is a app to create notes, type, ink or add a picture, add text formatting, stick them to the desktop, move them
	echo.         around there freely, close them to the Notes list, and sync them across devices and apps like OneNote Mobile, Microsoft Launcher
	echo.         for Android, and Outlook for Windows.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Store - Core,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Engagement Framework,
		echo.                         Microsoft Store - Core, Microsoft Visual C++ 2015 UWP Runtime, Microsoft Visual C++ 2015 UWP Desktop Runtime
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Engagement Framework,
		echo.                         Microsoft Store - Core, Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Store - Core, Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [57] %C_StorePurchaseApp% Store Experience Host ^(Microsoft.StorePurchaseApp^)
	echo.         The Store Experience Host is a core component of the Windows Store that allows users to purchase and download apps, games, and other
	echo.         content from the store. It is a separate app from the Windows Store app itself, and it is responsible for handling the actual
	echo.         purchase and download process.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Store
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Store,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Store,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	echo.
	echo.  [58] %C_Getstarted% Tips ^(Microsoft.Getstarted^)
	echo.         The Tips is a app designed to help new users learn and understand the functions and features present in the latest version of Windows.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Windows Feature Experience Pack
	)
	if "%ImageBuild%" equ "22000" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.4,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime, Windows Feature Experience Pack
	)
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" ( 
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft UI Xaml 2.7,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime, Windows Feature Experience Pack - Desktop
	)
	echo.
	echo.  [59] %C_SoundRecorder% Voice Recorder ^(Microsoft.WindowsSoundRecorder^)
	echo.         The Voice Recorder is a basic audio recording app that can be used to record audio from your computer, such as lectures, interviews,
	echo.         or music.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft UI Xaml 2.0, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [60] %C_VP9VideoExtensions% VP9 Video Extensions ^(Microsoft.VP9VideoExtensions^)
	echo.         The VP9 Video Extensions enables Windows devices to support playing VP9 video files.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [61] %C_BingWeather% Weather ^(Microsoft.BingWeather^)
	echo.         The Weather is a simple and easy-to-use weather app. It uses data from Bing Weather to provide users with current and forecast
	echo.         weather information for their location. The app also includes features such as a notifications, radar map, a 10-day forecast,
	echo.         and a search bar for finding weather information for specific locations.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Advertising SDK for XAML,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Advertising SDK for XAML,
		echo.                         Microsoft Visual C++ 2015 UWP Runtime
	)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [62] %C_WebMediaExtensions% Web Media Extensions ^(Microsoft.WebMediaExtensions^)
	echo.         The Web Media Extensions enables Windows devices to support playing WebM audio video files.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.  [63] %C_WebpImageExtension% Webp Image Extensions ^(Microsoft.WebpImageExtension^)
	echo.         The Webp Image Extensions enables Windows devices to support viewing WebP image.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
		echo.  [64] %C_Terminal% Windows Terminal ^(Microsoft.WindowsTerminal^)
		echo.         The Terminal is a modern terminal emulator app for Windows. It is built on top of the Windows Console.
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft UI Xaml 2.7, Microsoft Visual C++ 2015 UWP Runtime
		echo.
		echo.  [65] %C_ClientWebExperience% Windows Web Experience Pack ^(MicrosoftWindows.Client.WebExperience^)
		echo.         The Windows Web Experience Pack is a app that is used to providing a consistent web experience across different Windows devices.
		echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
		echo.
	)
	echo.  [66] %C_XboxCore% Xbox - Core
	echo.         Xbox core services required for functioning of Xbox App.
	echo.         Compatibility : Xbox
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" echo.  [67] %C_XboxApp% Xbox App ^(Microsoft.XboxApp^)
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.  [67] %C_GamingApp% Xbox App ^(Microsoft.GamingApp^)
	echo.         The Xbox is a app that allows you to connect to your Xbox Live account, browse the Xbox store, and play Xbox games on your computer.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Framework 1.7, Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	echo.         Compatibility : Xbox
	echo.
	echo.  [68] %C_XboxGameOverlay% Xbox Game bar Plugin ^(Microsoft.XboxGameOverlay^)
	echo.         The Xbox Game bar Plugin is a app that is used to provide the Xbox Game Bar. The Xbox Game Bar is a toolbar that can be displayed
	echo.         while you are playing a game. It allows you to do things like record gameplay, take screenshots, and chat with friends.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	echo.         Compatibility : Xbox
	echo.
	echo.  [69] %C_XboxGamingOverlay% Xbox Game bar ^(Microsoft.XboxGamingOverlay^)
	echo.         The Xbox Game bar is a app that is used to provide the Xbox Gaming Overlay. The Xbox Gaming Overlay is a toolbar that can be
	echo.         displayed while you are playing a game. It allows you to do things like record gameplay, take screenshots, and chat with friends.
	echo.         It is a newer version of the Xbox Game Bar.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	echo.         Compatibility : Xbox
	echo.
	echo.  [70] %C_XboxSpeechToTextOverlay% Xbox Game Speech Window ^(Microsoft.XboxSpeechToTextOverlay^)
	echo.         The Xbox Game Speech Window is a app that is used to provide the Xbox Speech to Text Overlay. The Xbox Speech to Text Overlay
	echo.         is a tool that allows you to dictate text into your computer using your voice.
	echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime, Xbox - Core
	echo.         Compatibility : Xbox
	echo.
	echo.  [71] %C_XboxIdentityProvider% Xbox Identity Provider ^(Microsoft.XboxIdentityProvider^)
	echo.         The Xbox Identity Provider is a app that is used to provide authentication for Xbox apps and services in Windows.
	echo.         This app is responsible for communicating with the Xbox Live service and validating the user's credentials.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Xbox - Core
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Xbox - Core
	)
	echo.         Compatibility : Microsoft Store, Xbox
	echo.
	echo.  [72] %C_XboxTCUI% Xbox Live ^(Microsoft.Xbox.TCUI^)
	echo.         The Xbox Live is a app that is used to provide the Xbox TCUI ^(Touch Control User Interface^).
	echo.         The Xbox TCUI is a touch-friendly interface that can be used to control Xbox games on your computer.
	if "%ImageBuild%" equ "17763" (
		echo.         Depends on    : Microsoft .NET Native Framework 1.6, Microsoft .NET Native Runtime 1.6, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Xbox - Core
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		echo.         Depends on    : Microsoft .NET Native Framework 2.2, Microsoft .NET Native Runtime 2.2, Microsoft Visual C++ 2015 UWP Runtime,
		echo.                         Xbox - Core
	)
	echo.         Compatibility : Xbox
	echo.
	echo.  [73] %C_YourPhone% Your Phone ^(Microsoft.YourPhone^)
	echo.         The Your Phone is a cross-platform app that allows you to connect your Android phone to your Windows device. Once connected, you
	echo.         can view and interact with your phone's notifications, photos, text messages, and even apps directly from your PC.
	if "%ImageBuild%" equ "17763" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.         Depends on    : Microsoft .NET Native Framework 1.7, Microsoft .NET Native Runtime 1.7, Microsoft Visual C++ 2015 UWP Runtime
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.         Depends on    : Microsoft Visual C++ 2015 UWP Runtime
	echo.
	echo.
	echo.  [A]    All Windows Apps Components
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if /i "!MenuChoice!" neq "A" for %%# in (!MenuChoice!) do (
		if "%%#" equ "1" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
			if "%C_3DViewer%" equ "+" ( 
				set "C_3DViewer=-"
			) else ( 
				set "C_3DViewer=+"

				if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
				if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WindowsMixedReality=+"
			)
		)
		if "%%#" equ "2" (
			if "%C_Alarms%" equ "+" (
				set "C_Alarms=-"
			) else (
				set "C_Alarms=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "3" if "%C_DesktopAppInstaller%" neq "*" (
			 if "%C_DesktopAppInstaller%" equ "+" (
				set "C_DesktopAppInstaller=-"
			) else (
				set "C_DesktopAppInstaller=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22000" if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "4" (
			if "%C_CalculatorApp%" equ "+" (
				set "C_CalculatorApp=-"
			) else (
				set "C_CalculatorApp=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "5" (
			if "%C_Camera%" equ "+" (
				set "C_Camera=-"
			) else (
				set "C_Camera=+"
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "6" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_Clipchamp%" equ "+" (
				set "C_Clipchamp=-"
			) else (
				set "C_Clipchamp=+"
			)
		)
		if "%%#" equ "7" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
			if "%C_Cortana%" equ "+" (
				set "C_Cortana=-"
			) else (
				set "C_Cortana=+"
				if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
				if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "8" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_Family%" equ "+" (
				set "C_Family=-"
			) else (
				set "C_Family=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "9" (
			if "%C_FeedbackHub%" equ "+" (
				set "C_FeedbackHub=-"
			) else (
				set "C_FeedbackHub=+"
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
			if "%C_ZuneVideo%" equ "+" (
				set "C_ZuneVideo=-"
			) else (
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_ZuneVideo=+"
			)
		)
		if "%%#" equ "11" (
			if "%C_GetHelp%" equ "+" (
				set "C_GetHelp=-"
			) else (
				set "C_GetHelp=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "12" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
			if "%C_ZuneMusic%" equ "+" (
				set "C_ZuneMusic=-"
			) else (
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_ZuneMusic=+"
			)
		)
		if "%%#" equ "13" (
			if "%C_HEIFImageExtension%" equ "+" (
				set "C_HEIFImageExtension=-"
			) else (
				set "C_HEIFImageExtension=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "14" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_HEVCVideoExtension%" equ "+" (
				set "C_HEVCVideoExtension=-"
			) else (
				set "C_HEVCVideoExtension=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "15" (
			if "%C_CommunicationsApps%" equ "+" (
				set "C_CommunicationsApps=-"
			) else (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_AdvertisingXaml=+"
				set "C_CommunicationsApps=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "16" (
			if "%C_Maps%" equ "+" (
				set "C_Maps=-"
			) else (
				set "C_Maps=+"
				set "C_MapControl=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "17" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
			if "%C_Messaging%" equ "+" (
				set "C_Messaging=-"
			) else (
				set "C_Messaging=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
					if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "18" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_ZuneMusic%" equ "+" (
				set "C_ZuneMusic=-"
			) else (
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
					if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_ZuneMusic=+"
			)
		)
		if "%%#" equ "19" if "%ImageBuild%" equ "17763" if "%C_NETNativeFramework16%" neq "*" (
			if "%C_NETNativeFramework16%" equ "+" (
				set "C_NETNativeFramework16=-"
			) else (
				set "C_NETNativeFramework16=+"
			)
		)
		if "%%#" equ "20" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_NETNativeFramework17%" neq "*" (
			if "%C_NETNativeFramework17%" equ "+" (
				set "C_NETNativeFramework17=-"
			) else (
				set "C_NETNativeFramework17=+"
			)
		)
		if "%%#" equ "21" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_NETNativeFramework22%" neq "*" (
			if "%C_NETNativeFramework22%" equ "+" (
				set "C_NETNativeFramework22=-"
			) else (
				set "C_NETNativeFramework22=+"
			)
		)
		if "%%#" equ "22" if "%ImageBuild%" equ "17763" if "%C_NETNativeRuntime16%" neq "*" (
			if "%C_NETNativeRuntime16%" equ "+" (
				set "C_NETNativeRuntime16=-"
			) else (
				set "C_NETNativeRuntime16=+"
			)
		)
		if "%%#" equ "23" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_NETNativeRuntime17%" neq "*" (
			if "%C_NETNativeRuntime17%" equ "+" (
				set "C_NETNativeRuntime17=-"
			) else (
				set "C_NETNativeRuntime17=+"
			)
		)
		if "%%#" equ "24" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_NETNativeRuntime22%" neq "*" (
			if "%C_NETNativeRuntime22%" equ "+" (
				set "C_NETNativeRuntime22=-"
			) else (
				set "C_NETNativeRuntime22=+"
			)
		)
		if "%%#" equ "25" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_AdvertisingXaml%" equ "+" ( 
				set "C_AdvertisingXaml=-"
				set "C_BingWeather=-"
				set "C_CommunicationsApps=-"
				if "%ImageBuild%" equ "17763" (
					set "C_People=-"
					set "C_SolitaireCollection=-"
				)
			) else (
				set "C_AdvertisingXaml=+"
			)
		)
		if "%%#" equ "26" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_ServicesStoreEngagement%" equ "+" ( 
				set "C_ServicesStoreEngagement=-"
				if "%ImageBuild%" equ "17763" (
					set "C_People=-"
					set "C_SolitaireCollection=-"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" set "C_StickyNotes=-"
			) else ( 
				set "C_ServicesStoreEngagement=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_WindowsStore%" neq "*" set "C_WindowsStore=+"
				if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
			)
		)
		if "%%#" equ "27" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_BingNews%" equ "+" (
				set "C_BingNews=-"
			) else (
				set "C_BingNews=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "28" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_Wallet%" equ "+" ( 
				set "C_Wallet=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_Wallet=+"
				set "C_WalletService=+"
			)
		)
		if "%%#" equ "29" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
			if "%C_SolitaireCollection%" equ "+" ( 
				set "C_SolitaireCollection=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					set "C_AdvertisingXaml=+"
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" equ "17763" set "C_ServicesStoreEngagement=+"
				set "C_SolitaireCollection=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_WindowsStore%" neq "*" set "C_WindowsStore=+"
					if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
				)
				set "C_XboxGameCallableUI=+"
			)
		)
		if "%%#" equ "30" if "%C_WindowsStoreCore%" neq "*" (
			if "%C_WindowsStoreCore%" equ "+" (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_ServicesStoreEngagement=-"
				if "%ImageBuild%" equ "17763" (
					set "C_People=-"
					set "C_SolitaireCollection=-"
				)
				set "C_StickyNotes=-"
				set "C_StorePurchaseApp=-"
				if "%C_WindowsStore%" neq "*" set "C_WindowsStore=-"
				set "C_WindowsStoreCore=-"
			) else (
				set "C_WindowsStoreCore=+"
			)
		)
		if "%%#" equ "31" if "%C_WindowsStore%" neq "*" (
			if "%C_WindowsStore%" equ "+" ( 
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_ServicesStoreEngagement=-"
				if "%ImageBuild%" equ "17763" (
					set "C_People=-"
					set "C_SolitaireCollection=-"
				)
				set "C_StickyNotes=-"
				set "C_StorePurchaseApp=-"
				set "C_WindowsStore=-"
			) else ( 
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WindowsStore=+"
				if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
			)
		)
		if "%%#" equ "32" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_Todos%" equ "+" (
				set "C_Todos=-"
			) else (
				set "C_Todos=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "33" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" (
			if "%C_UIXaml20%" equ "+" (
				set "C_UIXaml20=-"
			) else (
				set "C_UIXaml20=+"
			)
		)
		if "%%#" equ "34" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_UIXaml24%" neq "*" (
			if "%C_UIXaml24%" equ "+" (
				set "C_UIXaml24=-"
			) else (
				set "C_UIXaml24=+"
			)
		)
		if "%%#" equ "35" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" (
			if "%C_UIXaml27%" equ "+" (
				set "C_UIXaml27=-"
			) else (
				set "C_UIXaml27=+"
			)
		)
		if "%%#" equ "36" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_VCLibs140UWPDesktop%" neq "*" (
			if "%C_VCLibs140UWPDesktop%" equ "+" (
				set "C_VCLibs140UWPDesktop=-"
			) else (
				set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "37" if "%C_VCLibs140UWP%" neq "*" (
			if "%C_VCLibs140UWP%" equ "+" (
				set "C_VCLibs140UWP=-"
			) else (
				set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "38" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageArchitecture%" equ "x64" (
			if "%C_MixedRealityPortal%" equ "+" (
				set "C_MixedRealityPortal=-"
			) else (
				set "C_MixedRealityPortal=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WindowsMixedReality=+"
			)
		)
		if "%%#" equ "39" if "%ImageBuild%" equ "17763" (
			if "%C_3DViewer%" equ "+" ( 
				set "C_3DViewer=-"
			) else ( 
				set "C_3DViewer=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WindowsMixedReality=+"
			)
		)
		if "%%#" equ "40" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
			if "%C_OneConnect%" equ "+" (
				set "C_OneConnect=-"
			) else (
				set "C_OneConnect=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "41" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
			if "%C_ZuneVideo%" equ "+" (
				set "C_ZuneVideo=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_ZuneVideo=+"
			)
		)
		if "%%#" equ "41" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_ZuneVideo%" equ "+" (
				set "C_ZuneVideo=-"
			) else (
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_ZuneVideo=+"
			)
		)
		if "%%#" equ "42" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_NotepadApp%" equ "+" (
				set "C_NotepadApp=-"
			) else (
				set "C_NotepadApp=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
					if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				)
				if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "43" (
			if "%C_OfficeHub%" equ "+" (
				set "C_OfficeHub=-"
			) else (
				set "C_OfficeHub=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "44" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_OfficeOneNote%" equ "+" (
				set "C_OfficeOneNote=-"
			) else (
				set "C_OfficeOneNote=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "45" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_Paint3D%" equ "+" (
				set "C_Paint3D=-"
			) else (
				set "C_Paint3D=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "46" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_Paint%" equ "+" (
				set "C_Paint=-"
			) else (
				set "C_Paint=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
					if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				)
				if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "47" (
			if "%C_People%" equ "+" ( 
				set "C_People=-"
			) else ( 
				if "%ImageBuild%" equ "17763" (
					set "C_AdvertisingXaml=+"
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
					set "C_ServicesStoreEngagement=+"
					if "%C_WindowsStore%" neq "*" set "C_WindowsStore=+"
					if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				set "C_People=+"
				set "C_PeopleExperienceHost=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "48" (
			if "%C_Photos%" equ "+" (
				set "C_Photos=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				set "C_Photos=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "49" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_PowerAutomateDesktop%" equ "+" (
				set "C_PowerAutomateDesktop=-"
			) else (
				set "C_PowerAutomateDesktop=+"
			)
		)
		if "%%#" equ "50" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
			if "%C_Print3D%" equ "+" (
				set "C_Print3D=-"
			) else (
				set "C_Print3D=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "51" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_QuickAssist%" equ "+" (
				set "C_QuickAssist=-"
			) else (
				set "C_QuickAssist=+"
			)
		)
		if "%%#" equ "52" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_RawImageExtension%" equ "+" (
				set "C_RawImageExtension=-"
			) else (
				set "C_RawImageExtension=+"
			)
		)
		if "%%#" equ "53" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			if "%C_SkypeApp%" equ "+" (
				set "C_SkypeApp=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				set "C_SkypeApp=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "54" (
			if "%C_ScreenSketch%" equ "+" (
				set "C_ScreenSketch=-"
			) else (
				set "C_CapturePicker=+"
				set "C_ScreenSketch=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19041" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%ImageBuild%" equ "22000" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
			)
		)
		if "%%#" equ "55" if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			if "%C_SolitaireCollection%" equ "+" ( 
				set "C_SolitaireCollection=-"
			) else (
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				set "C_SolitaireCollection=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_XboxGameCallableUI=+"
			)
		)
		if "%%#" equ "56" (
			if "%C_StickyNotes%" equ "+" ( 
				set "C_StickyNotes=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22000" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" set "C_ServicesStoreEngagement=+"
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
				set "C_StickyNotes=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_WindowsStore%" neq "*" set "C_WindowsStore=+"
				if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
			)
		)
		if "%%#" equ "57" (
			if "%C_StorePurchaseApp%" equ "+" (
				set "C_StorePurchaseApp=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				set "C_StorePurchaseApp=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_WindowsStore%" neq "*" set "C_WindowsStore=+"
				if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=+"
			)
		)
		if "%%#" equ "58" (
			if "%C_Getstarted%" equ "+" (
				set "C_Getstarted=-"
			) else (
				set "C_Getstarted=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%C_ClientCBS%" neq "*" set "C_ClientCBS=+"
				if "%ImageBuild%" equ "22000" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "59" (
			if "%C_SoundRecorder%" equ "+" (
				set "C_SoundRecorder=-"
			) else (
				set "C_SoundRecorder=+"
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "60" (
			if "%C_VP9VideoExtensions%" equ "+" (
				set "C_VP9VideoExtensions=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_VP9VideoExtensions=+"
			)
		)
		if "%%#" equ "61" (
			if "%C_BingWeather%" equ "+" ( 
				set "C_BingWeather=-"
			) else (
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_AdvertisingXaml=+"
				set "C_BingWeather=+"
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "62" (
			if "%C_WebMediaExtensions%" equ "+" (
				set "C_WebMediaExtensions=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WebMediaExtensions=+"
			)
		)
		if "%%#" equ "63" (
			if "%C_WebpImageExtension%" equ "+" (
				set "C_WebpImageExtension=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_WebpImageExtension=+"
			)
		)
		if "%%#" equ "64" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_Terminal%" equ "+" (
				set "C_Terminal=-"
			) else (
				set "C_Terminal=+"
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
					if "%C_UIXaml27%" neq "*" set "C_UIXaml27=+"
					if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=+"
				)
			)
		)
		if "%%#" equ "65" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			if "%C_ClientWebExperience%" equ "+" (
				set "C_ClientWebExperience=-"
			) else (
				set "C_ClientWebExperience=+"
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
			)
		)
		if "%%#" equ "66" if "%C_XboxCore%" neq "*" (
			if "%C_XboxCore%" equ "+" (
				if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_GamingApp%" neq "*" set "C_GamingApp=-"
				if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_XboxApp%" neq "*" set "C_XboxApp=-"
				set "C_XboxCore=-"
				set "C_XboxGameOverlay=-"
				set "C_XboxGamingOverlay=-"
				if "%C_XboxIdentityProvider%" neq "*" set "C_XboxIdentityProvider=-"
				set "C_XboxSpeechToTextOverlay=-"
				set "C_XboxTCUI=-"
			) else (
				set "C_XboxCore=+"
			)
		)
		if "%%#" equ "67" (
			if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_XboxApp%" neq "*" (
				if "%C_XboxApp%" equ "+" (
					set "C_XboxApp=-"
				) else (
					if "%ImageBuild%" equ "17763" (
						if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
						if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
					)
					if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
						if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
						if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
					)
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
					set "C_XboxApp=+"
					if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				)
			)
			if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_GamingApp%" neq "*" (
				if "%C_GamingApp%" equ "+" (
					set "C_GamingApp=-"
				) else (
					set "C_GamingApp=+"
					if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
					if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				)
			)
		)
		if "%%#" equ "68" (
			if "%C_XboxGameOverlay%" equ "+" ( 
				set "C_XboxGameOverlay=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				set "C_XboxGameOverlay=+"
			)
		)
		if "%%#" equ "69" (
			if "%C_XboxGamingOverlay%" equ "+" ( 
				set "C_XboxGamingOverlay=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				set "C_XboxGamingOverlay=+"
			)
		)
		if "%%#" equ "70" (
			if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
				set "C_XboxSpeechToTextOverlay=-"
			) else (
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				set "C_XboxSpeechToTextOverlay=+"
			)
		)
		if "%%#" equ "71" if "%C_XboxIdentityProvider%" neq "*" (
			if "%C_XboxIdentityProvider%" equ "+" ( 
				set "C_XboxIdentityProvider=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				set "C_XboxIdentityProvider=+"
			)
		)
		if "%%#" equ "72" (
			if "%C_XboxTCUI%" equ "+" ( 
				set "C_XboxTCUI=-"
			) else (
				if "%ImageBuild%" equ "17763" (
					if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=+"
					if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=+"
				)
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
					if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=+"
					if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				if "%C_XboxCore%" neq "*" set "C_XboxCore=+"
				set "C_XboxTCUI=+"
			)
		)
		if "%%#" equ "73" (
			if "%C_YourPhone%" equ "+" (
				set "C_YourPhone=-"
			) else (
				if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
					if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=+"
					if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=+"
				)
				if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=+"
				set "C_YourPhone=+"
			)
		)
		if /i "%%#" equ "X" goto :SelectWindowsComponentsMenu
	)

	if /i "!MenuChoice!" equ "A" (
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			set "C_3DViewer=-"
			set "C_AdvertisingXaml=-"
		)
		set "C_Alarms=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_BingNews=-"
		set "C_BingWeather=-"
		if "%C_DesktopAppInstaller%" neq "*" set "C_DesktopAppInstaller=-"
		set "C_CalculatorApp=-"
		set "C_Camera=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_ClientWebExperience=-"
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_Clipchamp=-"
		set "C_CommunicationsApps=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_Cortana=-"
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_Family=-"
		set "C_FeedbackHub=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_GamingApp%" neq "*" set "C_GamingApp=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" set "C_HEVCVideoExtension=-"
		set "C_Maps=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_Messaging=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		if "%ImageBuild%" equ "17763" if "%C_NETNativeFramework16%" neq "*" set "C_NETNativeFramework16=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_NETNativeFramework17%" neq "*" set "C_NETNativeFramework17=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_NETNativeFramework22%" neq "*" set "C_NETNativeFramework22=-"
		if "%ImageBuild%" equ "17763" if "%C_NETNativeRuntime16%" neq "*" set "C_NETNativeRuntime16=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_NETNativeRuntime17%" neq "*" set "C_NETNativeRuntime17=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_NETNativeRuntime22%" neq "*" set "C_NETNativeRuntime22=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_NotepadApp=-"
		set "C_OfficeHub=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_OfficeOneNote=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_OneConnect=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_Paint=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_Print3D=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_PowerAutomateDesktop=-"
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" (
			set "C_QuickAssist=-"
			set "C_RawImageExtension=-"
		)
		set "C_ScreenSketch=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" (
			set "C_ServicesStoreEngagement=-"
			set "C_SkypeApp=-"
		)
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
			set "C_Terminal=-"
			set "C_Todos=-"
		)
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%C_UIXaml20%" neq "*" set "C_UIXaml20=-"
		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" if "%C_UIXaml24%" neq "*" set "C_UIXaml24=-"
		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%C_UIXaml27%" neq "*" set "C_UIXaml27=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%C_VCLibs140UWPDesktop%" neq "*" set "C_VCLibs140UWPDesktop=-"
		if "%C_VCLibs140UWP%" neq "*" set "C_VCLibs140UWP=-"
		set "C_VP9VideoExtensions=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_Wallet=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtension=-"
		if "%C_WindowsStoreCore%" neq "*" set "C_WindowsStoreCore=-"
		if "%C_WindowsStore%" neq "*" set "C_WindowsStore=-"
		if "%C_XboxCore%" neq "*" set "C_XboxCore=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%C_XboxApp%" neq "*" set "C_XboxApp=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		if "%C_XboxIdentityProvider%" neq "*" set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)

	goto :RemoveWindowsAppsMenu
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Components
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponents

setlocal

set Components=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Removing Windows Components
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Components status flags
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_LiveCaptions,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_VoiceAccess,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2Runtime,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_PaintApp,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	if "%%i" neq "C_ManualSetup" if "!%%i!" equ "-" (
		for /f "tokens=2 delims=_" %%j in ("%%i") do (
			set "Components=!Components!%%j;"
		)
	)
)

if "%Components%" equ ""  (
	echo.No Windows Components have been selected for removal...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Removing Windows Components#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
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%"
		)
	)
)

if "%C_ManualSetup%" equ "-" (
	echo.
	"%ToolKitHelper%" "%InstallMount%\%DefaultIndexNo%" "ManualSetup"
	echo.
)

echo.-------------------------------------------------------------------------------
echo.####Finished Removing Windows Components#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Components=

endlocal

:: Resetting Components status flags
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_LiveCaptions,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_VoiceAccess,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2Runtime,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_PaintApp,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	set "%%i=+"
)

:: Resetting Components Compatibility status flags
for %%i in (CC_AdobeInstallers,CC_ApplicationGuardContainers,CC_Biometric,CC_Hyper-V,CC_MicrosoftGames,CC_MicrosoftOfice,CC_MicrosoftStore,CC_ModernAppSupport,CC_OOBE,CC_Printing,CC_Recommended,CC_ShellSearch,CC_TouchScreenDevices,CC_VisualStudio,CC_WindowsUpdate,CC_WindowsUpgrade,CC_XboxApp) do (
	set "%%i=+"
)

for %%i in (C_AADBrokerPlugin,C_AccountsControl,C_BioEnrollment,C_ClientCBS,C_CloudExperienceHost,C_Cortana,C_DesktopAppInstaller,C_EasyTransfer,C_EdgeChromium,C_EdgeWebView,C_GameExplorer,C_GamingApp,C_InputApp,C_InternetExplorer,C_KernelDebugging,C_ManualSetup,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_OfflineFiles,C_PinEnrollment,C_PrintDialog,C_RemoteDesktopClient,C_RemoteDesktopServer,C_SearchApp,C_SecurityCenter,C_ShellExperienceHost,C_StartMenuExperienceHost,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_UndockedDevKit,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_WindowsErrorReporting,C_WindowsFirewall,C_WindowsStore,C_WindowsStoreCore,C_WindowsUpdate,C_WinSAT,C_XboxIdentityProvider,C_XboxCore,C_XboxApp) do (
	if "%%i" equ "C_WindowsErrorReporting" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "%%i=*"
	if "%%i" equ "C_ClientCBS" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "%%i=*"
	if "%%i" neq "C_ClientCBS" if "%%i" neq "C_WindowsErrorReporting" set "%%i=*"
)

:: Returning to Remove Windows Components Menu.
goto :RemoveWindowsComponentsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Reset Windows Components Compatibility Settings
::-------------------------------------------------------------------------------------------
:SetComponentsCompatibility

for %%i in (C_AADBrokerPlugin,C_AccountsControl,C_BioEnrollment,C_ClientCBS,C_CloudExperienceHost,C_Cortana,C_DesktopAppInstaller,C_EasyTransfer,C_EdgeChromium,C_EdgeWebView,C_GameExplorer,C_GamingApp,C_InputApp,C_InternetExplorer,C_KernelDebugging,C_ManualSetup,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_OfflineFiles,C_PinEnrollment,C_PrintDialog,C_RemoteDesktopClient,C_RemoteDesktopServer,C_SearchApp,C_SecurityCenter,C_ShellExperienceHost,C_StartMenuExperienceHost,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_UndockedDevKit,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_WindowsErrorReporting,C_WindowsFirewall,C_WindowsStore,C_WindowsStoreCore,C_WindowsUpdate,C_WinSAT,C_XboxIdentityProvider,C_XboxCore,C_XboxApp) do (
	if "%%i" equ "C_WindowsErrorReporting" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "%%i=*"
	if "%%i" equ "C_ClientCBS" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "%%i=*"
	if "%%i" neq "C_ClientCBS" if "%%i" neq "C_WindowsErrorReporting" set "%%i=*"
)

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Components Compatibility Menu
::-------------------------------------------------------------------------------------------
:ComponentsCompatibilityMenu

cls
echo.===============================================================================
echo.          MSMG ToolKit - Remove Windows Components Compatibility Menu
echo.===============================================================================
echo.
echo.  [ 1] %CC_AdobeInstallers% Adobe Installers
echo.  [ 2] %CC_ApplicationGuardContainers% Application guard / Containers
echo.  [ 3] %CC_Biometric% Biometric
echo.  [ 4] %CC_Hyper-V% Hyper-V
echo.  [ 5] %CC_MicrosoftGames% Microsoft Games
echo.  [ 6] %CC_MicrosoftOfice% Microsoft Office
echo.  [ 7] %CC_MicrosoftStore% Microsoft Store
echo   [ 8] %CC_ModernAppSupport% Modern App Support
echo.  [ 9] %CC_OOBE% Out-of-box Experience ^(OOBE^)
echo.  [10] %CC_Printing% Printing
echo.  [11] %CC_Recommended% Recommended
echo.  [12] %CC_ShellSearch% Shell Search
echo.  [13] %CC_TouchScreenDevices% Touch Screen Devices
echo.  [14] %CC_VisualStudio% Visual Studio
echo.  [15] %CC_WindowsUpdate% Windows Update
echo.  [16] %CC_WindowsUpgrade% Windows Upgrade
echo.  [17] %CC_XboxApp% Xbox
echo.
echo.  [A]    Select All
echo.  [D]    Revert to Default
echo.  [X]    Go Back
echo.
echo.===============================================================================
set /p MenuChoice=Enter Your Choice : 

if /i "!MenuChoice!" equ "A" (
	for %%i in (CC_AdobeInstallers,CC_ApplicationGuardContainers,CC_Biometric,CC_Hyper-V,CC_MicrosoftGames,CC_MicrosoftOfice,CC_MicrosoftStore,CC_ModernAppSupport,CC_OOBE,CC_Printing,CC_Recommended,CC_ShellSearch,CC_TouchScreenDevices,CC_VisualStudio,CC_WindowsUpdate,CC_WindowsUpgrade,CC_XboxApp) do (
		set "%%i=-"
	)

	for %%i in (C_AADBrokerPlugin,C_AccountsControl,C_BioEnrollment,C_ClientCBS,C_CloudExperienceHost,C_Cortana,C_DesktopAppInstaller,C_EasyTransfer,C_EdgeChromium,C_EdgeWebView,C_GameExplorer,C_GamingApp,C_InputApp,C_InternetExplorer,C_KernelDebugging,C_ManualSetup,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_OfflineFiles,C_PinEnrollment,C_PrintDialog,C_RemoteDesktopClient,C_RemoteDesktopServer,C_SearchApp,C_SecurityCenter,C_ShellExperienceHost,C_StartMenuExperienceHost,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_UndockedDevKit,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_WindowsErrorReporting,C_WindowsFirewall,C_WindowsStore,C_WindowsStoreCore,C_WindowsUpdate,C_WinSAT,C_XboxIdentityProvider,C_XboxCore,C_XboxApp) do (
		if "%%i" equ "C_WindowsErrorReporting" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "%%i=+"
		if "%%i" equ "C_ClientCBS" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "%%i=+"
		if "%%i" neq "C_ClientCBS" if "%%i" neq "C_WindowsErrorReporting" set "%%i=+"
	)
)
if /i "!MenuChoice!" equ "D" (
	for %%i in (CC_AdobeInstallers,CC_ApplicationGuardContainers,CC_Biometric,CC_Hyper-V,CC_MicrosoftGames,CC_MicrosoftOfice,CC_MicrosoftStore,CC_ModernAppSupport,CC_OOBE,CC_Printing,CC_Recommended,CC_ShellSearch,CC_TouchScreenDevices,CC_VisualStudio,CC_WindowsUpdate,CC_WindowsUpgrade,CC_XboxApp) do (
		set "%%i=+"
	)

	for %%i in (C_AADBrokerPlugin,C_AccountsControl,C_BioEnrollment,C_ClientCBS,C_CloudExperienceHost,C_Cortana,C_DesktopAppInstaller,C_EasyTransfer,C_EdgeChromium,C_EdgeWebView,C_GameExplorer,C_GamingApp,C_InputApp,C_InternetExplorer,C_KernelDebugging,C_ManualSetup,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_OfflineFiles,C_PinEnrollment,C_PrintDialog,C_RemoteDesktopClient,C_RemoteDesktopServer,C_SearchApp,C_SecurityCenter,C_ShellExperienceHost,C_StartMenuExperienceHost,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_UndockedDevKit,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_WindowsErrorReporting,C_WindowsFirewall,C_WindowsStore,C_WindowsStoreCore,C_WindowsUpdate,C_WinSAT,C_XboxIdentityProvider,C_XboxCore,C_XboxApp) do (
		if "%%i" equ "C_WindowsErrorReporting" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "%%i=*"
		if "%%i" equ "C_ClientCBS" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "%%i=*"
		if "%%i" neq "C_ClientCBS" if "%%i" neq "C_WindowsErrorReporting" set "%%i=*"
	)
)
if /i "!MenuChoice!" neq "A" if /i "!MenuChoice!" neq "D" for %%# in (!MenuChoice!) do (
	if "%%#" equ "1" (
		if "%CC_AdobeInstallers%" equ "+" (
			set "CC_AdobeInstallers=-"
			set "C_InternetExplorer=+"
		) else (
			set "CC_AdobeInstallers=+"
			set "C_InternetExplorer=*"
		)
	)
	if "%%#" equ "2" (
		if "%CC_ApplicationGuardContainers%" equ "+" (
	        	set "CC_ApplicationGuardContainers=-"
        		set "C_KernelDebugging=+"
        		set "C_OfflineFiles=+"
	        	if "%CC_Hyper-V%" equ "-" set "C_RemoteDesktopServer=+" 
			set "C_SecurityCenter=+"
			if "%ImageBuild%" equ "17763" set "C_WindowsFirewall=+"
			if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%CC_Recommended%" equ "-" set "C_WindowsFirewall=+"
			if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_WindowsFirewall=+"
		) else (
			set "CC_ApplicationGuardContainers=+"
			set "C_KernelDebugging=*"
			set "C_OfflineFiles=*"
			set "C_RemoteDesktopServer=*"
			set "C_SecurityCenter=*"
			set "C_WindowsFirewall=*"
		)
	)
	if "%%#" equ "3" (
		if "%CC_Biometric%" equ "+" (
			set "CC_Biometric=-"
			set "C_PinEnrollment=+"
			set "C_BioEnrollment=+"
		) else (
			set "CC_Biometric=+"
			set "C_PinEnrollment=*"
			set "C_BioEnrollment=*"
		)
	)
	if "%%#" equ "4" (
		if "%CC_Hyper-V%" equ "+" (
			set "CC_Hyper-V=-"
 			if "%CC_ApplicationGuardContainers%" equ "-" set "C_RemoteDesktopServer=+"
		) else (
        		set "CC_Hyper-V=+"
	        	set "C_RemoteDesktopServer=*"
    		)
	)
	if "%%#" equ "5" (
		if "%CC_MicrosoftGames%" equ "+" (
        		set "CC_MicrosoftGames=-"
        		set "C_GameExplorer=+"
        		set "C_WinSAT=+"
    		) else (
        		set "CC_MicrosoftGames=+"
        		set "C_GameExplorer=*"
        		set "C_WinSAT=*"
    		)
	)
	if "%%#" equ "6" (
		if "%CC_MicrosoftOfice%" equ "+" (
        		set "CC_MicrosoftOfice=-"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%CC_Recommended%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_InputApp=+"
    		) else (
        		set "CC_MicrosoftOfice=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_InputApp=*"
    		)
	)
	if "%%#" equ "7" (
		if "%CC_MicrosoftStore%" equ "+" (
        		set "CC_MicrosoftStore=-"
        		set "C_AADBrokerPlugin=+"
        		set "C_AccountsControl=+"
        		if "%CC_OOBE%" equ "-" if "%CC_Recommended%" equ "-" if "%CC_ShellSearch%" equ "-" set "C_CloudExperienceHost=+"
        		set "C_WindowsStoreCore=+"
        		set "C_WindowsStore=+"
        		if "%CC_XboxApp%" equ "-" set "C_XboxIdentityProvider=+"
    		) else (
        		set "CC_MicrosoftStore=+"
        		set "C_AADBrokerPlugin=*"
        		set "C_AccountsControl=*"
        		set "C_CloudExperienceHost=*"
        		set "C_WindowsStoreCore=*"
        		set "C_WindowsStore=*"
        		set "C_XboxIdentityProvider=*"
    		)
	)
	if "%%#" equ "8" (
		if "%CC_ModernAppSupport%" equ "+" (
        		set "CC_ModernAppSupport=-"
	        	set "C_DesktopAppInstaller=+"
        		if "%ImageBuild%" equ "17763" set "C_NETNativeFramework16=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_NETNativeFramework17=+"
	        	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_NETNativeFramework22=+"
        		if "%ImageBuild%" equ "17763" set "C_NETNativeRuntime16=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_NETNativeRuntime17=+"
	        	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_NETNativeRuntime22=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWP=+"
        		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%CC_OOBE%" equ "-" set "C_VCLibs140UWP=+"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWPDesktop=+"
        		if "%ImageBuild%" equ "22000" if "%CC_OOBE%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWPDesktop=+"
        		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%CC_OOBE%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWPDesktop=+"
	    	) else (
        		set "CC_ModernAppSupport=+"
        		set "C_DesktopAppInstaller=*"
	        	if "%ImageBuild%" equ "17763" set "C_NETNativeFramework16=*"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_NETNativeFramework17=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_NETNativeFramework22=*"
	        	if "%ImageBuild%" equ "17763" set "C_NETNativeRuntime16=*"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_NETNativeRuntime17=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_NETNativeRuntime22=*"
	        	set "C_VCLibs140UWP=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_VCLibs140UWPDesktop=*"
	    	)
	)
	if "%%#" equ "9" (
		if "%CC_OOBE%" equ "+" (
        		set "CC_OOBE=-"
        		if "%CC_MicrosoftStore%" equ "-" if "%CC_Recommended%" equ "-" if "%CC_ShellSearch%" equ "-" set "C_CloudExperienceHost=+"
			if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_Recommended%" equ "-" if "%CC_ShellSearch%" equ "-" set "C_UndockedDevKit=+"
        		if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" if "%CC_ModernAppSupport%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWP=+"
        		if "%ImageBuild%" equ "22000" if "%CC_ModernAppSupport%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_VCLibs140UWPDesktop=+"
	        	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "C_WindowsErrorReporting=+"
    		) else (
        		set "CC_OOBE=+"
	        	set "C_CloudExperienceHost=*"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_UndockedDevKit=*"
			set "C_VCLibs140UWP=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_VCLibs140UWPDesktop=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "C_WindowsErrorReporting=*"
	    	)
	)
	if "%%#" equ "10" (
		if "%CC_Printing%" equ "+" (
        		set "CC_Printing=-"
        		set "C_PrintDialog=+"
	    	) else (
        		set "CC_Printing=+"
        		set "C_PrintDialog=*"
	    	)
	)
	if "%%#" equ "11" (
		if "%CC_Recommended%" equ "+" (
        		set "CC_Recommended=-"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_ShellSearch%" equ "-" set "C_ClientCBS=+"
        		if "%CC_MicrosoftStore%" equ "-" if "%CC_OOBE%" equ "-" if "%CC_ShellSearch%" equ "-" set "C_CloudExperienceHost=+"
	        	set "C_EdgeChromium=+"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_VisualStudio%" equ "-" set "C_EdgeWebView=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%CC_MicrosoftOfice%" equ "-" if "%CC_TouchScreenDevices%" equ "-" set "C_InputApp=+"
	        	set "C_RemoteDesktopClient=+"
 			if "%CC_ApplicationGuardContainers%" equ "-" set "C_RemoteDesktopServer=+"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" if "%CC_ShellSearch%" equ "-" set "C_SearchApp=+"
        		if "%CC_ShellSearch%" equ "-" set "C_ShellExperienceHost=+"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%CC_ShellSearch%" equ "-" set "C_StartMenuExperienceHost=+"
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_OOBE%" equ "-" if "%CC_ShellSearch%" equ "-" set "C_UndockedDevKit=+"
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_WebView2Runtime=+"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "C_WindowsFirewall=+"
	    	) else (
        		set "CC_Recommended=+"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_ClientCBS=*"
        		set "C_CloudExperienceHost=*"
	        	set "C_EdgeChromium=*"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_EdgeWebView=*"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_InputApp=*"
	        	set "C_RemoteDesktopClient=*"
			set "C_RemoteDesktopServer=+"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" equ "-" set "C_SearchApp=*"
        		set "C_ShellExperienceHost=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_StartMenuExperienceHost=*"
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_UndockedDevKit=*"
			if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_WebView2Runtime=*"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "C_WindowsFirewall=*"
	    	)
	)
	if "%%#" equ "12" (
		if "%CC_ShellSearch%" equ "+" (
        		set "CC_ShellSearch=-"
        		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_Recommended%" equ "-" set "C_ClientCBS=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
				if "%CC_MicrosoftStore%" equ "-" if "%CC_OOBE%" equ "-" if "%CC_Recommended%" equ "-" set "C_CloudExperienceHost=+"
				set "C_Cortana=+"
			)
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_Recommended%" equ "-" set "C_SearchApp=+"
        		if "%ImageBuild%" equ "17763" if "%CC_Recommended%" equ "-" set "C_ShellExperienceHost=+"
        		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" if "%CC_Recommended%" equ "-" set "C_StartMenuExperienceHost=+"
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" if "%CC_OOBE%" equ "-" if "%CC_Recommended%" equ "-" set "C_UndockedDevKit=+"
	    	) else (
        		set "CC_ShellSearch=+"
			if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_ClientCBS=*"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
				set "C_CloudExperienceHost=*"
				set "C_Cortana=*"
			)
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_SearchApp=*"
        		if "%ImageBuild%" equ "17763" set "C_ShellExperienceHost=*"
			if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_StartMenuExperienceHost=*"
	        	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_UndockedDevKit=*"
	    	)
	)
	if "%%#" equ "13" (
		if "%CC_TouchScreenDevices%" equ "+" (
        		set "CC_TouchScreenDevices=-"
	        	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%CC_MicrosoftOfice%" equ "-" if "%CC_Recommended%" equ "-" set "C_InputApp=+"
        		if "%CC_ModernAppSupport%" equ "-" set "C_VCLibs140UWP=+"
        		if "%CC_ModernAppSupport%" equ "-" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_VCLibs140UWPDesktop=+"
	    	) else (
	        	set "CC_TouchScreenDevices=+"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_InputApp=*"
        		set "C_VCLibs140UWP=*"
	        	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_VCLibs140UWPDesktop=*"
    		)
	)
	if "%%#" equ "14" (
		if "%CC_VisualStudio%" equ "+" (
        		set "CC_VisualStudio=-"
        		if "%CC_Recommended%" equ "-" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_EdgeWebView=+"
	    	) else (
	        	set "CC_VisualStudio=+"
        		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_EdgeWebView=*"
	    	)
	)
	if "%%#" equ "15" (
		if "%CC_WindowsUpdate%" equ "+" (
	        	set "CC_WindowsUpdate=-"
        		set "C_WindowsUpdate=+"
		) else (
        		set "CC_WindowsUpdate=+"
	        	set "C_WindowsUpdate=*"
    		)
	)
	if "%%#" equ "16" (
		if "%CC_WindowsUpgrade%" equ "+" (
        		set "CC_WindowsUpgrade=-"
	        	set "C_EasyTransfer=+"
	        	set "C_ManualSetup=+"
    		) else (
        		set "CC_WindowsUpgrade=+"
	        	set "C_EasyTransfer=*"
        		set "C_ManualSetup=*"
	    	)
	)
	if "%%#" equ "17" (
		if "%CC_XboxApp%" equ "+" (
        		set "CC_XboxApp=-"
        		if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_GamingApp=+"
	        	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_XboxApp=+"
        		set "C_XboxCore=+"
        		set "C_XboxGamingOverlay=+"
        		set "C_XboxGameOverlay=+"
        		set "C_XboxSpeechToTextOverlay=+"
        		if "%CC_MicrosoftStore%" equ "-" set "C_XboxIdentityProvider=+"
        		set "C_XboxTCUI=+"
		) else (
        		set "CC_XboxApp=+"
	        	if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" set "C_GamingApp=*"
        		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" set "C_XboxApp=*"
        		set "C_XboxCore=*"
        		set "C_XboxGamingOverlay=*"
        		set "C_XboxGameOverlay=*"
        		set "C_XboxSpeechToTextOverlay=*"
        		set "C_XboxIdentityProvider=*"
        		set "C_XboxTCUI=*"
		)
	)
	if /i "%%#" equ "X" goto :RemoveWindowsComponentsMenu
)

goto :ComponentsCompatibilityMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Apps Using Apps List
::-------------------------------------------------------------------------------------------
:RemoveWindowsAppsList

setlocal

set "RemoveAppsList=%Lists%\RemoveAppsList.txt"

cls
echo.===============================================================================
echo.          MSMG ToolKit - Remove Windows Apps Using Apps List
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Remove Windows Apps Using Apps List###############################
echo.-------------------------------------------------------------------------------
echo.
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Removing Windows Apps Using Apps List######################################
echo.-------------------------------------------------------------------------------

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.

		for /f %%z IN ('"type %RemoveAppsList%" 2^>nul') do (
			call :RemoveProvisionedAppxPackage "%InstallMount%\%%i", %%z, %%z

			if "%%z" equ "Microsoft.3DBuilder" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Print with 3D Builder option from right click context menu
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.bmp\Shell\T3D Print" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpg\Shell\T3D Print" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.png\Shell\T3D Print" /f >nul 2>&1

				:: Un-Mounting Image Registry
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.MSPaint" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing Edit with Paint 3D Option from right click context menu
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.3mf\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.bmp\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.fbx\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.gif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jfif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpe\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpeg\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpg\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.png\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.tif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.tiff\Shell\3D Edit" /f >nul 2>&1

				:: Un-Mounting Image Registry
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.Print3D" if "%ImageBuild%" geq "16299" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Objects Section from Windows Explorer Navigation Pane
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1
				if "%ImageArchitecture%" equ "x64" Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1

				:: Un-Mounting Image Registry
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.Microsoft3DViewer" if "%ImageBuild%" geq "16299" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Objects Section from Windows Explorer Navigation Pane
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1
				if "%ImageArchitecture%" equ "x64" Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1

				:: Un-Mounting Image Registry
				call :UnMountImageRegistry
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Removing Windows Apps Using Apps List#############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set RemoveAppsList=

endlocal

:: Returning to Remove Menu.
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Components Using Package List
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsList

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - Remove Windows Components Using Package List
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                [47m[31m W A R N I N G [44m[97m
	echo.                                 =============
	echo.
	echo.   Removing the packages without proper testing can break the OS and or it's
	echo.   functionalities.
	echo.
	echo.   When adding packages to the RemovePkgsList.txt, only add the parent package
	echo.   names excluding it's language packages or sub-packages.
	echo.
	if "%SelectedSourceOS%" neq "w10" echo.
	if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" lss "17763" echo.
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
		echo.   E.g: WindowsDefender ^(ToolKitHelper.exe Method^)
		echo.
	)
	echo.   E.g: Windows-Defender-Client-Package ^(DISM Method^)
	echo.
	echo.   To turn off Warning Dialogs, Choose Disable Dialogs in Tools-^>Options Menu
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do you want to Continue ? ['Y'es/'N'o] : "
	if errorlevel 2 goto :RemoveMenu
)

setlocal

set "RemovePkgsList=%Lists%\RemovePkgsList.txt"
set RemovalMethod=

if "%SelectedSourceOS%" neq "w10" set "RemovalMethod=DISM"
if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" lss "17763" set "RemovalMethod=DISM"

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.      MSMG ToolKit - Remove Windows Components Using Package List Menu
	echo.===============================================================================
	echo.
	echo.  [1]   Remove Windows Components Using Package List ^(DISM Method^)
	echo.
	echo.  [2]   Remove Windows Components Using Package List ^(ToolKitHelper Method^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  Note: Use only one of the above Method
	echo.
	echo.
	echo.  [X]   Go Back
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "Enter Your Choice : "
	if errorlevel 3 goto :RemoveMenu
	if errorlevel 2 set "RemovalMethod=ToolKitHelper"
	if errorlevel 1 set "RemovalMethod=DISM"
)

cls
echo.===============================================================================
echo.        MSMG ToolKit - Remove Windows Components Using Package List
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Removing Windows Components Using Package List####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Removing Windows Components Using Package List#############################
echo.-------------------------------------------------------------------------------

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]============================

		if "%RemovalMethod%" equ "DISM" (
			echo.
			for /f %%z IN ('"type %RemovePkgsList%" 2^>nul') do (
				call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z
			)
		)

		if "%RemovalMethod%" equ "ToolKitHelper" (
			echo.
			"%ToolKitHelper%" "%InstallMount%\%%i" "%RemovePkgsList%"
			echo.
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Removing Windows Components Using Package List####################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set RemovePkgsList=
set RemovalMethod=

endlocal

:: Returning to Remove Menu.
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Enable Windows Features Using Features List
::-------------------------------------------------------------------------------------------
:EnableFeatures

setlocal

set "FeaturesList=%Lists%\EnableFeaturesList.txt"

cls
echo.===============================================================================
echo.        MSMG ToolKit - Enable Windows Features Using Features List
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Enabling Windows Features Using Features List#####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Enabling Windows Features Using Features List##############################
echo.-------------------------------------------------------------------------------

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.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.Enabling Windows Feature - [%%z]...
			echo.-------------------------------------------------------------------------------
			call :EnableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Enabling Windows Features Using Features List#####################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set FeaturesList=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Disable Windows Features Using Features List
::-------------------------------------------------------------------------------------------
:DisableFeatures

setlocal

set "FeaturesList=%Lists%\DisableFeaturesList.txt"

cls
echo.===============================================================================
echo.        MSMG ToolKit - Disable Windows Features Using Features List
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Disabling Windows Features Using Features List####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Disabling Windows Features Using Features List#############################
echo.-------------------------------------------------------------------------------

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.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.Disabling Windows Feature - [%%z]...
			echo.-------------------------------------------------------------------------------
			call :DisableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Finished Disabling Windows Features Using Features List####################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set FeaturesList=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom Default Inbox Apps Associations from XML File
::-------------------------------------------------------------------------------------------
:ImportMetroAppsAssociation

setlocal

set "CustomAppsAssociationXML=%XMLs%\%SelectedSourceOS%_CustomAppsAssociation.xml"

cls
echo.===============================================================================
echo.  MSMG ToolKit - Import Custom Default Inbox Apps Associations from XML File
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Importing Custom Default Inbox Apps Associations from XML File####
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Importing Custom Default Inbox Apps Associations from XML File#############
echo.-------------------------------------------------------------------------------

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.

		call :ImportDefaultAppAssociations "%InstallMount%\%%i", "%CustomAppsAssociationXML%"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Importing Custom Default Inbox Apps Associations from XML File####
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CustomAppsAssociationXML=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Export Default Inbox Apps Associations to XML File
::-------------------------------------------------------------------------------------------
:ExportMetroAppsAssociation

setlocal

set "DefaultMetroAppsAssociationXML=%XMLs%\%SelectedSourceOS%_DefaultAppsAssociation.xml"

cls
echo.===============================================================================
echo.      MSMG ToolKit - Export Default Inbox Apps Associations to XML File
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Exporting Default Inbox Apps Associations to XML File#############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Checking for Default Inbox Apps Association################################
echo.-------------------------------------------------------------------------------
echo.
%DISM% /Image:"%InstallMount%\%DefaultIndexNo%" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
if errorlevel 1 (
	echo.Found Default Inbox Apps Association XML File...
	echo.
	echo.-------------------------------------------------------------------------------
	echo.Exporting Default Inbox Apps Associations to XML File...
	echo.-------------------------------------------------------------------------------
	echo.
	call :RemoveFile "%DefaultMetroAppsAssociationXML%"
	%DISM% /Image:"%InstallMount%\%DefaultIndexNo%" /Get-DefaultAppAssociations | findstr "<" >> "%DefaultMetroAppsAssociationXML%"
	echo.
	echo.-------------------------------------------------------------------------------
	echo.####Finished Exporting Default Inbox Apps Associations to XML File#############
	echo.-------------------------------------------------------------------------------
	goto :Stop
)
if not errorlevel 1 (
	echo.Default Inbox Apps Association is empty...
	echo.
	echo.-------------------------------------------------------------------------------
	echo.####Stopped Exporting Default Inbox Apps Associations to XML File##############
	echo.-------------------------------------------------------------------------------
	goto :Stop
)

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set DefaultMetroAppsAssociationXML=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Default Inbox Apps Association
::-------------------------------------------------------------------------------------------
:RemoveMetroAppsAssociation

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - Remove Default Inbox Apps Association
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Removing Default Inbox Apps Association###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------

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.
		echo.-------------------------------------------------------------------------------
		echo.Checking for Default Inbox Apps Association...
		echo.-------------------------------------------------------------------------------
		echo.
		%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
		if errorlevel 1 (
			echo.Found Default Inbox Apps Association XML File.
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Removing Default Inbox Apps Association...
			echo.-------------------------------------------------------------------------------
			call :RemoveDefaultAppAssociations "%InstallMount%\%%i"
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####Finished Removing Default Inbox Apps Association###########################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		) else (
			echo.Default Inbox Apps Association has already been removed.
			echo.
			echo.Skipping Removing Default Inbox Apps Association.
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####Stopped Removing Default Inbox Apps Association############################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		)
	)
)

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom StartMenu Layout from XML File
::-------------------------------------------------------------------------------------------
:ImportStartMenuLayout

setlocal

cls
echo.===============================================================================
echo.        MSMG ToolKit - Import Custom StartMenu Layout from XML File
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####Starting Importing Custom StartMenu Layout from XML File###################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Importing Custom StartMenu Layout from XML File############################
echo.-------------------------------------------------------------------------------

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.
		echo.Copying the Custom StartMenu Layout...
		echo.
		copy /y "%XMLs%\DefaultLayouts.xml" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
		copy /y "%XMLs%\LayoutModification.xml" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
		if "%SelectedSourceOS%" == "w11" copy /y "%XMLs%\LayoutModification.json" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Importing Custom StartMenu Layout from XML File###################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom Registry Settings from Registry File
::-------------------------------------------------------------------------------------------
:ImportCustomRegistry

setlocal

cls
echo.===============================================================================
echo.     MSMG ToolKit - Import Custom Registry Settings from Registry File
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "CustomRegistry=%CustomRegistry%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom Registry Settings Pack folder is empty
for /f %%i in ('dir /b /a:-d "%CustomRegistry%\*.reg" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.Custom Registry Settings folder is empty...
		echo.
		echo.Please copy the registry files to ^<Custom\Registry\%SelectedSourceOS%\%ImageArchitecture%^> folder...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####Starting Importing Custom Registry Settings from Registry File#############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####Processing Custom Registry Settings Files##################################
echo.-------------------------------------------------------------------------------
echo.
echo.Making Custom Registry compatible with ToolKit's Image Registry...
call :RemoveFolder "%Temp%\CustomRegistry"
call :CreateFolder "%Temp%\CustomRegistry"
PowerShell -Executionpolicy Bypass -File "%Bin%\ConvertReg.ps1" "%CustomRegistry%" "%Temp%\CustomRegistry"
echo.
echo.-------------------------------------------------------------------------------
echo.####Importing Custom Registry Settings from Registry File######################
echo.-------------------------------------------------------------------------------

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.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.

		for /f "tokens=*" %%z in ('"dir /b "%Temp%\CustomRegistry\*.reg"" 2^>nul') do (
			echo.Importing [%%z] to Image Registry...
			call :ImportRegistry2Image "%Temp%\CustomRegistry\%%z"
		)

		echo.
		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

call :RemoveFolder "%Temp%\CustomRegistry"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Importing Custom Registry Settings from Registry File#############
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CustomRegistry=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply Tweaks Menu
::-------------------------------------------------------------------------------------------
:ApplyTweaksMenu

setlocal

set Tweak=

cls
echo.===============================================================================
echo.                      MSMG ToolKit - Apply Tweaks Menu
echo.===============================================================================
echo.

if "%SelectedSourceOS%" equ "w81" (
	echo.  [ 1]   Disable Automatic Driver Updates through Windows Update
	echo.  [ 2]   Disable Automatic Download and Install of 3rd Party Apps
	echo.  [ 3]   Disable Windows Defender
	echo.  [ 4]   Disable Windows Firewall
	echo.  [ 5]   Disable Windows SmartScreen
	echo.  [ 6]   Disable Automatic Windows Upgrade
	echo.  [ 7]   Disable Windows Update
	echo.  [ 8]   Force .NET Programs to Use Newest .NET Framework
	echo.  [ 9]   Enable Windows Photo Viewer
	echo.  [10]   Enable Fraunhofer MP3 Professional Codec
	echo.
	echo.
	echo.
	echo.
	echo.  [A]    All Tweaks
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "4" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "5" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "6" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "7" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "8" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "9" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "10" set "Tweak=EnableFMP3ProCodec"
	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if "%SelectedSourceOS%" equ "w10" (
	echo.  [ 1]   Disable Automatic Driver Updates through Windows Update
	echo.  [ 2]   Disable Automatic Download and Install of 3rd Party Apps
	echo.  [ 3]   Disable Automatic Windows Upgrade
	echo.  [ 4]   Disable Cortana App
	echo.  [ 5]   Disable Downloads Folder Auto Group By Date Layout
	echo.  [ 6]   Disable Microsoft Reserved Storage Space for Windows Updates
	echo.  [ 7]   Disable Windows Defender
	echo.  [ 8]   Disable Windows Firewall
	echo.  [ 9]   Disable Windows SmartScreen
	echo.  [10]   Disable Windows Update
	echo.  [11]   Enable DISM Image Cleanup with Full ResetBase
	echo.  [12]   Enable Fraunhofer MP3 Professional Codec
	echo.  [13]   Enable Windows Photo Viewer
	echo.  [14]   Force .NET Programs to Use Newest .NET Framework
	echo.  [15]   Hide Taskbar Cortana Icon
	echo.  [16]   Hide Taskbar Meet Now Icon
	echo.  [17]   Hide Taskbar News and Interests
	echo   [18]   Hide Taskbar Search Bar
	echo.  [19]   Hide Taskbar Task View Icon
	echo.
	echo.  [A]    All Tweaks
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "4" set "Tweak=DisableCortanaApp"
	if "!MenuChoice!" equ "5" set "Tweak=DisableDownloadsLayout"
	if "!MenuChoice!" equ "6" set "Tweak=DisableReservedStorage"
	if "!MenuChoice!" equ "7" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "8" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "9" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "10" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "11" set "Tweak=EnableFullResetBase"
	if "!MenuChoice!" equ "12" set "Tweak=EnableFMP3ProCodec"
	if "!MenuChoice!" equ "13" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "14" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "15" set "Tweak=HideCortanaIcon"
	if "!MenuChoice!" equ "16" set "Tweak=HideMeetNowIcon"
	if "!MenuChoice!" equ "17" set "Tweak=HideNewsAndInterests"
	if "!MenuChoice!" equ "18" set "Tweak=HideSearchBar"
	if "!MenuChoice!" equ "19" set "Tweak=HideTaskViewIcon"
	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if "%SelectedSourceOS%" equ "w11" (
	echo.  [ 1]   Disable Automatic Driver Updates through Windows Update
	echo.  [ 2]   Disable Automatic Download and Install of 3rd Party Apps
	echo.  [ 3]   Disable Automatic Download and Install of Microsoft Teams App
	echo.  [ 4]   Disable Automatic Windows Upgrade
	echo.  [ 5]   Disable Cortana App
	echo.  [ 6]   Disable Downloads Folder Auto Group By Date Layout
	echo.  [ 7]   Disable Microsoft Reserved Storage Space for Windows Updates
	echo.  [ 8]   Disable Windows 11 Installer Hardware Check
	echo.  [ 9]   Disable Windows Defender
	echo.  [10]   Disable Windows Firewall
	echo.  [11]   Disable Windows SmartScreen
	echo.  [12]   Disable Windows Update
	echo.  [13]   Enable DISM Image Cleanup with Full ResetBase
	echo.  [14]   Enable Fraunhofer MP3 Professional Codec
	echo.  [15]   Enable Windows Classic Context Menus
	echo.  [16]   Enable Windows Local Account
	echo.  [17]   Enable Windows Photo Viewer
	echo.  [18]   Force .NET Programs to Use Newest .NET Framework
	echo.  [19]   Hide Taskbar Chat Icon
	echo.  [20]   Hide Taskbar Cortana Icon
	echo.  [21]   Hide Taskbar Meet Now Icon
	echo.  [22]   Hide Taskbar News and Interests
	echo   [23]   Hide Taskbar Search Bar
	echo.  [24]   Hide Taskbar Task View Icon
	echo.  [25]   Hide Taskbar Widgets Icon
	echo.  [26]   Set Taskbar Alignment to Left
	echo.
	echo.  [A]    All Tweaks
	echo.  [X]    Go Back
	echo.
	echo.===============================================================================
	set /p MenuChoice=Enter Your Choice : 

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableTeamsApp"
	if "!MenuChoice!" equ "4" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "5" set "Tweak=DisableCortanaApp"
	if "!MenuChoice!" equ "6" set "Tweak=DisableDownloadsLayout"
	if "!MenuChoice!" equ "7" set "Tweak=DisableReservedStorage"
	if "!MenuChoice!" equ "8" set "Tweak=DisableW11InstHardwareCheck"
	if "!MenuChoice!" equ "9" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "10" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "11" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "12" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "13" set "Tweak=EnableFullResetBase"
	if "!MenuChoice!" equ "14" set "Tweak=EnableFMP3ProCodec"
	if "!MenuChoice!" equ "15" set "Tweak=EnableClassicContextMenu"
	if "!MenuChoice!" equ "16" set "Tweak=EnableLocalAccount"
	if "!MenuChoice!" equ "17" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "18" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "19" set "Tweak=HideChatIcon"
	if "!MenuChoice!" equ "20" set "Tweak=HideCortanaIcon"
	if "!MenuChoice!" equ "21" set "Tweak=HideMeetNowIcon"
	if "!MenuChoice!" equ "22" set "Tweak=HideNewsAndInterests"
	if "!MenuChoice!" equ "23" set "Tweak=HideSearchBar"
	if "!MenuChoice!" equ "24" set "Tweak=HideTaskViewIcon"
	if "!MenuChoice!" equ "25" set "Tweak=HideWidgetsIcon"
	if "!MenuChoice!" equ "26" set "Tweak=SetTaskbarAlignLeft"
	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if /i "%Tweak%" equ "" goto :ApplyTweaksMenu

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Apply Tweaks
echo.===============================================================================
echo.
:: Get updated Image Information
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
	call :GetUpdatedImageInformation
)

:: Getting Install Image Index Architecture
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

if "%Tweak%" equ "DisableW11InstHardwareCheck" if "%IsBootImageSelected%" equ "No" (
	echo.Windows Setup Boot Image is not selected...
	echo.
	echo.Please choose Windows Setup Boot Image while selecting Source...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Applying Tweaks###################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Tweak%" equ "AllTweaks" echo.####Applying All Tweaks########################################################
if "%Tweak%" equ "Disable3RDPartyApps" echo.####Applying Disable Automatic Download and Install of 3rd Party Apps Tweak####
if "%Tweak%" equ "DisableCortanaApp" echo.####Applying Disable Cortana App Tweak#########################################
if "%Tweak%" equ "DisableDownloadsLayout" echo.####Applying Disable Downloads Folder Auto Group By Date Layout Tweak##########
if "%Tweak%" equ "DisableDriversUpdates" echo.####Applying Disable Automatic Driver Updates through Windows Update Tweak#####
if "%Tweak%" equ "DisableReservedStorage" echo.####Applying Disable Microsoft Reserved Storage Space for Windows Updates######
if "%Tweak%" equ "DisableTeamsApp" echo.####Applying Disable Automatic Download and Install of Teams App Tweak#########
if "%Tweak%" equ "DisableW11InstHardwareCheck" echo.####Applying Disable Windows 11 Installer Hardware Check#######################
if "%Tweak%" equ "DisableWindowsDefender" echo.####Applying Disable Windows Defender Tweak####################################
if "%Tweak%" equ "DisableWindowsFirewall" echo.####Applying Disable Windows Firewall Tweak####################################
if "%Tweak%" equ "DisableWindowsSmartScreen" echo.####Applying Disable Windows SmartScreen Tweak################################
if "%Tweak%" equ "DisableWindowsUpdate" echo.####Applying Disable Windows Update Tweak######################################
if "%Tweak%" equ "DisableWindowsUpgrade" echo.####Applying Disable Automatic Windows OS Upgrade Tweak########################
if "%Tweak%" equ "EnableClassicContextMenu" echo.####Applying Enable Windows Classic Context Menus##############################
if "%Tweak%" equ "EnableFMP3ProCodec" echo.####Applying Enable Fraunhofer MP3 Professional Codec Tweak####################
if "%Tweak%" equ "EnableFullResetBase" echo.####Applying Enable DISM Image Cleanup with Full ResetBase Tweak###############
if "%Tweak%" equ "EnableLocalAccount" echo.####Applying Enable Windows Local Account Tweak#################################
if "%Tweak%" equ "EnablePhotoViewer" echo.####Applying Enable Windows Photo Viewer Tweak#################################
if "%Tweak%" equ "ForceLatestNetFramework" echo.####Applying Force .NET Programs to Use Newest .NET Framework Tweak############
if "%Tweak%" equ "HideChatIcon" echo.####Applying Hide Taskbar Chat Icon Tweak######################################
if "%Tweak%" equ "HideCortanaIcon" echo.####Applying Hide Taskbar Cortana Icon Tweak###################################
if "%Tweak%" equ "HideMeetNowIcon" echo.####Applying Hide Taskbar Meet Now Icon Tweak##################################
if "%Tweak%" equ "HideNewsAndInterests" echo.####Applying Hide Taskbar News ^& Interest Tweak###############################
if "%Tweak%" equ "HideSearchBar" echo.####Applying Hide Taskbar Search Bar###########################################
if "%Tweak%" equ "HideTaskViewIcon" echo.####Applying Hide Taskbar TaskView Icon Tweak##################################
if "%Tweak%" equ "HideWidgetsIcon" echo.####Applying Hide Taskbar Widgets Icon Tweak###################################
if "%Tweak%" equ "SetTaskbarAlignLeft" echo.####Applying Set Taskbar Alignment to Left Tweak###############################
echo.-------------------------------------------------------------------------------

if "%Tweak%" equ "DisableW11InstHardwareCheck" (
	echo.
	if not %%i gtr 9 echo.===========================[Boot.wim, Index : 2]============================
	echo.
	echo.Mounting Image Registry...
	echo.Applying Disable Windows 11 Installer Hardware Check Tweak...
	Reg load "HKLM\TK_BOOT_SYSTEM" "%BootMount%\2\Windows\System32\Config\SYSTEM" >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	echo.Un-Mounting Image Registry...
	Reg unload "HKLM\TK_BOOT_SYSTEM" >nul 2>&1
	if exist "%DVD%\sources\appraiserres.dll" move "%DVD%\sources\appraiserres.dll" "%DVD%\sources\appraiserres.dll.bak"
)

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.
		echo.Mounting Image Registry...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.Importing Registry Settings to Image Registry...

		if "%Tweak%" equ "DisableW11InstHardwareCheck" (
			Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableCortanaApp" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" /v "EnableCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\AboveLock" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Experience" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana ActionUriServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana Package" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana PlacesServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersShareTargetApp.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana SearchUI.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableDownloadsLayout" (
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "GroupBy" /t REG_SZ /d "System.None" /f >nul 2>&1
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "PrimaryProperty" /t REG_SZ /d "System.Name" /f >nul 2>&1
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "SortByList" /t REG_SZ /d "prop:System.Name" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideChatIcon" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v "ChatIcon" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideCortanaIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCortanaButton" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "HideMeetNowIcon" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideNewsAndInterests" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v "ShellFeedsTaskbarViewMode" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "HeadlinesOnboardingComplete" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideTaskViewIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "HideSearchBar" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "HideWidgetsIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "DisableDriversUpdates" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		if "%Tweak%" equ "Disable3RDPartyApps" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul 2>&1

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d "{\"pinnedList\": [{}]}" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins_ProviderSet" /t REG_DWORD /d "0" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "DisableTeamsApp" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "DisableWindowsDefender" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtectionSource" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Signature Updates" /v "FirstAuGracePeriod" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\UX Configuration" /v "DisablePrivacyMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" /v "SecurityHealth" /t REG_BINARY /d "030000000000000000000000" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontOfferThroughWUAU" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "RandomizeScheduleTaskTimes" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions" /v "DisableAutoExclusions" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "LocalSettingOverridePurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "PurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScriptScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleDay" /t REG_DWORD /d "8" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "AdditionalActionTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "CriticalFailureTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericRePorts" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "NonCriticalTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "AvgCPULoadFactor" /t REG_DWORD /d "10" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableArchiveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupQuickScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRemovableDriveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRestorePoint" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningMappedNetworkDrivesForFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningNetworkFiles" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "PurgeItemsAfterDelay" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanOnlyIfIdle" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanParameters" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "DisableUpdateOnStartupWithoutEngine" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "SignatureUpdateCatchupInterval" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReporting" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReportingLocation" /t REG_MULTI_SZ /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "2" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\CI\Policy" /v "VerifiedAndReputablePolicyState" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\Microsoft-Antimalware-ShieldProvider" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\MsSecFlt" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\Sense" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdBoot" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdFilter" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableWindowsFirewall" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PublicProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PrivateProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "DisableFirewall" /t REG_SZ /d "%%windir%%\System32\netsh.exe advfirewall set allprofiles state off" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableWindowsSmartScreen" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Security Health\State" /v "AppAndBrowser_StoreAppsSmartScreenOff" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControl" /t REG_SZ /d "Anywhere" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControlEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableWindowsUpgrade" (
			if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Gwx" /v "DisableGwx" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpdatePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgradePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersion" /t REG_DWORD /d "1" /f >nul 2>&1
				if "%ImageBuild%" geq "17134" if "%ImageBuild%" leq "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ProductVersion" /t REG_SZ /d "Windows 10" /f >nul 2>&1
				if "%ImageBuild%" equ "17134" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1803" /f >nul 2>&1
				if "%ImageBuild%" equ "17763" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1809" /f >nul 2>&1
				if "%ImageBuild%" equ "18362" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1903" /f >nul 2>&1
				if "%ImageBuild%" equ "18363" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1909" /f >nul 2>&1
				if "%ImageBuild%" equ "19041" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2004" /f >nul 2>&1
				if "%ImageBuild%" equ "19042" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2009" /f >nul 2>&1
				if "%ImageBuild%" equ "19043" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H1" /f >nul 2>&1
				if "%ImageBuild%" equ "19044" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "19045" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /f >nul 2>&1
				if "%ImageBuild%" equ "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "22000" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "DisableWindowsUpdate" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "SystemSettingsDownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "OptInOOBE" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "5" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\7971f918-a847-4430-9279-4a52d1efe18d" /v "RegisteredWithAU" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceUpdateAgent/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-WindowsUpdateClient/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v "HideMCTLink" /t REG_DWORD /d "1" /f >nul 2>&1

			if "%ImageDefaultLanguage%" equ "zh-CN" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-HK" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-TW" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1

			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Speech" /v "AllowSpeechModelUpdate" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DoNotConnectToWindowsUpdateInternetLocations" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableWindowsUpdateAccess" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUStatusServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "UpdateServiceUrlAlternate" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "UseWUServer" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\wuauserv" /v "Start" /t REG_DWORD /d "3" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableReservedStorage" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "ForceLatestNetFramework" Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul 2>&1
		if "%Tweak%" equ "EnableLocalAccount" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f >nul 2>&1

		if "%Tweak%" equ "EnablePhotoViewer" (
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3056" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3058" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3069" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationName" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3009" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
		)

		if "%Tweak%" equ "EnableClassicContextMenu" Reg add "HKLM\TK_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f >nul 2>&1

		if "%Tweak%" equ "EnableFMP3ProCodec" (
			Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul 2>&1

			if "%ImageArchitecture%" equ "x64" (
				Reg delete "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\SysWOW64\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\SysWOW64\l3codecp.acm" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "EnableFullResetBase" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "SetTaskbarAlignLeft" Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarAl" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "AllTweaks" (
			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" /v "EnableCortana" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\AboveLock" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Experience" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana ActionUriServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana Package" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana PlacesServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersShareTargetApp.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana SearchUI.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
				Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "GroupBy" /t REG_SZ /d "System.None" /f >nul 2>&1
				Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "PrimaryProperty" /t REG_SZ /d "System.Name" /f >nul 2>&1
				Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "SortByList" /t REG_SZ /d "prop:System.Name" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v "ChatIcon" /t REG_DWORD /d "3" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCortanaButton" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w10" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v "ShellFeedsTaskbarViewMode" /t REG_DWORD /d "2" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "HeadlinesOnboardingComplete" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul 2>&1


			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d "{\"pinnedList\": [{}]}" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins_ProviderSet" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtectionSource" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Signature Updates" /v "FirstAuGracePeriod" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\UX Configuration" /v "DisablePrivacyMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" /v "SecurityHealth" /t REG_BINARY /d "030000000000000000000000" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontOfferThroughWUAU" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "RandomizeScheduleTaskTimes" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions" /v "DisableAutoExclusions" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "LocalSettingOverridePurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "PurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScriptScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleDay" /t REG_DWORD /d "8" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "AdditionalActionTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "CriticalFailureTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericRePorts" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "NonCriticalTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "AvgCPULoadFactor" /t REG_DWORD /d "10" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableArchiveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupQuickScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRemovableDriveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRestorePoint" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningMappedNetworkDrivesForFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningNetworkFiles" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "PurgeItemsAfterDelay" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanOnlyIfIdle" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanParameters" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "DisableUpdateOnStartupWithoutEngine" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "SignatureUpdateCatchupInterval" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReporting" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReportingLocation" /t REG_MULTI_SZ /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "2" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\CI\Policy" /v "VerifiedAndReputablePolicyState" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\Microsoft-Antimalware-ShieldProvider" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\MsSecFlt" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\Sense" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdBoot" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdFilter" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PrivateProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PublicProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "DisableFirewall" /t REG_SZ /d "%%windir%%\System32\netsh.exe advfirewall set allprofiles state off" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Security Health\State" /v "AppAndBrowser_StoreAppsSmartScreenOff" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControl" /t REG_SZ /d "Anywhere" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControlEnabled" /t REG_DWORD /d "0" /f >nul 2>&1

			if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Gwx" /v "DisableGwx" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpdatePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgradePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersion" /t REG_DWORD /d "1" /f >nul 2>&1
				if "%ImageBuild%" geq "17134" if "%ImageBuild%" leq "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ProductVersion" /t REG_SZ /d "Windows 10" /f >nul 2>&1
				if "%ImageBuild%" equ "17134" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1803" /f >nul 2>&1
				if "%ImageBuild%" equ "17763" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1809" /f >nul 2>&1
				if "%ImageBuild%" equ "18362" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1903" /f >nul 2>&1
				if "%ImageBuild%" equ "18363" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1909" /f >nul 2>&1
				if "%ImageBuild%" equ "19041" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2004" /f >nul 2>&1
				if "%ImageBuild%" equ "19042" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2009" /f >nul 2>&1
				if "%ImageBuild%" equ "19043" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H1" /f >nul 2>&1
				if "%ImageBuild%" equ "19044" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "19045" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /f >nul 2>&1
				if "%ImageBuild%" equ "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "22000" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /f >nul 2>&1
			)

			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "SystemSettingsDownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "OptInOOBE" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\7971f918-a847-4430-9279-4a52d1efe18d" /v "RegisteredWithAU" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceUpdateAgent/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-WindowsUpdateClient/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v "HideMCTLink" /t REG_DWORD /d "1" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-CN" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-HK" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-TW" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Speech" /v "AllowSpeechModelUpdate" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DoNotConnectToWindowsUpdateInternetLocations" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableWindowsUpdateAccess" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUStatusServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "UpdateServiceUrlAlternate" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "UseWUServer" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\wuauserv" /v "Start" /t REG_DWORD /d "3" /f >nul 2>&1
			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3056" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3058" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3069" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationName" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3009" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f >nul 2>&1
			Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul 2>&1

			if "%ImageArchitecture%" equ "x64" (
				Reg delete "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\SysWOW64\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\SysWOW64\l3codecp.acm" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarAl" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		echo.Un-Mounting Image Registry...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Applying Tweaks###################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set Tweaks=

endlocal

:: Returning to Apply Tweaks Menu
goto :ApplyTweaksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Unattend XML
::-------------------------------------------------------------------------------------------
:UnattendedXML

if "!Unattend_AccountName!" neq "" if "!Unattend_Password!" equ "" set "Unattend_AutoLogon=Enabled"

cls
echo.===============================================================================
echo.                        MSMG ToolKit - Unattend XML
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.### Starting Writing Unattend XML file to Source DVD Folder ###################
echo.-------------------------------------------------------------------------------

(
	echo.^<^?xml version="1.0" encoding="utf-8"^?^>
	echo.
	echo.^<^^!-- *************************************************
	echo.Installation Notes :
	echo.- - - - - - - - - - - - - - - - - - - - - - - - -
	echo.This "Autounattend.xml" file works for both installation modes: Legacy BIOS-based ^(MBR^) and UEFI-based ^(GPT^).
	echo.This method will show the UI ^(User Interface^): in the INDEX ^(Windows Editions^) selection, disk configuration
	echo.^(partition settings^) and user account.
	echo.If you need to set preferences for automating disk partitioning, you need to make a Autounattend.xml file for each installation media:
	echo.  1^) For MBR mode ^(based on legacy BIOS^) 
	echo.  2^) For UEFI-based mode ^(GPT^)
	echo.This is due to the specific differences required in the configuration for each of the partition tables.
	echo.************************************************** --^>
	echo.
	echo.^<unattend xmlns="urn:schemas-microsoft-com:unattend"^>
	echo.	^<settings pass="windowsPE"^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SetupUILanguage^>
		echo.				^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		echo.			^</SetupUILanguage^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SetupUILanguage^>
	echo.				^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	echo.			^</SetupUILanguage^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableFirewall^>true^</EnableFirewall^>
		echo.			^<EnableNetwork^>false^</EnableNetwork^>
		echo.			^<UseConfigurationSet^>true^</UseConfigurationSet^>
		echo.			^<ComplianceCheck^>
		echo.				^<DisplayReport^>OnError^</DisplayReport^>
		echo.			^</ComplianceCheck^>
		echo.			^<Diagnostics^>
		echo.				^<OptIn^>false^</OptIn^>
		echo.			^</Diagnostics^>
		echo.			^<DynamicUpdate^>
		echo.				^<Enable^>false^</Enable^>
		echo.				^<WillShowUI^>OnError^</WillShowUI^>
		echo.			^</DynamicUpdate^>
		echo.			^<UpgradeData^>
		echo.				^<Upgrade^>true^</Upgrade^>
		echo.				^<WillShowUI^>OnError^</WillShowUI^>
		echo.			^</UpgradeData^>
		echo.			^<UserData^>
		echo.				^<AcceptEula^>true^</AcceptEula^>
		if "!Unattend_AccountName!" neq "" echo.				^<FullName^>!Unattend_AccountName!^</FullName^>
		if "!Unattend_OrganizationName!" neq "" echo.				^<Organization^>!Unattend_OrganizationName!^</Organization^>
		echo.				^<ProductKey^>
		echo.					^<Key^>^</Key^>
		echo.					^<WillShowUI^>OnError^</WillShowUI^>
		echo.				^</ProductKey^>
		echo.			^</UserData^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableFirewall^>true^</EnableFirewall^>
	echo.			^<EnableNetwork^>false^</EnableNetwork^>
	echo.			^<UseConfigurationSet^>true^</UseConfigurationSet^>
	echo.			^<ComplianceCheck^>
	echo.				^<DisplayReport^>OnError^</DisplayReport^>
	echo.			^</ComplianceCheck^>
	echo.			^<Diagnostics^>
	echo.				^<OptIn^>false^</OptIn^>
	echo.			^</Diagnostics^>
	echo.			^<DynamicUpdate^>
	echo.				^<Enable^>false^</Enable^>
	echo.				^<WillShowUI^>OnError^</WillShowUI^>
	echo.			^</DynamicUpdate^>
	echo.			^<UpgradeData^>
	echo.				^<Upgrade^>true^</Upgrade^>
	echo.				^<WillShowUI^>OnError^</WillShowUI^>
	echo.			^</UpgradeData^>
	echo.			^<UserData^>
	echo.				^<AcceptEula^>true^</AcceptEula^>
	if "!Unattend_AccountName!" neq "" echo.				^<FullName^>!Unattend_AccountName!^</FullName^>
	if "!Unattend_OrganizationName!" neq "" echo.				^<Organization^>!Unattend_OrganizationName!^</Organization^>
	echo.				^<ProductKey^>
	echo.					^<Key^>^</Key^>
	echo.					^<WillShowUI^>OnError^</WillShowUI^>
	echo.				^</ProductKey^>
	echo.			^</UserData^>
	echo.		^</component^>
	echo.	^</settings^>
	if "%ImageBuild%" geq "22000" echo.	^<^^!-- ^<settings pass="offlineServicing" wasPassProcessed="true"^> --^>
	echo.	^<settings pass="offlineServicing"^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableLUA^>true^</EnableLUA^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableLUA^>true^</EnableLUA^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<DesktopOptimization^>
		echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
		echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
		echo.			^</DesktopOptimization^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<DesktopOptimization^>
	echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
	echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
	echo.			^</DesktopOptimization^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="generalize"^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-PnpSysprep" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PersistAllDeviceInstalls^>false^</PersistAllDeviceInstalls^>
		echo.			^<DoNotCleanUpNonPresentDevices^>false^</DoNotCleanUpNonPresentDevices^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PersistAllDeviceInstalls^>false^</PersistAllDeviceInstalls^>
	echo.			^<DoNotCleanUpNonPresentDevices^>false^</DoNotCleanUpNonPresentDevices^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Security-SPP" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<SkipRearm^>1^</SkipRearm^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipRearm^>1^</SkipRearm^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-WorkstationService" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<OtherDomains^>^</OtherDomains^>
		echo.			^<AllowInsecureGuestAuth^>0^</AllowInsecureGuestAuth^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-WorkstationService" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<OtherDomains^>^</OtherDomains^>
	echo.			^<AllowInsecureGuestAuth^>0^</AllowInsecureGuestAuth^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="specialize"^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Audio-AudioCore" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<DisableSpatialOnComboEndpoints^>false^</DisableSpatialOnComboEndpoints^>
		echo.			^<EnableCaptureMonitor^>false^</EnableCaptureMonitor^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Audio-AudioCore" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<DisableSpatialOnComboEndpoints^>false^</DisableSpatialOnComboEndpoints^>
	echo.			^<EnableCaptureMonitor^>false^</EnableCaptureMonitor^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Audio-VolumeControl" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableVolumeControlWhileLocked^>true^</EnableVolumeControlWhileLocked^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Audio-VolumeControl" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableVolumeControlWhileLocked^>true^</EnableVolumeControlWhileLocked^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<ExtendOSPartition^>
		echo.				^<Extend^>true^</Extend^>
		echo.			^</ExtendOSPartition^>
		echo.			^<^^!-- ^<RunAsynchronous^>
		echo.				^<RunAsynchronousCommand wcm:action="add"^>
		echo.					^<WillReboot^>OnRequest^</WillReboot^>
		echo.				^</RunAsynchronousCommand^>
		echo.			^</RunAsynchronous^> --^>
		echo.			^<^^!-- ^<RunSynchronous^>
		echo.				^<RunSynchronousCommand wcm:action="add"^>
		echo.					^<WillReboot^>OnRequest^</WillReboot^>
		echo.				^</RunSynchronousCommand^>
		echo.			^</RunSynchronous^> --^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<^^!-- ^<RunAsynchronous^>
	echo.				^<RunAsynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunAsynchronousCommand^>
	echo.			^</RunAsynchronous^> --^>
	echo.			^<^^!-- ^<RunSynchronous^>
	echo.				^<RunSynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunSynchronousCommand^>
	echo.			^</RunSynchronous^> --^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<^^!-- ^<RunAsynchronous^>
	echo.				^<RunAsynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunAsynchronousCommand^>
	echo.			^</RunAsynchronous^> --^>
	echo.			^<^^!-- ^<RunSynchronous^>
	echo.				^<RunSynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunSynchronousCommand^>
	echo.			^</RunSynchronous^> --^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		if "!Unattend_AccountName!" neq "" (
			echo.			^<AutoLogon^>
			if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
			if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
			echo.				^<Username^>!Unattend_AccountName!^</Username^>
			echo.				^<Password^>
			echo.					^<PlainText^>true^</PlainText^>
			echo.					^<Value^>!Unattend_Password!^</Value^>
			echo.				^</Password^>
			echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
			echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
			echo.			^</AutoLogon^>
		)
		echo.			^<DesktopOptimization^>
		echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
		echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
		echo.			^</DesktopOptimization^>
		echo.			^<StartTiles^>
		echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
		echo.			^</StartTiles^>
		echo.			^<^^!-- ^<ProductKey^>^</ProductKey^> --^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
		echo.			^<CopyProfile^>false^</CopyProfile^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
		echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
		echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	if "!Unattend_AccountName!" neq "" (
		echo.			^<AutoLogon^>
		if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
		if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
		echo.				^<Username^>!Unattend_AccountName!^</Username^>
		echo.				^<Password^>
		echo.					^<PlainText^>true^</PlainText^>
		echo.					^<Value^>!Unattend_Password!^</Value^>
		echo.				^</Password^>
		echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
		echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
		echo.			^</AutoLogon^>
	)
	echo.			^<DesktopOptimization^>
	echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
	echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
	echo.			^</DesktopOptimization^>
	echo.			^<StartTiles^>
	echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
	echo.			^</StartTiles^>
	echo.			^<^^!-- ^<ProductKey^>^</ProductKey^> --^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
	echo.			^<CopyProfile^>false^</CopyProfile^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
	echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
	echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Networking-MPSSVC-Svc" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<^^!-- ^<FirewallGroups^>
		echo.				^<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"^>
		echo.					^<Active^>true^</Active^>
		echo.					^<Group^>@FirewallAPI.dll,-28752^</Group^>
		echo.					^<Profile^>all^</Profile^>
		echo.				^</FirewallGroup^>
		echo.			^</FirewallGroups^> --^>
		echo.			^<DomainProfile_EnableFirewall^>true^</DomainProfile_EnableFirewall^>
		echo.			^<PrivateProfile_EnableFirewall^>true^</PrivateProfile_EnableFirewall^>
		echo.			^<PublicProfile_EnableFirewall^>true^</PublicProfile_EnableFirewall^>
		echo.			^<PrivateProfile_DisableNotifications^>false^</PrivateProfile_DisableNotifications^>
		echo.		^</component^>
	)
	echo.		^<component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<^^!-- ^<FirewallGroups^>
	echo.				^<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"^>
	echo.					^<Active^>true^</Active^>
	echo.					^<Group^>@FirewallAPI.dll,-28752^</Group^>
	echo.					^<Profile^>all^</Profile^>
	echo.				^</FirewallGroup^>
	echo.			^</FirewallGroups^> --^>
	echo.			^<DomainProfile_EnableFirewall^>true^</DomainProfile_EnableFirewall^>
	echo.			^<PrivateProfile_EnableFirewall^>true^</PrivateProfile_EnableFirewall^>
	echo.			^<PublicProfile_EnableFirewall^>true^</PublicProfile_EnableFirewall^>
	echo.			^<PrivateProfile_DisableNotifications^>false^</PrivateProfile_DisableNotifications^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="oobeSystem"^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<ExtendOSPartition^>
		echo.				^<Extend^>true^</Extend^>
		echo.			^</ExtendOSPartition^>
		echo.			^<Reseal^>
		echo.				^<ForceShutdownNow^>false^</ForceShutdownNow^>
		echo.				^<Mode^>OOBE^</Mode^>
		echo.			^</Reseal^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<Reseal^>
	echo.				^<ForceShutdownNow^>false^</ForceShutdownNow^>
	echo.				^<Mode^>OOBE^</Mode^>
	echo.			^</Reseal^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
	echo.		^</component^>
	if "%ImageBuild%" lss "22000" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<OOBE^>
		echo.				^<HideEULAPage^>true^</HideEULAPage^>
		echo.				^<HideOEMRegistrationScreen^>true^</HideOEMRegistrationScreen^>
		echo.				^<HideOnlineAccountScreens^>true^</HideOnlineAccountScreens^>
		if "!Unattend_AccountName!" equ "" echo.				^<HideLocalAccountScreen^>false^</HideLocalAccountScreen^>
		if "!Unattend_AccountName!" neq "" echo.				^<HideLocalAccountScreen^>true^</HideLocalAccountScreen^>
		echo.				^<HideWirelessSetupInOOBE^>true^</HideWirelessSetupInOOBE^>
		echo.				^<NetworkLocation^>Other^</NetworkLocation^>
		if "!Unattend_AccountName!" equ "" (
			echo.				^<SkipUserOOBE^>false^</SkipUserOOBE^>
			echo.				^<SkipMachineOOBE^>false^</SkipMachineOOBE^>
		)
		if "!Unattend_AccountName!" neq "" (
			echo.				^<SkipUserOOBE^>true^</SkipUserOOBE^>
			echo.				^<SkipMachineOOBE^>true^</SkipMachineOOBE^>
		)
		echo.				^<ProtectYourPC^>3^</ProtectYourPC^>
		echo.				^<UnattendEnableRetailDemo^>false^</UnattendEnableRetailDemo^>
		echo.				^<VMModeOptimizations^>
		echo.					^<SkipAdministratorProfileRemoval^>false^</SkipAdministratorProfileRemoval^>
		echo.					^<SkipNotifyUILanguageChange^>true^</SkipNotifyUILanguageChange^>
		echo.					^<SkipWinREInitialization^>false^</SkipWinREInitialization^>
		echo.				^</VMModeOptimizations^>
		echo.			^</OOBE^>
		if "!Unattend_AccountName!" neq "" (
			echo.			^<AutoLogon^>
			if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
			if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
			echo.				^<Username^>!Unattend_AccountName!^</Username^>
			echo.				^<Password^>
			echo.					^<PlainText^>true^</PlainText^>
			echo.					^<Value^>!Unattend_Password!^</Value^>
			echo.				^</Password^>
			echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
			echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
			echo.			^</AutoLogon^>
			echo.			^<UserAccounts^>
			echo.				^<LocalAccounts^>
			echo.					^<LocalAccount wcm:action="add"^>
			echo.						^<DisplayName^>!Unattend_AccountName!^</DisplayName^>
			echo.						^<Name^>!Unattend_AccountName!^</Name^>
			echo.						^<Group^>Administrators;Power Users^</Group^>
			echo.						^<Password^>
			echo.							^<PlainText^>true^</PlainText^>
			echo.							^<Value^>!Unattend_Password!^</Value^>
			echo.						^</Password^>
			echo.						^<Description^>!Unattend_PasswordDescription!^</Description^>
			echo.					^</LocalAccount^>
			echo.				^</LocalAccounts^>
			echo.			^</UserAccounts^>
		)
		echo.			^<StartTiles^>
		echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
		echo.			^</StartTiles^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
		echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<OOBE^>
	echo.				^<HideEULAPage^>true^</HideEULAPage^>
	echo.				^<HideOEMRegistrationScreen^>true^</HideOEMRegistrationScreen^>
	echo.				^<HideOnlineAccountScreens^>true^</HideOnlineAccountScreens^>
	if "!Unattend_AccountName!" equ "" echo.				^<HideLocalAccountScreen^>false^</HideLocalAccountScreen^>
	if "!Unattend_AccountName!" neq "" echo.				^<HideLocalAccountScreen^>true^</HideLocalAccountScreen^>
	echo.				^<HideWirelessSetupInOOBE^>true^</HideWirelessSetupInOOBE^>
	echo.				^<NetworkLocation^>Other^</NetworkLocation^>
	if "!Unattend_AccountName!" equ "" (
		echo.				^<SkipUserOOBE^>false^</SkipUserOOBE^>
		echo.				^<SkipMachineOOBE^>false^</SkipMachineOOBE^>
	)
	if "!Unattend_AccountName!" neq "" (
		echo.				^<SkipUserOOBE^>true^</SkipUserOOBE^>
		echo.				^<SkipMachineOOBE^>true^</SkipMachineOOBE^>
	)
	echo.				^<ProtectYourPC^>3^</ProtectYourPC^>
	echo.				^<UnattendEnableRetailDemo^>false^</UnattendEnableRetailDemo^>
	echo.				^<VMModeOptimizations^>
	echo.					^<SkipAdministratorProfileRemoval^>false^</SkipAdministratorProfileRemoval^>
	echo.					^<SkipNotifyUILanguageChange^>true^</SkipNotifyUILanguageChange^>
	echo.					^<SkipWinREInitialization^>false^</SkipWinREInitialization^>
	echo.				^</VMModeOptimizations^>
	echo.			^</OOBE^>
	if "!Unattend_AccountName!" neq "" (
		echo.			^<AutoLogon^>
		if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
		if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
		echo.				^<Username^>!Unattend_AccountName!^</Username^>
		echo.				^<Password^>
		echo.					^<PlainText^>true^</PlainText^>
		echo.					^<Value^>!Unattend_Password!^</Value^>
		echo.				^</Password^>
		echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
		echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
		echo.			^</AutoLogon^>
		echo.			^<UserAccounts^>
		echo.				^<LocalAccounts^>
		echo.					^<LocalAccount wcm:action="add"^>
		echo.						^<DisplayName^>!Unattend_AccountName!^</DisplayName^>
		echo.						^<Name^>!Unattend_AccountName!^</Name^>
		echo.						^<Group^>Administrators;Power Users^</Group^>
		echo.						^<Password^>
		echo.							^<PlainText^>true^</PlainText^>
		echo.							^<Value^>!Unattend_Password!^</Value^>
		echo.						^</Password^>
		echo.						^<Description^>!Unattend_PasswordDescription!^</Description^>
		echo.					^</LocalAccount^>
		echo.				^</LocalAccounts^>
		echo.			^</UserAccounts^>
	)
	echo.			^<StartTiles^>
	echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
	echo.			^</StartTiles^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
	echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.^</unattend^>
	echo.
)>"!UnattendXML_Path!"

echo.
echo.-------------------------------------------------------------------------------
echo.### Finished Writing Unattend XML file to Source DVD Folder ###################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================
echo.

call :ValidateXML "!UnattendXML_Path!"

echo.
TIMEOUT.exe /T -1

goto :UnattendedMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Validate "Autounattend.xml" file in DVD folder
:: Input Parameter [ %~1 : XML file path]
::-------------------------------------------------------------------------------------------
:ValidateXML

:: Read in the content and cast it as XML document
if /I exist "%~1" PowerShell.exe -Command "try {$null = [System.Xml.XmlDocument]$(Get-Content -Path '%~1' -ErrorAction 'Stop'); Write-Host -Object $('INFO: XML content syntax verification successfully completed') -ForegroundColor 'Gray'} catch {Write-Host -Object $('ERROR: XML content syntax verification failed') -ForegroundColor 'Red'; Write-Host -Object $('ERROR: ' + $($_.Exception.Message -Join ' ')) -ForegroundColor 'Red'}"

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Cleanup Source Images
::-------------------------------------------------------------------------------------------
:CleanupSource

cls
echo.===============================================================================
echo.   MSMG ToolKit - Cleanup Source Images with Component Cleanup ^& ResetBase
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####Starting Cleaning Up Source Images with Component Cleanup ^& ResetBase######
echo.-------------------------------------------------------------------------------
echo.
if "%IsBootImageSelected%" equ "Yes" (
	:: Performing [Boot.wim, Index : 1 and 2] Image Component Cleanup with ResetBase Option
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.Performing [Boot.wim, Index : %%i] Image Component Cleanup...
		echo.-------------------------------------------------------------------------------
		call :CleanupImage "%BootMount%\%%i", "ComponentCleanupResetBase"
	)
)

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		:: Performing [Install.wim] Image Component Clean-Up with ResetBase Option
		echo.-------------------------------------------------------------------------------
		echo.Performing [Install.wim, Index : %%i] Image Component Cleanup...
		echo.-------------------------------------------------------------------------------
		if exist "%InstallMount%\%%i\Windows\WinSxS\pending.xml" (
			echo.
			echo.Cannot Perform Image Component Cleanup when Pending.xml is present...
			echo.
		) else (
			call :CleanupImage "%InstallMount%\%%i", "ComponentCleanupResetBase"
		)
	)
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	:: Performing [WinRE.wim] Image Component Cleanup with ResetBase Option
	echo.-------------------------------------------------------------------------------
	echo.Performing [Install.wim, Index : %DefaultIndexNo% -^> WinRE.wim] Image Component Cleanup...
	echo.-------------------------------------------------------------------------------
	call :CleanupImage "%WinReMount%", "ComponentCleanupResetBase"
)

echo.-------------------------------------------------------------------------------
echo.####Finished Cleaning Up Source Images with Component Cleanup ^& ResetBase######
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to Apply Menu
goto :ApplyMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply, Save and Optimize Changes to the Source Images
::-------------------------------------------------------------------------------------------
:SaveSource

setlocal

set "TrimEditions=No"

cls
echo.===============================================================================
echo.         MSMG ToolKit - Apply ^& Save Changes to the Source Images
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####Starting Applying ^& Saving Changes to Source Images########################
echo.-------------------------------------------------------------------------------
echo.
if /i "%ImageIndexNo%" neq "A" if %ImageCount% neq 1 (
	choice /C:NY /N /M "Do you want to trim unselected Image editions ? ['Y'es/'N'o] : "
	if errorlevel 2 set "TrimEditions=Yes"
	echo.
)

choice /C:YN /N /M "Do you want to cleanup Image folder ? ['Y'es/'N'o] : "
echo.
if %errorlevel% equ 1 (
	echo.-------------------------------------------------------------------------------
	echo.Cleaning up Image folder...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.Cleaning up Image temporary and log files or folders.
	:: Performing [Boot.wim, Index : 1 and 2] Image Windows folder cleanup
	if "%IsBootImageSelected%" equ "Yes" (
		for /l %%i in (1, 1, 2) do (
			if exist "%BootMount%\%%i\Users\Default\*.LOG1" del /f /q "%BootMount%\%%i\Users\Default\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.LOG2" del /f /q "%BootMount%\%%i\Users\Default\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.TM.blf" del /f /q "%BootMount%\%%i\Users\Default\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.regtrans-ms" del /f /q "%BootMount%\%%i\Users\Default\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\inf\*.log" del /f /q "%BootMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%BootMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%BootMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (call :RemoveFolder %%i)
				del /s /f /q "%BootMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%BootMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Backup\*" del /f /q "%BootMount%\%%i\Windows\WinSxS\Backup\*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
		)
	)

	:: Performing [WinRE.wim, Index : IndexNo] Image Windows folder cleanup
	if "%IsRecoveryImageSelected%" equ "Yes" (
		if exist "%WinReMount%\Users\Default\*.LOG1" del /f /q "%WinReMount%\Users\Default\*.LOG1" >nul 2>&1
		if exist "%WinReMount%\Users\Default\*.LOG2" del /f /q "%WinReMount%\Users\Default\*.LOG2" >nul 2>&1
		if exist "%WinReMount%\Users\Default\*.TM.blf" del /f /q "%WinReMount%\Users\Default\*.TM.blf" >nul 2>&1
		if exist "%WinReMount%\Users\Default\*.regtrans-ms" del /f /q "%WinReMount%\Users\Default\*.regtrans-ms" >nul 2>&1
		if exist "%WinReMount%\Windows\inf\*.log" del /f /q "%WinReMount%\Windows\inf\*.log" >nul 2>&1

		if exist "%WinReMount%\Windows\CbsTemp\*" (
			for /f %%j in ('"dir /s /b /ad "%WinReMount%\Windows\CbsTemp\*"" 2^>nul') do (call :RemoveFolder %%j)
			del /s /f /q "%WinReMount%\Windows\CbsTemp\*" >nul 2>&1
		)

		if exist "%WinReMount%\Windows\System32\config\*.LOG1" del /f /q "%WinReMount%\Windows\System32\config\*.LOG1" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\config\*.LOG2" del /f /q "%WinReMount%\Windows\System32\config\*.LOG2" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\config\*.TM.blf" del /f /q "%WinReMount%\Windows\System32\config\*.TM.blf" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\config\*.regtrans-ms" del /f /q "%WinReMount%\Windows\System32\config\*.regtrans-ms" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
		if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
		if exist "%WinReMount%\Windows\WinSxS\Backup\*" del /f /q "%WinReMount%\Windows\WinSxS\Backup\*" >nul 2>&1
		if exist "%WinReMount%\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%WinReMount%\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
		if exist "%WinReMount%\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%WinReMount%\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
		if exist "%WinReMount%\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%WinReMount%\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
	)

	for /l %%i in (1, 1, %ImageCount%) do (
		:: Performing [Install.wim] Image Windows folder cleanup
		if exist "%InstallMount%\%%i" (
			if exist "%InstallMount%\%%i\$Recycle.Bin" call :RemoveFolder "%InstallMount%\%%i\$Recycle.Bin"
			if exist "%InstallMount%\%%i\PerfLogs" call :RemoveFolder "%InstallMount%\%%i\PerfLogs"
			if exist "%InstallMount%\%%i\Users\Default\*.LOG1" del /f /q "%InstallMount%\%%i\Users\Default\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.LOG2" del /f /q "%InstallMount%\%%i\Users\Default\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.TM.blf" del /f /q "%InstallMount%\%%i\Users\Default\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Users\Default\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\inf\*.log" del /f /q "%InstallMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%InstallMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%InstallMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (call :RemoveFolder %%i)
				del /s /f /q "%InstallMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Backup\*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Backup\*" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%InstallMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
		)
	)
	echo.
)

:: Saving & Un-Mounting Source Boot Images
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.Applying Changes ^& Un-Mounting [Boot.wim, Index : %%i] Image...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Commit"
		call :RemoveFolder "%BootMount%\%%i"
	)

	:: Re-Building Source Boot Image with Maximum Compression.
	echo.-------------------------------------------------------------------------------
	echo.Optimizing Source [Boot.wim] Image with Maximum Compression...
	echo.-------------------------------------------------------------------------------
	rem call :ExportImage "%BootWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%BootWim%"
	echo.
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.Applying Changes ^& Un-Mounting [Install.wim, Index : %DefaultIndexNo% -^> WinRE.wim] Image...
	echo.-------------------------------------------------------------------------------
	call :UnMountImage "%WinReMount%", "Commit"
	call :RemoveFolder "%WinReMount%"

	:: Re-Building Source Recovery Image with Maximum Compression.
	echo.-------------------------------------------------------------------------------
	echo.Optimizing Source [Install.wim, Index : %DefaultIndexNo% -^> WinRE.wim] Image...
	echo.-------------------------------------------------------------------------------
	rem call :ExportImage "%InstallMount%\%DefaultIndexNo%\%WinReWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%InstallMount%\%DefaultIndexNo%\%WinReWim%"
	echo.
	copy /y "%InstallMount%\%DefaultIndexNo%\%WinReWim%" "%Temp%\rebuild.wim"
)

:: Saving & Un-Mounting Source Install & Recovery Images
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if "%IsRecoveryImageSelected%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			echo.Copying Winre.wim file to [Install.wim, Index : %%i] Image...
			echo.-------------------------------------------------------------------------------
			copy /y "%Temp%\rebuild.wim" "%InstallMount%\%%i\%WinReWim%"
			echo.
		)

		echo.-------------------------------------------------------------------------------
		echo.Applying Changes ^& Un-Mounting [Install.wim, Index : %%i] Image...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Commit"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)

if "%IsRecoveryImageSelected%" equ "Yes" del /f /q "%Temp%\rebuild.wim" >nul

:: Re-Building Source Install Image with Maximum Compression.
echo.-------------------------------------------------------------------------------
echo.Optimizing Source [Install.wim] Image with Maximum Compression...
echo.-------------------------------------------------------------------------------

if "%TrimEditions%" equ "Yes" (
	for %%i in (%ImageIndexNo%) do (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%Temp%\rebuild.wim", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%Temp%\rebuild.wim" --compress=LZX
		echo.
	)
	move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul
)

if "%TrimEditions%" equ "No" (
	rem call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%InstallWim%"
	echo.
)

echo.-------------------------------------------------------------------------------
echo.####Finished Applying ^& Saving Changes to Source Images########################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set TrimEditions=

endlocal

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Discard Changes & Unmount Source Images
::-------------------------------------------------------------------------------------------
:DiscardSource

cls
echo.===============================================================================
echo.            MSMG ToolKit - Discard Changes ^& Unmount Source Images
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####Starting Discarding Changes ^& Un-Mounting Source Images####################
echo.-------------------------------------------------------------------------------
echo.
:: Discarding ^& Un-Mounting Source Boot Images
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.Un-Mounting [Boot.wim, Index : %%i] Image...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Discard"
		call :RemoveFolder "%BootMount%\%%i"
	)
)

:: Discarding ^& Un-Mounting Source Install & Recovery Images
if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.Un-Mounting [Install.wim, Index : %DefaultIndexNo% -^> WinRE.wim] Image...
	echo.-------------------------------------------------------------------------------
	call :UnMountImage "%WinReMount%", "Discard"
	call :RemoveFolder "%WinReMount%"
)

for /l %%i in (1, 1, %ImageCount%) do (
   if exist "%InstallMount%\%%i" (
		echo.-------------------------------------------------------------------------------
		echo.Un-Mounting [Install.wim, Index : %%i] Image...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Discard"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)
echo.-------------------------------------------------------------------------------
echo.####Finished Discarding Changes ^& Un-Mounting Source Images####################
echo.-------------------------------------------------------------------------------
echo.

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

:Stop
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Make a DVD ISO Image for Burning to DVD Disc
::-------------------------------------------------------------------------------------------
:MakeISO

setlocal

set "BIOSBoot=%DVD%\boot\etfsboot.com"
set "UEFIBoot=%DVD%\efi\microsoft\boot\efisys.bin"
set ISOLabel=
set ISOFileName=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - Make a DVD ISO Image
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Can't use this feature when the Source OS is selected...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BIOSBoot%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" if not exist "%DVD%\sources\*.swm" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

call :CreateFolder "%ISO%"

echo.-------------------------------------------------------------------------------
echo.####Starting Building a DVD ISO Image##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting DVD ISO Image Details##############################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting ISO Label Name
set /p ISOLabel=Enter the ISO Volume Label : 
echo.

:: Getting ISO File Name
set /p ISOFileName=Enter the ISO File Name : 
echo.

:: Building a DVD ISO Image for Booting with BIOS/UEFI Systems.
echo.-------------------------------------------------------------------------------
echo.####Building a DVD ISO Image###################################################
echo.-------------------------------------------------------------------------------
if "%ISOLabel%" equ "" (
	if exist "%UEFIBoot%" "%Oscdimg%" -bootdata:2#p0,e,b"%BIOSBoot%"#pEF,e,b"%UEFIBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
	if not exist "%UEFIBoot%" "%Oscdimg%" -bootdata:1#p0,e,b"%BIOSBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
)

if "%ISOLabel%" neq "" (
	if exist "%UEFIBoot%" "%Oscdimg%" -bootdata:2#p0,e,b"%BIOSBoot%"#pEF,e,b"%UEFIBoot%" -o -h -m -u2 -udfver102 -l"%ISOLabel%" "%DVD%" "%ISO%\%ISOFileName%.iso"
	if not exist "%UEFIBoot%" "%Oscdimg%" -bootdata:1#p0,e,b"%BIOSBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
)
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Building a DVD ISO Image##########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set BIOSBoot=
set UEFIBoot=
set ISOLabel=
set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Burn a DVD ISO Image to DVD Disc
::-------------------------------------------------------------------------------------------
:BurnISO

setlocal

set DvdDrive=
set ISOFileName=

cls
echo.===============================================================================
echo.             MSMG ToolKit - Burn a DVD ISO Image to a DVD Disc
echo.===============================================================================
echo.

:: Checking whether ISO folder is empty
if not exist "%ISO%\*.iso" (
	echo.ISO Image folder ^<ISO^> is empty...
	echo.
	echo.Please copy ISO Images to ^<ISO^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Burning a DVD ISO Image to a DVD Disc#############################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting DVD Drive ^& DVD ISO Image Details##################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting ISO File Name
set /p ISOFileName=Enter the ISO File Name : 
echo.
:: Getting DVD Drive Letter
set /p DvdDrive=Enter the DVD Drive Letter : 
echo.
echo.-------------------------------------------------------------------------------
echo.####Burning a DVD ISO Image to DVD Disc########################################
echo.-------------------------------------------------------------------------------
echo.
echo.Burning ISO Image file [%ISOFileName%.iso] to DVD Drive [%DvdDrive%:]...
echo.
%DvdBurn% "%DvdDrive%:" "%ISO%\%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Burning a DVD ISO Image to a DVD Disc#############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set DvdDrive=
set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Copy Source Folder to USB Flash Drive
::-------------------------------------------------------------------------------------------
:CopyUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.             MSMG ToolKit - Copy Source Folder to USB Flash Drive
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Can't use this feature when the Source OS is selected...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Copying Source Folder to USB Flash Drive##########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting USB Flash Drive Options############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.Listing Available USB Flash Drives...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=Enter USB Flash Drive Letter : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####Copying Source Folder to USB Flash Drive###################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Copying Source files and folders, Please Wait...
echo.-------------------------------------------------------------------------------
echo.
echo.Source Drive : "%DVD%"
echo.Target Drive : %USBDriveLetter%
echo.
%XCopy% "%DVD%" %USBDriveLetter% >nul
echo.-------------------------------------------------------------------------------
echo.####Finished Copying Source Folder to USB Flash Drive##########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Sync Source Boot and Install Images to USB Flash Drive
::-------------------------------------------------------------------------------------------
:SyncUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.     MSMG ToolKit - Sync Source Boot ^& Install Images to USB Flash Drive
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Can't use this feature when the Source OS is selected...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows Installation Source folder ^<DVD^> is empty...
	echo.
	echo.Please copy Installation Source files to ^<DVD^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Syncing Source Boot ^& Install Images to USB Flash Drive###########
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting USB Flash Drive Options############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.Listing Available USB Flash Drives...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=Enter USB Flash Drive Letter : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####Syncing Source Boot ^& Install Images to USB Flash Drive####################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Copying Source Boot ^& Install Image files, Please Wait...
echo.-------------------------------------------------------------------------------
echo.
echo.Source : ^<\DVD\Sources\Boot.wim^>
if exist "%DVD%\Sources\install.wim" echo.         ^<\DVD\Sources\Install.wim^>
if exist "%DVD%\Sources\install.esd" echo.         ^<\DVD\Sources\Install.esd^>
echo.Target : ^<%USBDriveLetter%\Sources^>
echo.
call :RemoveFile %USBDriveLetter%\Sources\Boot.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.esd

%XCopy% "%DVD%\Sources\boot.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.wim" %XCopy% "%DVD%\Sources\install.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.esd" %XCopy% "%DVD%\Sources\install.esd" %USBDriveLetter%\Sources
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Syncing Source Boot ^& Install Images to USB Flash Drive###########
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Burn a ISO Image to USB Flash Drive
::-------------------------------------------------------------------------------------------
:BurnUSB

setlocal

set ISOFileName=
set USBDriveLetter=

cls
echo.===============================================================================
echo.                MSMG ToolKit - Burn a ISO Image to USB Flash Drive
echo.===============================================================================
echo.

:: Checking whether ISO folder is empty
if not exist "%ISO%\*.iso" (
	echo.ISO Image folder ^<ISO^> is empty...
	echo.
	echo.Please copy ISO Images to ^<ISO^> folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Burning a ISO Image to USB Flash Drive############################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting ISO Image Options##################################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting ISO File Name
set /p ISOFileName=Enter the ISO File Name : 

:: Setting ISO File Name
set "ISOFileName=%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting USB Flash Drive Options############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.Listing Available USB Flash Drives...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=Enter USB Flash Drive Letter : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"

echo.
echo.-------------------------------------------------------------------------------
echo.####Burning ISO Image to USB Flash Drive#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Copying ISO Image file Contents to USB Flash Drive, Please Wait...
echo.-------------------------------------------------------------------------------
echo.
echo.Source ISO        : %ISOFileName%
echo.Target Drive      : %USBDriveLetter%
echo.
"%Zip%" x -y "%ISO%\%ISOFileName%" -o"%USBDriveLetter%"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Burning a ISO Image to USB Flash Drive############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set ISOFileName=
set USBDriveLetter=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Format a USB Flash Drive
::-------------------------------------------------------------------------------------------
:FormatUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - Format USB Flash Drive
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####Starting Formatting USB Flash Drive########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####Getting USB Flash Drive Options############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.Listing Available USB Flash Drives...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=Enter USB Flash Drive Letter : 
echo.

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"

:: Checking whether the Specified USB Flash Drive exist
cd /d %USBDriveLetter% 2>nul
if errorlevel 1 (
	echo.Invalid USB Flash Drive specified, please try again...
	goto :Stop
)

:: Getting USB Flash Drive Volume Label.
set /p USBDriveLabel=Enter USB Flash Drive Volume Label : 
echo.

:: Getting USB Boot Type (UEFI/BIOS/ALL).
choice /C:12 /N /M "Enter USB Flash Drive Boot Type [1=BIOS,2=BIOS/UEFI] : "
if errorlevel 2 goto :BIOS_UEFI
if errorlevel 1 goto :BIOS

:: Formatting USB Flash Drive in NTFS Format for BIOS Booting Systems.
:BIOS
	echo.
	choice /C:YN /N /M "Are you sure, you want to Format [%USBDriveLetter%]? ['Y'es/'N'o] : "
	if errorlevel 2 (
		echo.
		echo.Formatting USB Flash Drive [%USBDriveLetter%] cancelled...
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Stopped Formatting USB Flash Drive########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)
	if errorlevel 1 (
		call :FormatDisk %USBDriveLetter%, NTFS, %USBDriveLabel%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Finished Formatting USB Flash Drive########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)

:: Formatting USB Flash Drive in FAT32 Format for BIOS and or UEFI Booting Systems.
:BIOS_UEFI
	echo.
	choice /C:YN /N /M "Are you sure, you want to Format [%USBDriveLetter%]? ['Y'es/'N'o] : "
	if errorlevel 2 (
		echo.
		echo.Formatting USB Flash Drive [%USBDriveLetter%] cancelled...
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Stopped Formatting USB Flash Drive########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)
	if errorlevel 1 (
		call :FormatDisk %USBDriveLetter%, FAT32, %USBDriveLabel%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Finished Formatting USB Flash Drive########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to List All the Disks and Volumes
::-------------------------------------------------------------------------------------------
:ListDisks

set "DiskTemp=C:"
call :RemoveFile "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList1.txt"

echo.list volume>> "%DiskTemp%\DiskList.txt"
diskpart /s "%DiskTemp%\DiskList.txt" >> "%DiskTemp%\DiskList1.txt"
call :RemoveFile "%DiskTemp%\DiskList.txt"
echo.>> "%DiskTemp%\DiskList.txt"

echo.===============================================================================>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "en-US" echo.  Volume #  Letter Label      file Sys Type         Size    Status     Info>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "fr-FR" echo.  N# volume   Ltr  Nom          Fs     Type        Taille   Statut     Info>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "zh-CN" echo.  卷 #      盘符   标签       文件系统  类型        大小    状态       信息>> "%DiskTemp%\DiskList.txt"
echo.------------------------------------------------------------------------------->> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "en-US" findstr "Removable" "%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "fr-FR" findstr "Amovible" "%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "zh-CN" findstr "可移动" "%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
echo.===============================================================================>> "%DiskTemp%\DiskList.txt"

type "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList1.txt"
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Format a Disk/Volume
:: Input Parameters [ %~1 : USB Drive Letter, %~2 : Format Type, %~3 : Drive Label]
::-------------------------------------------------------------------------------------------
:FormatDisk

set "DiskTemp=C:"

:: Writing DiskPart.txt Script File.
call :RemoveFile "%DiskTemp%\DiskPart.txt"
echo.select volume ^%~1>> "%DiskTemp%\DiskPart.txt"
echo.clean>> "%DiskTemp%\DiskPart.txt"
echo.create partition primary>> "%DiskTemp%\DiskPart.txt"
echo.select partition ^1>> "%DiskTemp%\DiskPart.txt"
echo.active>> "%DiskTemp%\DiskPart.txt"
echo.format fs=%~2 quick label=%~3>> "%DiskTemp%\DiskPart.txt"
echo.exit>> "%DiskTemp%\DiskPart.txt"
echo.exit>> "%DiskTemp%\DiskPart.txt"
echo.
echo.-------------------------------------------------------------------------------
echo.####Formatting USB Flash Drive#################################################
echo.-------------------------------------------------------------------------------
echo.
:: Executing DiskPart.txt Script file With Diskpart.
echo.Formatting USB Flash Drive [%~1] in %~2 Format, Please wait...
start /B /wait diskpart /s "%DiskTemp%\DiskPart.txt" >nul
echo.
echo.Formatting USB Flash Drive [%~1] in %~2 Format, complete...
call :RemoveFile "%DiskTemp%\DiskPart.txt"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - WIM Manager
::-------------------------------------------------------------------------------------------
:WIMManager

cls
echo.===============================================================================
echo.                          MSMG ToolKit - WIM Manager
echo.===============================================================================
echo.

:: Checking whether Source is Applied.
if "%IsSourceSelected%" equ "Yes" (
	echo.Can't use this feature when the Source OS is selected...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :ToolsMenu
)

echo.  [A]   Display
echo.  [B]   Rename
echo.  [C]   Delete
echo.  [D]   Export
echo.  [E]   Convert
echo.  [F]   Split
echo.  [G]   Merge
echo.  [H]   Upgrade
echo.  [I]   Capture
echo.  [J]   Apply
echo.  [K]   Cleanup
echo.  [L]   Optimize
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:ABCDEFGHIJKLX /N /M "Enter Your Choice : "
if errorlevel 13 goto :ToolsMenu
if errorlevel 12 goto :WIMOptimize
if errorlevel 11 goto :WIMCleanUp
if errorlevel 10 goto :WIMApply
if errorlevel 9  goto :WIMCapture
if errorlevel 8  goto :WIMUpgrade
if errorlevel 7  goto :WIMMerge
if errorlevel 6  goto :WIMSplit
if errorlevel 5  goto :WIMConvert
if errorlevel 4  goto :WIMExport
if errorlevel 3  goto :WIMDelete
if errorlevel 2  goto :WIMRename
if errorlevel 1  goto :WIMDisplay

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Display WIM Image Information
::-------------------------------------------------------------------------------------------
:WIMDisplay

cls
echo.===============================================================================
echo.               MSMG ToolKit - Display WIM Image Information
echo.===============================================================================

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup "Install.wim" Image to respective folder...
	echo.
	echo.===============================================================================
	echo.
	goto :Stop
)

:: Display Image Index Information
call :ShowImageInfo

:Stop
pause>nul|set /p=Press any key to continue...

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Rename WIM Index
::-------------------------------------------------------------------------------------------
:WIMRename

setlocal

set NewImageName=
set NewImageDescription=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Rename WIM Image Index
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Renaming Source WIM Image Index###################################
echo.-------------------------------------------------------------------------------

:: Display Image Index Information
call :ShowImageInfo

:: Getting Image Index No to Rename
set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered...
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMRename
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

echo.
set /p NewImageName=Enter WIM Index Name : 
echo.
set /p NewImageDescription=Enter WIM Index Description : 

echo.
echo.-------------------------------------------------------------------------------
echo.Renaming Source WIM Image [Install.wim, Index : %ImageIndexNo%] Information...
echo.-------------------------------------------------------------------------------
echo.
"%WimlibImagex%" info "%InstallWim%" %ImageIndexNo% "%NewImageName%" "%NewImageDescription%" --image-property DISPLAYNAME="%NewImageName%" --image-property DISPLAYDESCRIPTION="%NewImageDescription%"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Renaming Source WIM Image Index###################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set NewImageName=
set NewImageDescription=
set ImageIndexNo=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Delete WIM Index
::-------------------------------------------------------------------------------------------
:WIMDelete

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Delete WIM Index
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

:: Finding total no of indexes present inside the Image
call :GetImageCount "%InstallWim%"

if %ImageCount% equ 1 (
	echo.Cannot delete the lone image index...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Deleting Source WIM Image Index###################################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
set /p ImageIndexNo=Enter the WIM Image Index's # ['Q'uit] : 
echo.

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.Invalid Index # Entered, Valid Range is [1,...%ImageCount%, 'Q'uit]
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMDelete
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

echo.-------------------------------------------------------------------------------
echo.Deleting Source WIM Image [Install.wim, Index : %ImageIndexNo%]...
echo.-------------------------------------------------------------------------------
call :DeleteImage "%InstallWim%", %ImageIndexNo%
echo.-------------------------------------------------------------------------------
echo.####Finished Deleting Source WIM Image Index###################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Export WIM Index to Source WIM Image or New WIM Image
::-------------------------------------------------------------------------------------------
:WIMExport

setlocal

set WimImageFileName=
set Export2NewImage=

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Export WIM Index
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Exporting Source WIM Image Index##################################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 
) else set /p ImageIndexNo=Enter the WIM Image Index's # [Range : 1,...%ImageCount%, 'A'll, 'Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered, Valid Range is [1,...%ImageCount%, 'A'll, 'Q'uit]
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMExport
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
	for /l %%i in (2, 1, %ImageCount%) do (
		set "ImageIndexNo=!ImageIndexNo!,%%i"
	)
)

if /i "%ImageIndexNo%" equ "Q" (
   set ImageIndexNo=
   goto :WIMManager
)

echo.
choice /C:YN /N /M "Do you want to Export to New WIM Image ? ['Y'es/'N'o] : "
if errorlevel 2 set "Export2NewImage=No"
if errorlevel 1 set "Export2NewImage=Yes"

if "%Export2NewImage%" equ "Yes" (
	echo.
	set /p WimImageFileName=Enter WIM Image Filename without [.wim] : 
	set "WimImageFileName=!WimImageFileName!.wim"
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Exporting Source WIM Image Index###########################################
echo.-------------------------------------------------------------------------------
echo.
for %%i in (%ImageIndexNo%) do (
	echo.-------------------------------------------------------------------------------
	if "!Export2NewImage!" equ "Yes" echo.Exporting Source WIM Image [Install.wim, Index : %%i] to [%WimImageFileName%]... 
	if "!Export2NewImage!" equ "No" echo.Exporting Source WIM Image [Install.wim, Index : %%i] to [Install.wim]...
	echo.-------------------------------------------------------------------------------
	if "!Export2NewImage!" equ "Yes" (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%DVD%\sources\%WimImageFileName%", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%DVD%\sources\%WimImageFileName%" --compress=LZX
		echo.
	)
	if "!Export2NewImage!" equ "No" (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%InstallWim%", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%InstallWim%" --compress=LZX
		echo.
	)
)
echo.-------------------------------------------------------------------------------
echo.####Finished Exporting Source WIM Image Index##################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WimImageFileName=
set Export2NewImage=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Convert WIM Image to ESD Image
::-------------------------------------------------------------------------------------------
:WIMConvert

cls
echo.===============================================================================
echo.               MSMG ToolKit - Convert WIM Image to ESD Image
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Converting WIM Image to ESD Image#################################
echo.-------------------------------------------------------------------------------

:: Getting Image Index Number to Service
call :GetImageIndexNo "%InstallWim%"

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered, Valid Range is [1,...%ImageCount%, 'A'll, 'Q'uit]
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMConvert
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
	for /l %%i in (2, 1, %ImageCount%) do (
		set "ImageIndexNo=!ImageIndexNo!,%%i"
	)
)

if /i "%ImageIndexNo%" equ "Q" (
   set ImageIndexNo=
   goto :WIMManager
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Converting WIM Image to ESD Image##########################################
echo.-------------------------------------------------------------------------------

:: Exporting Source Image to ESD Image
for %%i in (%ImageIndexNo%) do (
	rem call :ExportImageIndex "%InstallWim%", %%i, "%InstallEsd%", "ESD", "No"
	echo.
	"%WimlibImagex%" export "%InstallWim%" %%i "%InstallEsd%" --compress=LZMS --solid
	echo.
)

:: Deleting Source Image File
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####Finished Converting WIM Image to ESD Image#################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Split WIM Image
::-------------------------------------------------------------------------------------------
:WIMSplit

setlocal

set WimImageSplitFileSize=

cls
echo.===============================================================================
echo.                      MSMG ToolKit - Split WIM Image
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Spliting Source WIM Image#########################################
echo.-------------------------------------------------------------------------------
echo.
set /p WimImageSplitFileSize=Enter WIM Image Split File Size in MB : 
echo.
echo.-------------------------------------------------------------------------------
echo.Spliting Source WIM Image [Install.wim]...
echo.-------------------------------------------------------------------------------

call :SplitImage "%InstallWim%", "%DVD%\sources\install.swm", %WimImageSplitFileSize%
if exist "%DVD%\Sources\*.swm" call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####Finished Spliting Source WIM Image#########################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set WimImageSplitFileSize=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Merge Splitted WIM Image
::-------------------------------------------------------------------------------------------
:WIMMerge

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Merge Splitted WIM Image
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Merging Splitted Source WIM Image#################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Merging Splitted Source WIM Image [Install.swm] to [Install.wim]...
echo.-------------------------------------------------------------------------------

call :MergeImage "%DVD%\sources\install", "%InstallWim%"
if exist "%InstallWim%" call :RemoveFile "%DVD%\sources\*.swm"

echo.-------------------------------------------------------------------------------
echo.####Finished Merging Splitted Source WIM Image#################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Upgrade WIM Index Edition
::-------------------------------------------------------------------------------------------
:WIMUpgrade

setlocal

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - Upgrade WIM Edition
echo.===============================================================================

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Upgrade
set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered...
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMUpgrade
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: Getting selected Image Index Information
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: Setting selected Source OS version
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"
if "%ImageVersion:~0,-6%" equ "10.0" (
	if "%ImageBuild%" leq "20348" (
		set "SelectedSourceOS=w10"
		set "OSID=10"
	)
	if "%ImageBuild%" geq "22000" (
		set "SelectedSourceOS=w11"
		set "OSID=11"
	)
)

if "%ImageVersion:~0,-6%" equ "11.0" (
   set "SelectedSourceOS=w11"
   set "OSID=11"
)

echo.

:: Checking whether the selected Source OS is a Windows 7 Enterprise Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 7 Enterprise Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise N Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 7 Enterprise N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise K Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseK" (
	echo.Windows 7 Enterprise K Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise KN Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseKN" (
	echo.Windows 7 Enterprise KN Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Ultimate" (
	echo.Windows 7 Ultimate Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate N Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateN" (
	echo.Windows 7 Ultimate N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate K Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateK" (
	echo.Windows 7 Ultimate K Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate KN Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateKN" (
	echo.Windows 7 Ultimate KN Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Pro with Media Center Edition
if "%ImageFlag%" equ "ProfessionalWMC" (
	echo.Windows 8.1 Pro with Media Center Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Pro N Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 8.1 Pro N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 8.1 Enterprise Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Enterprise N Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 8.1 Enterprise N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Embedded Industry Pro/Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustry" (
	echo.Windows Embedded 8.1 Industry Pro Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Embedded Industry Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustryE" (
	echo.Windows Embedded 8.1 Industry Enterprise Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Datacenter Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenterCore" (
	echo.Windows Server 2012 R2 Datacenter Core Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Datacenter Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenter" (
	echo.Windows Server 2012 R2 Datacenter Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Foundation Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerWinFoundation" (
	echo.Windows Server 2012 R2 Foundation Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Storage Server 2012 R2 Standard Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2012 R2 Standard Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Storage Server 2012 R2 Workgroup Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2012 R2 Workgroup Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 10 Enterprise Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 10 Enterprise N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 S Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "Cloud" (
	echo.Windows 10 S Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 S N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "CloudN" (
	echo.Windows 10 S N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Professional Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "Professional" (
	echo.Windows 10 Professional Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Professional N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 10 Professional N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 Enterprise G Edition
if "%ImageFlag%" equ "EnterpriseG" (
	echo.Windows %OSID% Enterprise G Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 Enterprise GN Edition
if "%ImageFlag%" equ "EnterpriseGN" (
	echo.Windows %OSID% Enterprise GN Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise LTSB Edition
if "%ImageFlag%" equ "EnterpriseS" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 Enterprise 2015 LTSB Edition can't be Upgraded...
	if "%ImageBuild%" equ "14393" echo.Windows 10 Enterprise 2016 LTSB Edition can't be Upgraded...
	if "%ImageBuild%" equ "17763" echo.Windows 10 Enterprise 2019 LTSC Edition can't be Upgraded...
	if "%ImageBuild%" equ "19044" echo.Windows 10 Enterprise 2021 LTSC Edition can't be Upgraded...
	if "%ImageBuild%" equ "19045" echo.Windows 10 Enterprise 2021 LTSC Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N LTSB Edition
if "%ImageFlag%" equ "EnterpriseSN" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 Enterprise N 2015 LTSB Edition can't be Upgraded...
	if "%ImageBuild%" equ "14393" echo.Windows 10 Enterprise N 2016 LTSB Edition can't be Upgraded...
	if "%ImageBuild%" equ "17763" echo.Windows 10 Enterprise N 2019 LTSC Edition can't be Upgraded...
	if "%ImageBuild%" equ "19044" echo.Windows 10 Enterprise N 2021 LTSC Edition can't be Upgraded...
	if "%ImageBuild%" equ "19045" echo.Windows 10 Enterprise N 2021 LTSC Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 IoT Enterprise Edition
if "%ImageFlag%" equ "IoTEnterprise" (
	echo.Windows %OSID% IoT Enterprise Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 IoT Enterprise N Edition
if "%ImageFlag%" equ "IoTEnterpriseN" (
	echo.Windows %OSID% IoT Enterprise N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 Education Edition
if "%ImageFlag%" equ "Education" (
	echo.Windows %OSID% Education Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 Education N Edition
if "%ImageFlag%" equ "EducationN" (
	echo.Windows %OSID% Education N Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10/11 Enterprise for Virtual Desktops Edition
if "%ImageFlag%" equ "ServerRdsh" (
	echo.Windows %OSID% Enterprise Multi-Sessions Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Hyper Server 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerHyper" (
	echo.Windows Hyper-V Server 2016 Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2016 Azure Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerAzureCor" (
	echo.Windows Server 2016 Azure Core Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2016 Datacenter Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerDatacenter" (
	echo.Windows Server 2016 Datacenter Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Storage Server 2016 Standard Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2016 Standard Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Storage Server 2016 Workgroup Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2016 Workgroup Edition can't be Upgraded...
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMManager
)

set SourceEdition=%ImageFlag%

echo.-------------------------------------------------------------------------------
echo.####Starting Upgrading WIM Image Edition#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Mounting [Install.wim, Index : %ImageIndexNo%] Image at ^<\Mount\Install^>...
echo.-------------------------------------------------------------------------------
call :MountImage "%InstallWim%", %ImageIndexNo%, "%InstallMount%"
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Getting Target Editions...
echo.-------------------------------------------------------------------------------
echo.
for /f "tokens=2 delims=:" %%a in ('%DISM% /Image:"%InstallMount%" /Get-TargetEditions ^| find "Target Edition"') do (echo. %%a)
echo.
:: Get Target Edition
set /p TargetEdition=Enter Target Edition : 
echo.

:: Checking whether the Selected Source OS is a Windows 8.1 Pro Retail Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageEdition%" equ "Professional" if "%TargetEdition%" equ "ProfessionalWMC" (
	echo.Checking Whether Source Image is Windows 8.1 Pro Edition or Not...
	echo.
	%DISM% /Format:Table /Image:"%InstallMount%" /Get-Packages | findstr /c:"GVLK-Package" >nul
	if not errorlevel 1 (
		echo.Selected Source is Not a Windows 8.1 Pro Retail Edition..
		echo.
		echo.Please Use Windows 8.1 Pro Retail Edition Operating System as Source...
		goto :Stop
	)
)
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 7 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2008 R2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 8.1 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Embedded" echo.Upgrading Windows 8.1 Embedded %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2012 R2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 10 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w11" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 11 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2016 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1709 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1803 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1809 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2019 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1903 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18363" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1909 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19041" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v2004 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19042" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v20H2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19043" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v21H1 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19044" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v21H2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19045" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v22H2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "20348" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2022 %SourceEdition% to %TargetEdition%...

echo.-------------------------------------------------------------------------------
%DISM% /Image:"%InstallMount%" /Set-Edition:%TargetEdition%
echo.
echo.-------------------------------------------------------------------------------
echo.Un-Mounting [Install.wim, Index : %ImageIndexNo%] Image...
echo.-------------------------------------------------------------------------------
call :UnMountImage "%InstallMount%", "Commit"
echo.-------------------------------------------------------------------------------
echo.####Applying Target WIM Image Edition Properties###############################
echo.-------------------------------------------------------------------------------
echo.
if "%SelectedSourceOS%" equ "w7"  (
	if "%TargetEdition%" equ "HomeBasic" (
		set "Flag=HomeBasic"
		set "Edition=HomeBasic"
		set "Name=Windows 7 HOMEBASIC"
		set "Description=Windows 7 HOMEBASIC"
		set "DisplayName=Windows 7 Home Basic"
		set "DisplayDescription=Windows 7 Home Basic"
	)

	if "%TargetEdition%" equ "HomePremium" (
		set "Flag=HomePremium"
		set "Edition=HomePremium"
		set "Name=Windows 7 HOMEPREMIUM"
		set "Description=Windows 7 HOMEPREMIUM"
		set "DisplayName=Windows 7 Home Premium"
		set "DisplayDescription=Windows 7 Home Premium"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows 7 PROFESSIONAL"
		set "Description=Windows 7 PROFESSIONAL"
		set "DisplayName=Windows 7 Professional"
		set "DisplayDescription=Windows 7 Professional"
	)

	if "%TargetEdition%" equ "Ultimate" (
		set "Flag=Ultimate"
		set "Edition=Ultimate"
		set "Name=Windows 7 ULTIMATE"
		set "Description=Windows 7 ULTIMATE"
		set "DisplayName=Windows 7 Ultimate"
		set "DisplayDescription=Windows 7 Ultimate"
	)

	if "%TargetEdition%" equ "HomeBasicN" (
		set "Flag=HomeBasicN"
		set "Edition=HomeBasicN"
		set "Name=Windows 7 HOMEBASICN"
		set "Description=Windows 7 HOMEBASICN"
		set "DisplayName=Windows 7 Home Basic N"
		set "DisplayDescription=Windows 7 Home Basic N"
	)

	if "%TargetEdition%" equ "HomePremiumN" (
		set "Flag=HomePremiumN"
		set "Edition=HomePremiumN"
		set "Name=Windows 7 HOMEPREMIUMN"
		set "Description=Windows 7 HOMEPREMIUMN"
		set "DisplayName=Windows 7 Home Premium N"
		set "DisplayDescription=Windows 7 Home Premium N"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows 7 PROFESSIONALN"
		set "Description=Windows 7 PROFESSIONALN"
		set "DisplayName=Windows 7 Professional N"
		set "DisplayDescription=Windows 7 Professional N"
	)

	if "%TargetEdition%" equ "UltimateN" (
		set "Flag=UltimateN"
		set "Edition=UltimateN"
		set "Name=Windows 7 ULTIMATEN"
		set "Description=Windows 7 ULTIMATEN"
		set "DisplayName=Windows 7 Ultimate N"
		set "DisplayDescription=Windows 7 Ultimate N"
	)

	if "%TargetEdition%" equ "HomeBasicK" (
		set "Flag=HomeBasicK"
		set "Edition=HomeBasicK"
		set "Name=Windows 7 HOMEBASICK"
		set "Description=Windows 7 HOMEBASICK"
		set "DisplayName=Windows 7 Home Basic K"
		set "DisplayDescription=Windows 7 Home Basic K"
	)

	if "%TargetEdition%" equ "HomePremiumK" (
		set "Flag=HomePremiumK"
		set "Edition=HomePremiumK"
		set "Name=Windows 7 HOMEPREMIUMK"
		set "Description=Windows 7 HOMEPREMIUMK"
		set "DisplayName=Windows 7 Home Premium K"
		set "DisplayDescription=Windows 7 Home Premium K"
	)

	if "%TargetEdition%" equ "ProfessionalK" (
		set "Flag=ProfessionalK"
		set "Edition=ProfessionalK"
		set "Name=Windows 7 PROFESSIONALK"
		set "Description=Windows 7 PROFESSIONALK"
		set "DisplayName=Windows 7 Professional K"
		set "DisplayDescription=Windows 7 Professional K"
	)

	if "%TargetEdition%" equ "UltimateK" (
		set "Flag=UltimateK"
		set "Edition=UltimateK"
		set "Name=Windows 7 ULTIMATEK"
		set "Description=Windows 7 ULTIMATEK"
		set "DisplayName=Windows 7 Ultimate K"
		set "DisplayDescription=Windows 7 Ultimate K"
	)

	if "%TargetEdition%" equ "HomeBasicKN" (
		set "Flag=HomeBasicKN"
		set "Edition=HomeBasicKN"
		set "Name=Windows 7 HOMEBASICKN"
		set "Description=Windows 7 HOMEBASICKN"
		set "DisplayName=Windows 7 Home Basic KN"
		set "DisplayDescription=Windows 7 Home Basic KN"
	)

	if "%TargetEdition%" equ "HomePremiumKN" (
		set "Flag=HomePremiumKN"
		set "Edition=HomePremiumKN"
		set "Name=Windows 7 HOMEPREMIUMKN"
		set "Description=Windows 7 HOMEPREMIUMKN"
		set "DisplayName=Windows 7 Home Premium KN"
		set "DisplayDescription=Windows 7 Home Premium KN"
	)

	if "%TargetEdition%" equ "ProfessionalKN" (
		set "Flag=ProfessionalKN"
		set "Edition=ProfessionalKN"
		set "Name=Windows 7 PROFESSIONALKN"
		set "Description=Windows 7 PROFESSIONALKN"
		set "DisplayName=Windows 7 Professional KN"
		set "DisplayDescription=Windows 7 Professional KN"
	)

	if "%TargetEdition%" equ "UltimateKN" (
		set "Flag=UltimateKN"
		set "Edition=UltimateKN"
		set "Name=Windows 7 ULTIMATEKN"
		set "Description=Windows 7 ULTIMATEKN"
		set "DisplayName=Windows 7 Ultimate KN"
		set "DisplayDescription=Windows 7 Ultimate KN"
	)

	if "%TargetEdition%" equ "ServerStandardCore" (
		set "Flag=ServerStandardCore"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2008 R2 SERVERSTANDARDCORE"
		set "Description=Windows Server 2008 R2 SERVERSTANDARDCORE"
		set "DisplayName=Windows Server 2008 R2 Standard (Server Core Installation)"
		set "DisplayDescription=This option installs a minimal installation of Windows Server without the standard Windows user interface, and with a subset of server roles that can be managed from a command prompt, reducing management requirements and attack surface."
	)

	if "%TargetEdition%" equ "ServerEnterpriseCore" (
		set "Flag=ServerEnterpriseCore"
		set "Edition=ServerEnterprise"
		set "Name=Windows Server 2008 R2 SERVERENTERPRISECORE"
		set "Description=Windows Server 2008 R2 SERVERENTERPRISECORE"
		set "DisplayName=Windows Server 2008 R2 Enterprise (Server Core Installation)"
		set "DisplayDescription=This option installs a minimal installation of Windows Server without the standard Windows user interface, and with a subset of server roles that can be managed from a command prompt, reducing management requirements and attack surface."
	)

	if "%TargetEdition%" equ "ServerDatacenterCore" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2008 R2 SERVERDATACENTERCORE"
		set "Description=Windows Server 2008 R2 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2008 R2 Datacenter (Server Core Installation)"
		set "DisplayDescription=This option installs a minimal installation of Windows Server without the standard Windows user interface, and with a subset of server roles that can be managed from a command prompt, reducing management requirements and attack surface."
	)

	if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2008 R2 SERVERSTANDARD"
		set "Description=Windows Server 2008 R2 SERVERSTANDARD"
		set "DisplayName=Windows Server 2008 R2 Standard (Full Installation)"
		set "DisplayDescription=This option installs the complete installation of Windows Server. This installation includes the entire user interface, and it supports all of the server roles."
	)

	if "%TargetEdition%" equ "ServerEnterprise" (
		set "Flag=ServerEnterprise"
		set "Edition=ServerEnterprise"
		set "Name=Windows Server 2008 R2 SERVERENTERPRISE"
		set "Description=Windows Server 2008 R2 SERVERENTERPRISE"
		set "DisplayName=Windows Server 2008 R2 Enterprise (Full Installation)"
		set "DisplayDescription=This option installs the complete installation of Windows Server. This installation includes the entire user interface, and it supports all of the server roles."
	)

	if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2008 R2 SERVERDATACENTER"
		set "Description=Windows Server 2008 R2 SERVERDATACENTER"
		set "DisplayName=Windows Server 2008 R2 Datacenter (Full Installation)"
		set "DisplayDescription=This option installs the complete installation of Windows Server. This installation includes the entire user interface, and it supports all of the server roles."
	)
)

if "%SelectedSourceOS%" equ "w81" (
	if "%TargetEdition%" equ "Core" (
		set "Flag=Core"
		set "Edition=Core"
		set "Name=Windows 8.1 Core"
		set "Description=Windows 8.1 Core"
		set "DisplayName=Windows 8.1 Core"
		set "DisplayDescription=Windows 8.1 Core"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows 8.1 Pro"
		set "Description=Windows 8.1 Pro"
		set "DisplayName=Windows 8.1 Pro"
		set "DisplayDescription=Windows 8.1 Pro"
	)

	if "%TargetEdition%" equ "ProfessionalWMC" (
		set "Flag=ProfessionalWMC"
		set "Edition=ProfessionalWMC"
		set "Name=Windows 8.1 Pro WMC"
		set "Description=Windows 8.1 Pro WMC"
		set "DisplayName=Windows 8.1 Pro with Media Center"
		set "DisplayDescription=Windows 8.1 Pro with Media Center"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows 8.1 Pro N"
		set "Description=Windows 8.1 Pro N"
		set "DisplayName=Windows 8.1 Pro N"
		set "DisplayDescription=Windows 8.1 Pro N"
	)

	if "%TargetEdition%" equ "ServerDatacenterCore" (
		set "Flag=ServerDatacenterCore"
		set "Edition=ServerDatacenterCore"
		set "Name=Windows Server 2012 R2 Datacenter (Server Core Installation)"
		set "Description=This option (recommended) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
		set "DisplayName=Windows Server 2012 R2 Datacenter (Server Core Installation)"
		set "DisplayDescription=This option (recommended) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	)

	if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2012 R2 Standard (Server with a GUI)"
		set "Description=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
		set "DisplayName=Windows Server 2012 R2 Standard (Server with a GUI)"
		set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	)

	if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDatacenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2012 R2 Datacenter (Server with a GUI)"
		set "Description=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
		set "DisplayName=Windows Server 2012 R2 Datacenter (Server with a GUI)"
		set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	)
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	if "%TargetEdition%" equ "Core" (
		set "Flag=Core"
		set "Edition=Core"
		set "Name=Windows %OSID% Home"
		set "Description=Windows %OSID% Home"
		set "DisplayName=Windows %OSID% Home"
		set "DisplayDescription=Windows %OSID% Home"
	)

	if "%TargetEdition%" equ "CoreSingleLanguage" (
		set "Flag=CoreSingleLanguage"
		set "Edition=CoreSingleLanguage"
		set "Name=Windows %OSID% Home Single Language"
		set "Description=Windows %OSID% Home Single Language"
		set "DisplayName=Windows %OSID% Home Single Language"
		set "DisplayDescription=Windows %OSID% Home Single Language"
	)

	if "%TargetEdition%" equ "CoreCountrySpecific" (
		set "Flag=CoreCountrySpecific"
		set "Edition=CoreCountrySpecific"
		set "Name=Windows %OSID% Home China"
		set "Description=Windows %OSID% Home China"
		set "DisplayName=Windows %OSID% Home China"
		set "DisplayDescription=Windows %OSID% Home China"
	)

	if "%TargetEdition%" equ "CoreN" (
		set "Flag=CoreN"
		set "Edition=CoreN"
		set "Name=Windows %OSID% Home N"
		set "Description=Windows %OSID% Home N"
		set "DisplayName=Windows %OSID% Home N"
		set "DisplayDescription=Windows %OSID% Home N"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows %OSID% Pro"
		set "Description=Windows %OSID% Pro"
		set "DisplayName=Windows %OSID% Pro"
		set "DisplayDescription=Windows %OSID% Pro"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows %OSID% Pro N"
		set "Description=Windows %OSID% Pro N"
		set "DisplayName=Windows %OSID% Pro N"
		set "DisplayDescription=Windows %OSID% Pro N"
	)

	if "%TargetEdition%" equ "ProfessionalCountrySpecific" (
		set "Flag=ProfessionalCountrySpecific"
		set "Edition=ProfessionalCountrySpecific"
		set "Name=Windows %OSID% Pro China"
		set "Description=Windows %OSID% Pro China"
		set "DisplayName=Windows %OSID% Pro China"
		set "DisplayDescription=Windows %OSID% Pro China"
	)

	if "%TargetEdition%" equ "ProfessionalSingleLanguage" (
		set "Flag=ProfessionalSingleLanguage"
		set "Edition=ProfessionalSingleLanguage"
		set "Name=Windows %OSID% Pro Single Language"
		set "Description=Windows %OSID% Pro Single Language"
		set "DisplayName=Windows %OSID% Pro Single Language"
		set "DisplayDescription=Windows %OSID% Pro Single Language"
	)

	if "%TargetEdition%" equ "Education" (
		set "Flag=Education"
		set "Edition=Education"
		set "Name=Windows %OSID% Education"
		set "Description=Windows %OSID% Education"
		set "DisplayName=Windows %OSID% Education"
		set "DisplayDescription=Windows %OSID% Education"
	)

	if "%TargetEdition%" equ "EducationN" (
		set "Flag=EducationN"
		set "Edition=EducationN"
		set "Name=Windows %OSID% Education N"
		set "Description=Windows %OSID% Education N"
		set "DisplayName=Windows %OSID% Education N"
		set "DisplayDescription=Windows %OSID% Education N"
	)

	if "%TargetEdition%" equ "Enterprise" (
		set "Flag=Enterprise"
		set "Edition=Enterprise"
		set "Name=Windows %OSID% Enterprise"
		set "Description=Windows %OSID% Enterprise"
		set "DisplayName=Windows %OSID% Enterprise"
		set "DisplayDescription=Windows %OSID% Enterprise"
	)

	if "%TargetEdition%" equ "EnterpriseN" (
		set "Flag=EnterpriseN"
		set "Edition=EnterpriseN"
		set "Name=Windows %OSID% Enterprise N"
		set "Description=Windows %OSID% Enterprise N"
		set "DisplayName=Windows %OSID% Enterprise N"
		set "DisplayDescription=Windows %OSID% Enterprise N"
	)

	if "%TargetEdition%" equ "EnterpriseG" (
		set "Flag=EnterpriseG"
		set "Edition=EnterpriseG"
		set "Name=Windows %OSID% Enterprise G"
		set "Description=Windows %OSID% Enterprise G"
		set "DisplayName=Windows %OSID% Enterprise G"
		set "DisplayDescription=Windows %OSID% Enterprise G"
	)

	if "%TargetEdition%" equ "EnterpriseGN" (
		set "Flag=EnterpriseGN"
		set "Edition=EnterpriseGN"
		set "Name=Windows %OSID% Enterprise GN"
		set "Description=Windows %OSID% Enterprise GN"
		set "DisplayName=Windows %OSID% Enterprise GN"
		set "DisplayDescription=Windows %OSID% Enterprise GN"
	)

	if "%TargetEdition%" equ "ProfessionalEducation" (
		set "Flag=ProfessionalEducation"
		set "Edition=ProfessionalEducation"
		set "Name=Windows %OSID% Pro Education"
		set "Description=Windows %OSID% Pro Education"
		set "DisplayName=Windows %OSID% Pro Education"
		set "DisplayDescription=Windows %OSID% Pro Education"
	)

	if "%TargetEdition%" equ "ProfessionalEducationN" (
		set "Flag=ProfessionalEducationN"
		set "Edition=ProfessionalEducationN"
		set "Name=Windows %OSID% Pro EducationN"
		set "Description=Windows %OSID% Pro Education N"
		set "DisplayName=Windows %OSID% Pro Education N"
		set "DisplayDescription=Windows %OSID% Pro Education N"
	)

	if "%TargetEdition%" equ "ProfessionalWorkstation" (
		set "Flag=ProfessionalWorkstation"
		set "Edition=ProfessionalWorkstation"
		set "Name=Windows %OSID% Pro for Workstations"
		set "Description=Windows %OSID% Pro for Workstations"
		set "DisplayName=Windows %OSID% Pro for Workstations"
		set "DisplayDescription=Windows %OSID% Pro for Workstations"
	)

	if "%TargetEdition%" equ "ProfessionalWorkstationN" (
		set "Flag=ProfessionalWorkstationN"
		set "Edition=ProfessionalWorkstationN"
		set "Name=Windows %OSID% Pro N for Workstations"
		set "Description=Windows %OSID% Pro N for Workstations"
		set "DisplayName=Windows %OSID% Pro N for Workstations"
		set "DisplayDescription=Windows %OSID% Pro N for Workstations"
	)

	if "%TargetEdition%" equ "ServerRdsh" (
		set "Flag=ServerRdsh"
		set "Edition=ServerRdsh"
		set "Name=Windows %OSID% Enterprise for Remote Sessions"
		set "Description=Windows %OSID% Enterprise for Remote Sessions"
		set "DisplayName=Windows %OSID% Enterprise for Remote Sessions"
		set "DisplayDescription=Windows %OSID% Enterprise for Remote Sessions"
	)

	if "%TargetEdition%" equ "IoTEnterprise" (
		set "Flag=IoTEnterprise"
		set "Edition=IoTEnterprise"
		set "Name=Windows %OSID% IoT Enterprise"
		set "Description=Windows %OSID% IoT Enterprise"
		set "DisplayName=Windows %OSID% IoT Enterprise"
		set "DisplayDescription=Windows %OSID% IoT Enterprise"
	)

	if "%TargetEdition%" equ "IoTEnterpriseS" (
		set "Flag=IoTEnterpriseS"
		set "Edition=IoTEnterpriseS"
		set "Name=Windows %OSID% IoT Enterprise LTSC"
		set "Description=Windows %OSID% IoT Enterprise LTSC"
		set "DisplayName=Windows %OSID% IoT Enterprise LTSC"
		set "DisplayDescription=Windows %OSID% IoT Enterprise LTSC"
	)

	if "%TargetEdition%" equ "IoTEnterpriseN" (
		set "Flag=IoTEnterpriseN"
		set "Edition=IoTEnterpriseN"
		set "Name=Windows %OSID% IoT Enterprise N"
		set "Description=Windows %OSID% IoT Enterprise N"
		set "DisplayName=Windows %OSID% IoT Enterprise N"
		set "DisplayDescription=Windows %OSID% IoT Enterprise N"
	)

	if "%TargetEdition%" equ "IoTEnterpriseSN" (
		set "Flag=IoTEnterpriseSN"
		set "Edition=IoTEnterpriseSN"
		set "Name=Windows %OSID% IoT Enterprise N LTSC"
		set "Description=Windows %OSID% IoT Enterprise N LTSC"
		set "DisplayName=Windows %OSID% IoT Enterprise N LTSC"
		set "DisplayDescription=Windows %OSID% IoT Enterprise N LTSC"
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerAzureCor" (
		set "Flag=ServerAzureCor"
		set "Edition=ServerAzureCor"
		set "Name=Windows Server 2016 SERVERAZURECORE"
		set "Description=Windows Server 2016 SERVERAZURECORE"
		set "DisplayName=Windows Server 2016 Azure"
		set "DisplayDescription=This option (recommended) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. For more details see \"Windows Server Installation Options.\""
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2016 SERVERDATACENTERCORE"
		set "Description=Windows Server 2016 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2016 Datacenter"
		set "DisplayDescription=This option (recommended) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. For more details see \"Windows Server Installation Options.\""
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerSolution" if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2016 SERVERSTANDARD"
		set "Description=Windows Server 2016 SERVERSTANDARD"
		set "DisplayName=Windows Server 2016 Standard (Desktop Experience)"
		set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. For more details see \"Windows Server Installation Options.\""
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2016 SERVERDATACENTER"
		set "Description=Windows Server 2016 SERVERDATACENTER"
		set "DisplayName=Windows Server 2016 Datacenter (Desktop Experience)"
		set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. For more details see \"Windows Server Installation Options.\""
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandardACor" if "%TargetEdition%" equ "ServerDatacenterACor" (
		set "Flag=ServerDataCenterACor"
		set "Edition=ServerDatacenterACor"
		set "Name=Windows Server SERVERDATACENTERACORE"
		set "Description=Windows Server SERVERDATACENTERACORE"
		set "DisplayName=Windows Server Datacenter"
		set "DisplayDescription=(Recommended) This option omits most of the Windows graphical environment. Manage with a command prompt and PowerShell, or remotely with Windows Admin Center or other tools."
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDataCenter"
		set "Name=Windows Server 2019 SERVERDATACENTERCORE"
		set "Description=Windows Server 2019 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2019 Datacenter"
		set "DisplayDescription=(Recommended) This option omits most of the Windows graphical environment. Manage with a command prompt and PowerShell, or remotely with Windows Admin Center or other tools."
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDataCenter"
		set "Name=Windows Server 2019 SERVERDATACENTER"
		set "Description=Windows Server 2019 SERVERDATACENTER"
		set "DisplayName=Windows Server 2019 Datacenter (Desktop Experience)"
		set "DisplayDescription=This option installs the full Windows graphical environment, consuming extra drive space. It can be useful if you want to use the Windows desktop or have an app that requires it."
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server Core" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2022 SERVERDATACENTERCORE"
		set "Description=Windows Server 2022 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2022 Datacenter"
		set "DisplayDescription=(Recommended) This option omits most of the Windows graphical environment. Manage with a command prompt and PowerShell, or remotely with Windows Admin Center or other tools."
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandardEval" if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2022 SERVERSTANDARD"
		set "Description=Windows Server 2022 SERVERSTANDARD"
		set "DisplayName=Windows Server 2022 Standard (Desktop Experience)"
		set "DisplayDescription=This option installs the full Windows graphical environment, consuming extra drive space. It can be useful if you want to use the Windows desktop or have an app that requires it."
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDatacenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2022 SERVERDATACENTER"
		set "Description=Windows Server 2022 SERVERDATACENTER"
		set "DisplayName=Windows Server 2022 Datacenter (Desktop Experience)"
		set "DisplayDescription=This option installs the full Windows graphical environment, consuming extra drive space. It can be useful if you want to use the Windows desktop or have an app that requires it."
	)
)

:: Setting Image Flag, Name and Description to reflect Target Edition
echo.Setting Image [Display Name] to "%DisplayName%"...
echo.Setting Image [Display Description] to "%DisplayDescription%"...
echo.Setting Image [Flag] to "%Flag%"...
echo.Setting Image [Edition] to "%Edition%"...
echo.
"%WimlibImagex%" info "%InstallWim%" %ImageIndexNo% "%Name%" "%Description%" --image-property DISPLAYNAME="%DisplayName%" --image-property DISPLAYDESCRIPTION="%DisplayDescription%" --image-property FLAGS="%Flag%" >nul
echo.-------------------------------------------------------------------------------
echo.####Copying EI.CFG Config file to ^<DVD\sources^> Folder#########################
echo.-------------------------------------------------------------------------------
echo.
echo.Copying "%TargetEdition%" Edition EI.CFG file to ^<DVD\sources^> folder.
if exist "%DVD%\sources\EI.CFG" del /f /q "%DVD%\sources\EI.CFG" >nul
(
	echo.[EditionID]
	echo.%TargetEdition%
	echo.
	echo.[Channel]
	echo.Retail
	echo.
	echo.[VL]
	echo.0
)>"%DVD%\sources\EI.CFG"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Upgrading Source WIM Image Edition################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Capture a Drive or Folder to a WIM Image
::-------------------------------------------------------------------------------------------
:WIMCapture

setlocal

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

cls
echo.===============================================================================
echo.            MSMG ToolKit - Capture Drive or Folder to WIM Image
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####Starting Capturing Drive or Folder to WIM Image############################
echo.-------------------------------------------------------------------------------
echo.
:: Get Source Drive or folder path to be Captuerd to WIM Image
set /p SourceDriveFolder=Enter a Valid Source Drive or folder path : 
echo.
:: Get Target WIM Image File Name
set /p TargetWimImageFileName=Enter Target WIM Image Filename : 
echo.
:: Get Target WIM Image Name
set /p TargetWimImageName=Enter Target WIM Image Name : 
echo.
:: Get Target WIM Image Description
set /p TargetWimImageDescription=Enter Target WIM Image Description : 
echo.
:: Get Target WIM Image Editon Flag
set /p TargetWimImageEditionFlag=Enter Target WIM Image Edition : 
echo.
:: Get Bootable Flag Status
choice /C:YN /N /M "Make Target WIM Image Bootable ? ['Y'es/'N'o] : "
if errorlevel 2 set BootFlag=No
if not errorlevel 2 set BootFlag=Yes
echo.
echo.-------------------------------------------------------------------------------
echo.####Capturing Drive or Folder to WIM Image#####################################
echo.-------------------------------------------------------------------------------
call :CaptureImage "%DVD%\sources\%TargetWimImageFileName%", "%SourceDriveFolder%", %TargetWimImageName%, %TargetWimImageDescription%, %BootFlag%
echo.-------------------------------------------------------------------------------
echo.####Setting Target WIM Image Flag, Name ^& Description##########################
echo.-------------------------------------------------------------------------------
echo.
:: Setting WIM Image Flag, Name and Description to reflect Target Edition
echo.Setting WIM Image [Name] to "%TargetWimImageName%"...
echo.
echo.Setting WIM Image [Description] to "%TargetWimImageDescription%"...
echo.
echo.Setting WIM Image [Flag] to "%TargetWimImageEditionFlag%"...
%Imagex% /Flags "%TargetWimImageEditionFlag%" /Info "%DVD%\sources\%TargetWimImageFileName%" 1 %TargetWimImageName% %TargetWimImageDescription% >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Capturing Drive or Folder to WIM Image############################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply a WIM Image Index to a Drive or Folder
::-------------------------------------------------------------------------------------------
:WIMApply

setlocal

set TargetDriveFolder=

cls
echo.===============================================================================
echo.        MSMG ToolKit - Apply a WIM Image Index to a Drive or Folder
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Applying a WIM Image Index to a Drive or Folder###################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered...
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMApply
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: Get Target Drive or folder path to Apply the WIM Image Index
echo.
set /p TargetDriveFolder=Enter Target Drive or folder path : 
echo.
echo.-------------------------------------------------------------------------------
echo.####Applying a WIM Image Index to a Drive or Folder############################
echo.-------------------------------------------------------------------------------
echo.
call :ApplyImage "%InstallWim%", %ImageIndexNo%, %TargetDriveFolder%
echo.-------------------------------------------------------------------------------
echo.####Finished Applying a WIM Image Index to a Drive or Folder###################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set TargetDriveFolder=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Cleanup a WIM Image Index
::-------------------------------------------------------------------------------------------
:WIMCleanUp

setlocal

set CleanupOption=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Cleanup a WIM Image Index
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.  [1]  Cleanup Image
echo.
echo.  [2]  Cleanup Image with CheckHealth
echo.
echo.  [3]  Cleanup Image with ScanHealth
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "Enter Your Choice : "
if errorlevel 4 goto :ToolsMenu
if errorlevel 3 set "CleanupOption=ScanHealth"
if errorlevel 2 set "CleanupOption=CheckHealth"
if errorlevel 1 set "CleanupOption=CleanupImage"

cls
echo.===============================================================================
echo.                  MSMG ToolKit - Cleanup a WIM Image Index
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####Starting Source WIM Image Cleanup##########################################
if "%CleanupOption%" equ "CheckHealth" echo.####Starting Source WIM Image Cleanup with Check Health########################
if "%CleanupOption%" equ "ScanHealth" echo.####Starting Source WIM Image Cleanup with Scan Health#########################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Clean
set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.Invalid Index # Entered...
	echo.
	pause>nul|set /p=Press any key to continue...
	goto :WIMCleanUp
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: Getting Selected Image Index Information
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: Setting Selected Source OS
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"
if "%ImageVersion:~0,-6%" equ "10.0" (
	if "%ImageBuild%" leq "19045" set "SelectedSourceOS=w10"
	if "%ImageBuild%" geq "22000" set "SelectedSourceOS=w11"
)
if "%ImageVersion:~0,-6%" equ "11.0" set "SelectedSourceOS=w11"

echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####Source WIM Image Cleanup###################################################
if "%CleanupOption%" equ "CheckHealth" echo.####Source WIM Image Cleanup with Check Health#################################
if "%CleanupOption%" equ "ScanHealth" echo.####Source WIM Image Cleanup with Scan Health##################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.Mounting [Install.wim, Index : %ImageIndexNo%] WIM Image at ^<\Mount\Install^>...
echo.-------------------------------------------------------------------------------
call :MountImage "%InstallWim%", %ImageIndexNo%, "%InstallMount%"
echo.-------------------------------------------------------------------------------
echo.Performing [Install.wim, Index : %ImageIndexNo%] WIM Image CleanUp...
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" (
	if "%SelectedSourceOS%" equ "w7" call :CleanupImage "%InstallMount%", "SPSupersededHideSP"
	if "%SelectedSourceOS%" neq "w7" call :CleanupImage "%InstallMount%", "ComponentCleanupResetBase"
) else (
	call :CleanupImage "%InstallMount%", "%CleanupOption%"
)
echo.-------------------------------------------------------------------------------
echo.Applying Changes ^& Un-Mounting [Install.wim, Index : %ImageIndexNo%] WIM Image...
echo.-------------------------------------------------------------------------------
call :UnMountImage "%InstallMount%", "Commit"
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####Finished Source WIM Image Cleanup##########################################
if "%CleanupOption%" equ "CheckHealth" echo.####Finished Source WIM Image Cleanup with Check Health########################
if "%CleanupOption%" equ "ScanHealth" echo.####Finished Source WIM Image Cleanup with Scan Health#########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

set CleanupOption=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Optimize WIM Index to Source WIM Image
::-------------------------------------------------------------------------------------------
:WIMOptimize

cls
echo.===============================================================================
echo.                     MSMG ToolKit - Optimize WIM Image
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.Cannot find Windows Setup Install Image ^<DVD\Sources\install.wim^> file...
	echo.
	echo.Please copy Windows Setup Install Image file to respective folder...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Optimizing Source WIM Image#######################################
echo.-------------------------------------------------------------------------------
:: Display Image Information
call :ShowImageInfo
echo.-------------------------------------------------------------------------------
echo.####Optimizing Source WIM Image################################################
echo.-------------------------------------------------------------------------------
rem call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
echo.
"%WimlibImagex%" optimize "%InstallWim%"
echo.
echo.-------------------------------------------------------------------------------
echo.####Finished Optimizing Source WIM Image#######################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Show MSMG ToolKit Debug Information
::-------------------------------------------------------------------------------------------
:Debug

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Debug Information
echo.===============================================================================
echo.
echo. HostArchitecture=%HostArchitecture%
echo. SelectedSourceOS=%SelectedSourceOS%
echo. IsSourceSelected=%IsSourceSelected%
echo. IsDialogsEnabled=%IsDialogsEnabled%
echo. IsLogsEnabled=%IsLogsEnabled%
echo.
echo.
echo.
echo. ImageIndexNo=%ImageIndexNo%
echo. ImageArchitecture=%ImageArchitecture%
echo. ImageBuild=%ImageBuild%
echo. ImageVersion=%ImageVersion%
echo. ImageServicePackBuild=%ImageServicePackBuild%
echo. ImageServicePackLevel=%ImageServicePackLevel%
echo. ImageDefaultLanguage=%ImageDefaultLanguage%
echo. ImageCount=%ImageCount%
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Returning to Tools Menu
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Options Menu
::-------------------------------------------------------------------------------------------
:Options

cls
echo.===============================================================================
echo.                          MSMG ToolKit - Options Menu
echo.===============================================================================
echo.
echo.  [1]   Set ToolKit Color Settings
echo.
if "%IsDialogsEnabled%" equ "No" echo.  [2]   Enable ToolKit Info/Warning Dialogs
if "%IsDialogsEnabled%" equ "Yes" echo.  [2]   Disable ToolKit Info/Warning Dialogs
echo.
if "%IsLogsEnabled%" equ "No" echo.  [3]   Enable ToolKit Log Generation
if "%IsLogsEnabled%" equ "Yes" echo.  [3]   Disable ToolKit Log Generation
echo.
if "%IsImageRegistryLoaded%" equ "No" echo.  [4]   Load Image Registry
if "%IsImageRegistryLoaded%" equ "Yes" echo.  [4]   Unload Image Registry
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   Go Back
echo.
echo.===============================================================================
echo.
choice /C:1234X /N /M "Enter Your Choice : "
if errorlevel 5 goto :ToolsMenu
if errorlevel 4 (
	if "%IsImageRegistryLoaded%" equ "No" (
		cls
		echo.===============================================================================
		echo.                          MSMG ToolKit - Image Registry
		echo.===============================================================================
		echo.
		:: Checking whether Source OS is Selected
		if "%IsSourceSelected%" equ "No" (
			echo.Source OS is not selected, please select from "Source" Menu..
			echo.
			echo.===============================================================================
			echo.
			pause>nul|set /p=Press any key to continue...
			goto :MainMenu
		)
		
		:: Checking whether Multi-Index servicing mode is selected
		if "%ImageIndexNo:~0,1%" equ "," (
			echo.This feature is not available when Multi-Index servicing mode is enabled...
			echo.
			echo.Please Re-Choose source with a Single Index...
			goto :Stop
		)

		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" (
				echo.Loading Image Registry...
				call :MountImageRegistry "%InstallMount%\%%i"
			)
		)

		set "IsImageRegistryLoaded=Yes"
		echo.
		echo.[HKEY_LOCAL_MACHINE\TK_SOFTWARE]         -^> [HKEY_LOCAL_MACHINE\SOFTWARE]
		echo.[HKEY_LOCAL_MACHINE\TK_SOFTWARE\Classes] -^> [HKEY_CLASSES_ROOT]
		echo.[HKEY_LOCAL_MACHINE\TK_SYSTEM]           -^> [HKEY_LOCAL_MACHINE\SYSTEM]
		echo.[HKEY_LOCAL_MACHINE\TK_NTUSER]           -^> [HKEY_CURRENT_USER]
		echo.[HKEY_LOCAL_MACHINE\TK_DEFAULT]          -^> [HKEY_USERS\.Default]
		echo.
		echo.Loading Image Registry Complete...
		echo.
		echo.===============================================================================
		echo.
		pause>nul|set /p=Press any key to continue...
	)
	if "%IsImageRegistryLoaded%" equ "Yes" (
		cls
		echo.===============================================================================
		echo.                          MSMG ToolKit - Image Registry
		echo.===============================================================================
		echo.
		echo.Unloading Image Registry...
		call :UnMountImageRegistry
		set "IsImageRegistryLoaded=No"
		echo.
		echo.Unloading Image Registry Complete...
		echo.
		echo.===============================================================================
		echo.
		pause>nul|set /p=Press any key to continue...
	)
	goto :Toolsmenu
)
if errorlevel 3 (
	if "%IsLogsEnabled%" equ "No" set "IsLogsEnabled=Yes"
	if "%IsLogsEnabled%" equ "Yes" set "IsLogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 2 (
	if "%IsDialogsEnabled%" equ "No" set "IsDialogsEnabled=Yes"
	if "%IsDialogsEnabled%" equ "Yes" set "IsDialogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 1 goto :SetTkColor

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Set ToolKit Color Settings
::-------------------------------------------------------------------------------------------
:SetTkColor

cls
echo.===============================================================================
echo.                   MSMG ToolKit - Set ToolKit Color Settings
echo.===============================================================================
echo. List of Available Background / Foreground Color :
echo.
echo.  [1]  Black - White                [F]  Aqua         - Blue
echo.  [2]  Black - Light Green          [G]  Aqua         - Light Blue
echo.  [3]  Black - Light Aqua           [H]  Aqua         - Light Yellow
echo.  [4]  Black - Light Red            [I]  Red          - Light Green
echo.  [5]  Black - Light Yellow         [J]  Red          - Light Aqua
echo.  [6]  Black - Bright White         [K]  Red          - Light Yellow
echo.  [7]  Blue  - White                [L]  Red          - Bright White
echo.  [8]  Blue  - Light Green          [M]  Light Blue   - White
echo.  [9]  Blue  - Light Aqua           [N]  Light Blue   - Light Green
echo.  [A]  Blue  - Light Red            [O]  Light Blue   - Light Aqua
echo.  [B]  Blue  - Light Purple         [P]  Light Blue   - Light Yellow
echo.  [C]  Blue  - Light Yellow         [Q]  Light Blue   - Bright White
echo.  [D]  Blue  - Bright White         [R]  Bright White - Black
echo.  [E]  Aqua  - Black                [S]  Bright White - Blue
echo.
echo.  [X]  Go Back
echo.===============================================================================
echo.
choice /C:123456789ABCDEFGHIJKLMNoPQRSX /N /M "Enter Your Choice : "
if errorlevel 29 goto :Options
if errorlevel 28 color F1
if errorlevel 27 color F0
if errorlevel 26 color 9F
if errorlevel 25 color 9E
if errorlevel 24 color 9B
if errorlevel 23 color 9A
if errorlevel 22 color 97
if errorlevel 21 color 4F
if errorlevel 20 color 4E
if errorlevel 19 color 4B
if errorlevel 18 color 4A
if errorlevel 17 color 3E
if errorlevel 16 color 39
if errorlevel 15 color 31
if errorlevel 14 color 30
if errorlevel 13 color 1F
if errorlevel 12 color 1E
if errorlevel 11 color 1D
if errorlevel 10 color 1C
if errorlevel 9  color 1B
if errorlevel 8  color 1A
if errorlevel 7  color 17
if errorlevel 6  color 0F
if errorlevel 5  color 0E
if errorlevel 4  color 0C
if errorlevel 3  color 0B
if errorlevel 2  color 0A
if errorlevel 1  color 07

:: Returning to Tools Menu
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

:: ############################################################################################
:: MSMG ToolKit DISM Functions
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Count
:: Input Parameters [ %~1 : Image Filename ]
::-------------------------------------------------------------------------------------------
:GetImageCount

:: Finding total no of Indexes present in the Image.
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-ImageInfo /ImageFile:%~1 ^| findstr Index') do (set ImageCount=%%a)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to display Image Information
::-------------------------------------------------------------------------------------------
:ShowImageInfo

set "ImageInfo=%Temp%\ImageInfo.txt"

call :RemoveFile "%ImageInfo%"

:: Get total no of Indexes present in the Image.
call :GetImageCount "%InstallWim%"

echo.
echo.Reading Image Information...
echo.
:: List all the Indexes in the Image.
echo.===============================================================================>>%ImageInfo%
echo.^| Index ^| Arch ^| Name>>%ImageInfo%
echo.===============================================================================>>%ImageInfo%
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% ^| findstr Index') do (
	for /f "tokens=2 delims=: " %%b in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:" %%c in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Name') do (
			if "%%b" neq "arm64" (
				if %%a lss 10 echo.^|   %%a   ^| %%b  ^|%%c>>%ImageInfo%
				if %%a geq 10 if %%a lss 100 echo.^|   %%a  ^| %%b  ^|%%c>>%ImageInfo%
				if %%a geq 100 echo.^|   %%a ^| %%b  ^|%%c>>%ImageInfo%
			)
			if "%%b" equ "arm64" (
				if %%a lss 10 echo.^|   %%a   ^| %%b^|%%c>>%ImageInfo%
				if %%a geq 10 if %%a lss 100 echo.^|   %%a  ^| %%b^|%%c>>%ImageInfo%
				if %%a geq 100 echo.^|   %%a ^| %%b^|%%c>>%ImageInfo%
			)
		)
	)
)

type "%ImageInfo%"
call :RemoveFile "%ImageInfo%"

echo.===============================================================================
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Image Index number to service
:: Input Parameters [ %~1 : Image Filename ]
::-------------------------------------------------------------------------------------------
:GetImageIndexNo

:: Display the list of avaialble Image Indexes.
call :ShowImageInfo

if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=Enter the Image Index # [1 or 'Q'uit] : 
) else set /p ImageIndexNo=Enter the Image Index # [Range : 1,...%ImageCount% or 'A'll 'Q'uit] : 

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Name
:: Input Parameters [ %~1 : Image Filename ]
::-------------------------------------------------------------------------------------------
:GetImageName

for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Name') do (set ImageName=%%a)
set "ImageName=%ImageName:~1%"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Architecture
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:GetImageArchitecture

for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do (set ImageArchitecture=%%a)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Edition
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:GetImageEdition

for /f "tokens=2 delims=: " %%f in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do (set ImageEdition=%%f)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Information
:: Input Parameters [%~1 : Image Filename, %~2 : Image Index No]
::-------------------------------------------------------------------------------------------
:GetImageIndexInfo

for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Name') do (set ImageName=%%a)
for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Description') do (set ImageDescription=%%b)
for /f "tokens=2 delims=: " %%c in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do (set ImageArchitecture=%%c)
for /f "tokens=2 delims=: " %%d in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Version') do (set ImageVersion=%%d)
for /f "tokens=2 delims=:" %%e in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Build"') do (set ImageServicePackBuild=%%e)
for /f "tokens=2 delims=:" %%f in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Level"') do (set ImageServicePackLevel=%%f)
for /f "tokens=2 delims=: " %%g in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do (set ImageEdition=%%g)
for /f "tokens=2 delims=:<> " %%h in ('%Imagex% /info "%~1" %~2 ^| findstr /i Flag') do (set ImageFlag=%%h)
for /f "tokens=2 delims=:" %%i in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Installation') do (set ImageInstallationType=%%i)
for /f "tokens=1 delims= " %%j in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i "Default"') do (set "ImageDefaultLanguage=%%j")

set "ImageName=%ImageName:~1%"
set "ImageDescription=%ImageDescription:~1%"

if "%ImageVersion:~0,-6%" neq "10.0" if "%ImageVersion:~0,-6%" neq "11.0" set /A ImageBuild=%ImageVersion:~4,4%
if "%ImageVersion%" neq "6.1.7601" if "%ImageVersion%" neq "6.3.9600" set /A ImageBuild=%ImageVersion:~5,5%

set "ImageServicePackBuild=%ImageServicePackBuild:~1%"
set "ImageServicePackLevel=%ImageServicePackLevel:~1%"
set "ImageInstallationType=%ImageInstallationType:~1%"
set "ImageDefaultLanguage=!ImageDefaultLanguage:~1!"

if "%ImageFlag%" equ "" set "ImageFlag=%ImageEdition%"

if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:(=[%"
if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:)=]%"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get Information for Unattended file
::-------------------------------------------------------------------------------------------
:GetInformation4UnattendedFile
if /I "%IsSourceSelected%" equ "Yes" (
	call :MountImageRegistry "%InstallMount%\%DefaultIndexNo%" >nul 2>&1
	for /f "tokens=3 delims=\ " %%o in ('reg query "HKLM\TK_NTUSER\Control Panel\International\User Profile" /s /v "Languages" 2^>nul ^| findstr /I "REG_ _SZ"') do (set "ImageLanguage=%%o")
	call :UnMountImageRegistry

	for /f "tokens=6 delims= " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Default system UI language"') do (set "ImageUILanguage=%%l")
	if "!ImageLanguage!" equ "" set "ImageLanguage=!ImageUILanguage!"

	set ImagePartiallyLocalized=
	set ImageLanguageFallback=
	for /f "tokens=3 delims=, " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Partially localized language"') do (set "ImagePartiallyLocalized=%%l")
	if "!ImagePartiallyLocalized!" equ "Partially" (
		for /f "tokens=7 delims= " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"language fallback is"') do (set "ImageLanguageFallback=%%l")
		if "!ImageLanguageFallback!" equ "" set "ImageLanguageFallback=en-US"
	)

	for /f "tokens=4 delims=, " %%k in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Active keyboard(s)"') do (set "ImageActiveKeyboard=%%k")
	rem Windows Default pt-BR Layout is ABNT "0416:00000416". But popular Layout is ABNT2 "0416:00010416"
	if "!ImageActiveKeyboard!" equ "0416:00000416" set "ImageActiveKeyboard=0416:00010416"

	if "!ImageDefaultLanguage!" equ "%HostUILanguage%" (
		set "ImageTimeZone=%HostTimeZone%"
	)
	if "!ImageDefaultLanguage!" neq "%HostUILanguage%" (
		for /f "tokens=2 delims=:" %%f in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Default time zone"') do (set "ImageTimeZone=%%f")
		set "ImageTimeZone=!ImageTimeZone:~1!"
	)
)

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to get updated Image Index Information
::-------------------------------------------------------------------------------------------
:GetUpdatedImageInformation

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		call :MountImageRegistry "%InstallMount%\%%i"
		for /f "tokens=3 delims= " %%x in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild" ^| find "REG_SZ"') do (set /a ImageBuild=%%x)
		set "ImageVersion=10.0.%ImageBuild%"
		for /f "tokens=3 delims= " %%y in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "UBR" ^| find "REG_DWORD"') do (set /a ImageServicePackBuild=%%y)
		call :UnMountImageRegistry
	)
)

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Mount a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Mount folder ]
::-------------------------------------------------------------------------------------------
:MountImage

%DISM% /Mount-Image /ImageFile:%~1 /Index:%~2 /MountDir:%~3
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Un-Mount the Mounted Image
:: Input Parameters [ %~1 : Image Mount Folder, %~2 : Image Commit / Discard Option ]
::-------------------------------------------------------------------------------------------
:UnMountImage

%DISM% /Unmount-Image /MountDir:%~1 /%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to delete a selected Image Index from a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:DeleteImage

%DISM% /Delete-Image /ImageFile:%~1 /Index:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to rename a selected Image Index Information
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Name, %~4 : Image Description ]
::-------------------------------------------------------------------------------------------
:RenameImage

%Imagex% /Info %~1 %~2 "%~3" "%~4"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to split a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Split Filename, %~3 : Image Split Size in MB ]
::-------------------------------------------------------------------------------------------
:SplitImage

%DISM% /Split-Image /ImageFile:%~1 /SWMFile:%~2 /FileSize:%~3
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to merge a splitted Image
:: Input Parameters [ %~1 : Image Splitted Filename without Extension, %~2 : Image Filename ]
::-------------------------------------------------------------------------------------------
:MergeImage

%Imagex% /ref %~1*.swm /Check /Export %~1.swm * %~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to apply a Image to a drive or a folder
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Apply Drive or folder Name ]
::-------------------------------------------------------------------------------------------
:ApplyImage

%DISM% /Apply-Image /ImageFile:%~1 /Index:%~2 /ApplyDir:%~3\ /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to capture a drive or a folder to a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Capture Drive or Folder Name,
::                    %~3 : Index Name,  %~4 : Index Description, %~5 : Bootable or Not Options ]
::-------------------------------------------------------------------------------------------
:CaptureImage

if "%~5" equ "Yes" %DISM% /Capture-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Bootable /Compress:Max /CheckIntegrity /Verify
if "%~5" equ "No" %DISM% /Capture-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Compress:Max /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to append another Image to Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Capture Drive or Folder Name,
::                    %~3 : Index Name,  %~4 : Index Description, %~5 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
:AppendImage

if "%~5" equ "Yes" %DISM% /Append-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Bootable /CheckIntegrity /Verify
if "%~5" equ "No" %DISM% /Append-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export a select Image Index with Maximum/Recovery compression
:: Input Parameters [ %~1 : Source Image Filename, %~2 : Source Image Index No,
::                    %~3 : Target Image Filename, %~4 : Image Format, %~5 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
:ExportImageIndex

if "%~4" equ "WIM" if "%~5" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Max /Bootable
if "%~4" equ "WIM" if "%~5" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Max
if "%~4" equ "ESD" if "%~5" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Recovery /Bootable
if "%~4" equ "ESD" if "%~5" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Recovery
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export all Image Indexes with Maximum/Recovery compression
:: Input Parameters [ %~1 : Source Image Filename, %~2 : Target Image Filename, %~3 : Image Format, %~4 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
:ExportImage

if "%~3" equ "WIM" if "%~4" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Max /Bootable
if "%~3" equ "WIM" if "%~4" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Max
if "%~3" equ "ESD" if "%~4" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Recovery /Bootable
if "%~3" equ "ESD" if "%~4" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Recovery
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to cleanup a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Option  ]
::-------------------------------------------------------------------------------------------
:CleanupImage

setlocal

set "CleanupOption=%~2"

if "%CleanupOption%" equ "SPSupersededHideSP" (
	%DISM% /Image:%~1 /Cleanup-Image /SPSuperseded /HideSP
)

if "%CleanupOption%" equ "ComponentCleanupResetBase" (
	%DISM% /Image:%~1 /Cleanup-Image /StartComponentCleanup /ResetBase
)

if "%CleanupOption%" equ "CheckHealth" (
	%DISM% /Image:%~1 /Cleanup-Image /CheckHealth
)

if "%CleanupOption%" equ "ScanHealth" (
	%DISM% /Image:%~1 /Cleanup-Image /ScanHealth
)

echo.

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to add driver packages to Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Drivers Packages Path ]
::-------------------------------------------------------------------------------------------
:AddDriver

%DISM% /Image:%~1 /Add-Driver /Driver:%~2 /ForceUnsigned /Recurse
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to enable a feature inside a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Feature Name ]
::-------------------------------------------------------------------------------------------
:EnableFeature

%DISM% /Image:%~1 /Enable-Feature /FeatureName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to disable a feature inside a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Feature Name ]
::-------------------------------------------------------------------------------------------
:DisableFeature

%DISM% /Image:%~1 /Disable-Feature /FeatureName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export a list of packages present inside a Image to a file
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Filename ]
::-------------------------------------------------------------------------------------------
:GetPackages

%DISM% /Get-Packages /Image:%~1 > %Logs%\%~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export the list of features present inside a Image to a file
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Filename ]
::-------------------------------------------------------------------------------------------
:GetFeatures

%DISM% /Get-Features /Format:Table /Image:%~1 > %Logs%\%~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to add a Package to Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Packages Path / Package Name ]
::-------------------------------------------------------------------------------------------
:AddPackage

%DISM% /Image:%~1 /Add-Package /PackagePath:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to remove a Package from a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Packages Path / Package Name ]
::-------------------------------------------------------------------------------------------
:RemovePackage

%DISM% /Image:%~1 /Remove-Package /PackageName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to add a provisioned appx package to a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Name, %~3 : App Package Path, %~4 : App Dependency Packages Path, %~5 : App License Path ]
::-------------------------------------------------------------------------------------------
:AddProvisionedAppxPackage

echo.-------------------------------------------------------------------------------
echo.Integrating %~2 Provisioned Appx Package...
echo.-------------------------------------------------------------------------------
%DISM% /Image:%~1 /Add-ProvisionedAppxPackage /PackagePath:%~3 %~4 %~5
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to remove provisioned appx package from the Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Name, %~3 : Package Name ]
::-------------------------------------------------------------------------------------------
:RemoveProvisionedAppxPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.Removing %~2 Provisioned Appx Package...
echo.-------------------------------------------------------------------------------

:: Getting Provisioned Appx Package list
for /f "tokens=2 delims=: " %%a in ('%DISM% /Image:%~1 /Get-ProvisionedAppxPackages ^| find /I "PackageName : %~3"') do (set PackageName=%%a)

if "%PackageName%" equ "" (
	echo.
	echo.The specified Provisioned Appx Package has already been removed...
) else (
	:: Removing Provisioned Appx Package from the Image
	%DISM% /Image:%~1 /Remove-ProvisionedAppxPackage /PackageName:%PackageName%
)

echo.

set PackageName=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to remove the default application associations from the Windows image
:: Input Parameters [ %~1 : Image Mount Path ]
::-------------------------------------------------------------------------------------------
:RemoveDefaultAppAssociations

%DISM% /Image:%~1 /Remove-DefaultAppAssociations

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to import a set of default application associations to a Windows image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Association XML Filename ]
::-------------------------------------------------------------------------------------------
:ImportDefaultAppAssociations

%DISM% /Image:%~1 /Import-DefaultAppAssociations:%~2

goto :eof
::-------------------------------------------------------------------------------------------

:: ############################################################################################
:: MSMG ToolKit Misc Functions
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: Function to remove a Locked/Hidden Windows Package from the Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Package Description, %~3 : Package Name ]
::-------------------------------------------------------------------------------------------
:RemoveLockedPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.Removing %~2 Package...
echo.-------------------------------------------------------------------------------

:: Making Locked/Hidden Windows Package visible
call :UnHidePackage "%~1", %~3

:: Getting Windows Package List
for /f "tokens=2 delims=:" %%a in ('%DISM% /Image:%~1 /Get-Packages ^| find /I "%~3"') do ( set PackageName=%%a )

if "%PackageName%" neq "" (
	if "%SelectedSourceOS%" equ "w7" (
		for /f "tokens=* delims= " %%a in ("%PackageName%") do set PackageName=%%a
		for /l %%a in (1,1,31) do if "!PackageName:~-1!" equ " " set PackageName=!PackageName:~0,-1!
	)
	if "%SelectedSourceOS%" neq "w7" set PackageName=%PackageName:~1,-1%
)

if "%PackageName%" equ "" (
	echo.
	echo.The specified package has already been removed...
	echo.
) else (
	:: Removing Windows Package from the Image
	%DISM% /Image:%~1 /Remove-Package /PackageName:%PackageName%
	echo.
)

set PackageName=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to mount Image Registry
:: Input Parameters [ %~1 : Image Mount Path ]
::-------------------------------------------------------------------------------------------
:MountImageRegistry

:: Mounting Image Registry for Offline Editing
reg load HKLM\TK_COMPONENTS "%~1\Windows\System32\config\COMPONENTS" >nul
reg load HKLM\TK_DEFAULT "%~1\Windows\System32\config\default" >nul
reg load HKLM\TK_NTUSER "%~1\Users\Default\ntuser.dat" >nul
reg load HKLM\TK_SOFTWARE "%~1\Windows\System32\config\SOFTWARE" >nul
reg load HKLM\TK_SYSTEM "%~1\Windows\System32\config\SYSTEM" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to unmount Image Registry
:: Input Parameters [ None ]
::-------------------------------------------------------------------------------------------
:UnMountImageRegistry

:: Un-Mounting Image Registry
for /f "tokens=* delims=" %%a in ('reg query "HKLM" ^| findstr "{"') do (
	reg unload "%%a" >nul 2>&1
)

reg unload HKLM\TK_COMPONENTS >nul 2>&1
reg unload HKLM\TK_DEFAULT >nul 2>&1
reg unload HKLM\TK_DRIVERS >nul 2>&1
reg unload HKLM\TK_NTUSER >nul 2>&1
reg unload HKLM\TK_SCHEMA >nul 2>&1
reg unload HKLM\TK_SOFTWARE >nul 2>&1
reg unload HKLM\TK_SYSTEM >nul 2>&1

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to import registry settings to Image Registry
:: Input Parameters [ %~1 : Import Registry file Name ]
::-------------------------------------------------------------------------------------------
:ImportRegistry2Image

:: Importing registry settings to Image Registry
reg import "%~1"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Create a Folder
:: Input Parameters [ %~1 : Foldername ]
::-------------------------------------------------------------------------------------------
:CreateFolder

if not exist "%~1" md "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to delete a file(s)
:: Input Parameters [ %~1 : Filename ]
::-------------------------------------------------------------------------------------------
:RemoveFile

if exist "%~1" del /f /q "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to delete a folder(s)
:: Input Parameters [ %~1 : Foldername ]
::-------------------------------------------------------------------------------------------
:RemoveFolder

if exist "%~1" rd /q /s "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to unhide a Windows Component Package
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Package Name ]
::-------------------------------------------------------------------------------------------
:UnHidePackage

setlocal

set RegistryKey=

:: Mounting Image Registry
call :MountImageRegistry "%~1" >nul 2>&1

:: Retrieving Package Registry Key Path
for /f "tokens=* delims=" %%a in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" /f "%~2" ^| find /I "%~2"') do ( set "RegistryKey=%%a" )

:: Making Windows Components Package visible
reg add "%RegistryKey%" /v Visibility /t REG_DWORD /d 1 /f >nul 2>&1
reg add "%RegistryKey%" /v DefVis /t REG_DWORD /d 2 /f >nul 2>&1
reg delete "%RegistryKey%\Owners" /f >nul 2>&1

:: Un-Mounting Image Registry
call :UnMountImageRegistry

set RegistryKey=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Cleanup MSMG Toolkit's temporary files and folders
::-------------------------------------------------------------------------------------------
:CleanUp

echo.Starting Cleaning Up...
echo.
echo.Cleaning Up Image Registry Mount Points...
call :UnMountImageRegistry

echo.
echo.Cleaning Up Image Mount Points...
Dism.exe /English /Quiet /Unmount-Wim /MountDir:"%BootMount%\1" /Discard >nul
Dism.exe /English /Quiet /Unmount-Wim /MountDir:"%BootMount%\2" /Discard >nul
Dism.exe /English /Unmount-Wim /MountDir:"%WinReMount%" /Discard >nul

for /l %%i in (1, 1, 100) do (
	if exist "%InstallMount%\%%i\Windows" Dism.exe /English /Unmount-Wim /MountDir:"%InstallMount%\%%i" /Discard >nul
)

:: Cleaning Up Images Mount Points Folders
call :RemoveFolder "%BootMount%"
call :CreateFolder "%BootMount%\1"
call :CreateFolder "%BootMount%\2"
call :RemoveFolder "%InstallMount%"
call :CreateFolder "%InstallMount%"
call :RemoveFolder "%WinReMount%"
call :CreateFolder "%WinReMount%"
echo.

:: Cleaning Up Logs Folders
echo.Cleaning Up Logs files...
call :RemoveFolder "%Logs%"
call :CreateFolder "%Logs%"
echo.

:: Cleaning Up Temporary files Folders
echo.Cleaning Up Temporary files...
call :RemoveFolder "%Temp%"
call :CreateFolder "%Temp%"

echo.
echo.Finished Cleaning Up...
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to quit MSMG Toolkit
::-------------------------------------------------------------------------------------------
:Quit

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Quit
echo.===============================================================================
echo.
if "%IsSourceSelected%" equ "Yes" (
	echo.Source OS is selected, please do choose Save/Discard from "Apply" Main Menu..
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=Press any key to continue...

	goto :Mainmenu
)
echo.Performing Post-cleanup operation, please wait...
echo.
call :CleanUp
echo.Thanks ^& Credits to Everyone at MDL...
echo.
echo.Quitting MSMG ToolKit...
echo.
echo.===============================================================================
echo.
pause>nul|set /p=Press any key to continue...

:: Restoring DOS Window Size
reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

reg add "HKU\.DEFAULT\Console" /v "FaceName" /t REG_SZ /d "Consolas" /f
reg add "HKU\.DEFAULT\Console" /v "FontFamily" /t REG_DWORD /d "0x36" /f
reg add "HKU\.DEFAULT\Console" /v "FontSize" /t REG_DWORD /d "0x100000" /f
reg add "HKU\.DEFAULT\Console" /v "FontWeight" /t REG_DWORD /d "0x190" /f
reg add "HKU\.DEFAULT\Console" /v "ScreenBufferSize" /t REG_DWORD /d "0x12c0050" /f

color 00
endlocal

exit