11# Enable debugging
2- # Set-PSDebug -Trace 1
2+ Set-PSDebug - Trace 1
33
44# Check if PowerShell execution is restricted
55if ((Get-ExecutionPolicy ) -eq ' Restricted' ) {
@@ -220,10 +220,8 @@ Remove-Item -Path "$mainOSDrive\scratchdir\Windows\System32\Microsoft-Edge-Webvi
220220Write-Host " Removing WinRE"
221221& ' takeown' ' /f' " $mainOSDrive \scratchdir\Windows\System32\Recovery" ' /r'
222222& ' icacls' " $mainOSDrive \scratchdir\Windows\System32\Recovery" ' /grant' ' Administrators:F' ' /T' ' /C'
223- Remove-Item - Path " $mainOSDrive \scratchdir\Windows\System32\Recovery" - Recurse - Force
224- & ' takeown' ' /f' " $mainOSDrive \scratchdir\Windows\System32\Microsoft-Edge-Webview" ' /r' > null
225- & ' icacls' " $mainOSDrive \scratchdir\Windows\System32\Microsoft-Edge-Webview" ' /grant' " $ ( $adminGroup.Value ) :(F)" ' /T' ' /C' > null
226- Remove-Item - Path " $mainOSDrive \scratchdir\Windows\System32\Microsoft-Edge-Webview" - Recurse - Force > null
223+ Remove-Item - Path " $mainOSDrive \scratchdir\Windows\System32\Recovery\winre.wim" - Recurse - Force
224+ New-Item - Path " $mainOSDrive \scratchdir\Windows\System32\Recovery\winre.wim" - ItemType File - Force
227225Write-Host " Removing OneDrive:"
228226& ' takeown' ' /f' " $mainOSDrive \scratchdir\Windows\System32\OneDriveSetup.exe" > null
229227& ' icacls' " $mainOSDrive \scratchdir\Windows\System32\OneDriveSetup.exe" ' /grant' " $ ( $adminGroup.Value ) :(F)" ' /T' ' /C' > null
@@ -391,7 +389,6 @@ Write-Host "Disabling Sponsored Apps:"
391389& ' reg' ' add' ' HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' ' /v' ' DisableCloudOptimizedContent' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' > null
392390Write-Host " Enabling Local Accounts on OOBE:"
393391& ' reg' ' add' ' HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' ' /v' ' BypassNRO' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' > null
394- Copy-Item - Path " $PSScriptRoot \autounattend.xml" - Destination " $mainOSDrive \scratchdir\Windows\System32\Sysprep\autounattend.xml" - Force > null
395392Write-Host " Disabling Reserved Storage:"
396393& ' reg' ' add' ' HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' ' /v' ' ShippedWithReserves' ' /t' ' REG_DWORD' ' /d' ' 0' ' /f' > null
397394Write-Host " Disabling BitLocker Device Encryption"
@@ -421,6 +418,12 @@ Write-Host "Disabling bing in Start Menu:"
421418& ' reg' ' add' ' HKLM\zNTUSER\Software\Policies\Microsoft\Windows\Explorer'
422419& ' reg' ' add' ' HKLM\zNTUSER\Software\Policies\Microsoft\Windows\Explorer' ' /v' ' ShowRunAsDifferentUserInStart' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f'
423420& ' reg' ' add' ' HKLM\zNTUSER\Software\Policies\Microsoft\Windows\Explorer' ' /v' ' DisableSearchBoxSuggestions' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f'
421+ # # Prevents installation or DevHome and Outlook
422+ Write-Host " Prevents installation or DevHome and Outlook:"
423+ & ' reg' ' add' ' HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\OutlookUpdate' ' /v' ' workCompleted' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' | Out-Null
424+ & ' reg' ' add' ' HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\DevHomeUpdate' ' /v' ' workCompleted' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' | Out-Null
425+ & ' reg' ' delete' ' HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' ' /f' | Out-Null
426+ & ' reg' ' delete' ' HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' ' /f' | Out-Null
424427# # this function allows PowerShell to take ownership of the Scheduled Tasks registry key from TrustedInstaller. Based on Jose Espitia's script.
425428function Enable-Privilege {
426429 param (
@@ -709,6 +712,7 @@ Write-Host "Bypassing system requirements(on the setup image):"
709712& ' reg' ' add' ' HKLM\zSYSTEM\Setup\LabConfig' ' /v' ' BypassStorageCheck' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' > null
710713& ' reg' ' add' ' HKLM\zSYSTEM\Setup\LabConfig' ' /v' ' BypassTPMCheck' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' > null
711714& ' reg' ' add' ' HKLM\zSYSTEM\Setup\MoSetup' ' /v' ' AllowUpgradesWithUnsupportedTPMOrCPU' ' /t' ' REG_DWORD' ' /d' ' 1' ' /f' > null
715+ & ' reg' ' add' ' HKEY_LOCAL_MACHINE\zSYSTEM\Setup' ' /v' ' CmdLine' ' /t' ' REG_SZ' ' /d' ' X:\sources\setup.exe' ' /f' > null
712716Write-Host " Tweaking complete!"
713717Write-Host " Unmounting Registry..."
714718$regKey.Close ()
@@ -725,9 +729,6 @@ Write-Host "Exporting ESD. This may take a while..."
725729& dism / Export-Image / SourceImageFile:" $mainOSDrive \tiny11\sources\install.wim" / SourceIndex:1 / DestinationImageFile:" $mainOSDrive \tiny11\sources\install.esd" / Compress:recovery
726730Remove-Item " $mainOSDrive \tiny11\sources\install.wim" > $null 2>&1
727731Write-Host " The tiny11 image is now completed. Proceeding with the making of the ISO..."
728- Write-Host " Copying unattended file for bypassing MS account on OOBE..."
729- Copy-Item - Path " $PSScriptRoot \autounattend.xml" - Destination " $mainOSDrive \tiny11\autounattend.xml" - Force > null
730-
731732Write-Host " Creating ISO image..."
732733$ADKDepTools = " C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture \Oscdimg"
733734$localOSCDIMGPath = " $PSScriptRoot \oscdimg.exe"
0 commit comments