From b4f8f1b9d8d5820a88a6b18cc729658ba8542de8 Mon Sep 17 00:00:00 2001 From: Peter Reichart Date: Wed, 4 Dec 2024 09:42:50 +0000 Subject: [PATCH] Dateien nach "addfiles" hochladen --- addfiles/autounattend.xml | 645 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 645 insertions(+) create mode 100644 addfiles/autounattend.xml diff --git a/addfiles/autounattend.xml b/addfiles/autounattend.xml new file mode 100644 index 0000000..2a9562a --- /dev/null +++ b/addfiles/autounattend.xml @@ -0,0 +1,645 @@ + + + + + + + + de-DE + + 0407:00000407 + de-DE + de-DE + de-DE + + + + + VK7JG-NPHTM-C97JM-9MPGT-3V66T + + true + + + + 1 + cmd.exe /c ">>"X:\defender.vbs" (echo WScript.Echo "Scanning for newly created SYSTEM registry hive file to disable Windows Defender services..."&echo Set fso = CreateObject("Scripting.FileSystemObject"^))" + + + 2 + cmd.exe /c ">>"X:\defender.vbs" (echo Set existing = CreateObject("Scripting.Dictionary"^)&echo Function Execute(command^)&echo WScript.Echo "Running command '" + command + "'"&echo Set shell = CreateObject("WScript.Shell"^))" + + + 3 + cmd.exe /c ">>"X:\defender.vbs" (echo Set exec = shell.Exec(command^)&echo Do While exec.Status = 0&echo WScript.Sleep 100&echo Loop&echo WScript.Echo exec.StdOut.ReadAll&echo WScript.Echo exec.StdErr.ReadAll)" + + + 4 + cmd.exe /c ">>"X:\defender.vbs" (echo Execute = exec.ExitCode&echo End Function&echo Function FindHiveFiles&echo Set FindHiveFiles = CreateObject("Scripting.Dictionary"^)&echo For Each drive In fso.Drives)" + + + 5 + cmd.exe /c ">>"X:\defender.vbs" (echo If drive.IsReady And drive.DriveLetter ^<^> "X" Then&echo For Each folder In Array("$Windows.~BT\NewOS\Windows", "Windows"^))" + + + 6 + cmd.exe /c ">>"X:\defender.vbs" (echo file = fso.BuildPath(fso.BuildPath(drive.RootFolder, folder^), "System32\config\SYSTEM"^)&echo If fso.FileExists(file^) And fso.FileExists(file + ".LOG1"^) And fso.FileExists(file + ".LOG2"^) Then)" + + + 7 + cmd.exe /c ">>"X:\defender.vbs" (echo FindHiveFiles.Add file, Nothing&echo End If&echo Next&echo End If&echo Next&echo End Function&echo For Each file In FindHiveFiles)" + + + 8 + cmd.exe /c ">>"X:\defender.vbs" (echo WScript.Echo "Will ignore file at '" + file + "' because it was already present when Windows Setup started."&echo existing.Add file, Nothing&echo Next&echo Do)" + + + 9 + cmd.exe /c ">>"X:\defender.vbs" (echo For Each file In FindHiveFiles&echo If Not existing.Exists(file^) Then&echo ret = 1&echo While ret ^> 0&echo WScript.Sleep 500&echo ret = Execute("reg.exe LOAD HKLM\mount " + file^))" + + + 10 + cmd.exe /c ">>"X:\defender.vbs" (echo Wend&echo For Each service In Array("Sense", "WdBoot", "WdFilter", "WdNisDrv", "WdNisSvc", "WinDefend"^))" + + + 11 + cmd.exe /c ">>"X:\defender.vbs" (echo ret = Execute("reg.exe ADD HKLM\mount\ControlSet001\Services\" + service + " /v Start /t REG_DWORD /d 4 /f"^)&echo Next&echo ret = Execute("reg.exe UNLOAD HKLM\mount"^))" + + + 12 + cmd.exe /c ">>"X:\defender.vbs" (echo WScript.Echo "Found and successfully modified SYSTEM registry hive file at '" + file + "'. This window will now close."&echo WScript.Sleep 5000&echo Exit Do&echo End If)" + + + 13 + cmd.exe /c ">>"X:\defender.vbs" (echo WScript.Sleep 1000&echo Next&echo Loop)" + + + 14 + cmd.exe /c "start /MIN cscript.exe //E:vbscript X:\defender.vbs" + + + + + + + + + + 1 + powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;" + + + 2 + powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\Specialize.ps1' -Raw | Invoke-Expression;" + + + 3 + reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT" + + + 4 + powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\DefaultUser.ps1' -Raw | Invoke-Expression;" + + + 5 + reg.exe unload "HKU\DefaultUser" + + + + + W. Europe Standard Time + + + + + + + 0407:00000407 + de-DE + de-DE + de-DE + + + + + + root + Administrators + + root + true</PlainText> + </Password> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + <AutoLogon> + <Username>root</Username> + <Enabled>true</Enabled> + <LogonCount>1</LogonCount> + <Password> + <Value>root</Value> + <PlainText>true</PlainText> + </Password> + </AutoLogon> + <OOBE> + <ProtectYourPC>3</ProtectYourPC> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>false</HideWirelessSetupInOOBE> + <HideOnlineAccountScreens>false</HideOnlineAccountScreens> + </OOBE> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <Order>1</Order> + <CommandLine>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\FirstLogon.ps1' -Raw | Invoke-Expression;"</CommandLine> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <Extensions xmlns="https://schneegans.de/windows/unattend-generator/"> + <ExtractScript> +param( + [xml] $Document +); + +foreach( $file in $Document.unattend.Extensions.File ) { + $path = [System.Environment]::ExpandEnvironmentVariables( + $file.GetAttribute( 'path' ) + ); + mkdir -Path( $path | Split-Path -Parent ) -ErrorAction 'SilentlyContinue'; + $content = $file.InnerText.Trim(); + if( $file.GetAttribute( 'transformation' ) -ieq 'Base64' ) { + [System.IO.File]::WriteAllBytes( $path, [System.Convert]::FromBase64String( $content ) ); + } else { + $encoding = switch( [System.IO.Path]::GetExtension( $path ) ) { + { $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; } + { $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); } + default { [System.Text.Encoding]::Default; } + }; + [System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $content ) ) ); + } +} + </ExtractScript> + <File path="C:\Windows\Setup\Scripts\RemovePackages.ps1" transformation="Text"> +$selectors = @( + 'Microsoft.Microsoft3DViewer'; + 'Microsoft.BingSearch'; + 'Microsoft.549981C3F5F10'; + 'MicrosoftCorporationII.MicrosoftFamily'; + 'Microsoft.WindowsFeedbackHub'; + 'Microsoft.Getstarted'; + 'microsoft.windowscommunicationsapps'; + 'Microsoft.MixedReality.Portal'; + 'Microsoft.BingNews'; + 'Microsoft.MicrosoftOfficeHub'; + 'Microsoft.Office.OneNote'; + 'Microsoft.OutlookForWindows'; + 'Microsoft.People'; + 'MicrosoftCorporationII.QuickAssist'; + 'Microsoft.SkypeApp'; + 'Microsoft.ScreenSketch'; + 'Microsoft.MicrosoftStickyNotes'; + 'Microsoft.Todos'; + 'Microsoft.Wallet'; + 'Microsoft.Xbox.TCUI'; + 'Microsoft.XboxApp'; + 'Microsoft.XboxGameOverlay'; + 'Microsoft.XboxGamingOverlay'; + 'Microsoft.XboxIdentityProvider'; + 'Microsoft.XboxSpeechToTextOverlay'; + 'Microsoft.GamingApp'; + 'Microsoft.YourPhone'; + 'Microsoft.ZuneMusic'; + 'Microsoft.ZuneVideo'; +); +$getCommand = { + Get-AppxProvisionedPackage -Online; +}; +$filterCommand = { + $_.DisplayName -eq $selector; +}; +$removeCommand = { + [CmdletBinding()] + param( + [Parameter( Mandatory, ValueFromPipeline )] + $InputObject + ); + process { + $InputObject | Remove-AppxProvisionedPackage -AllUsers -Online -ErrorAction 'Continue'; + } +}; +$type = 'Package'; +$logfile = 'C:\Windows\Setup\Scripts\RemovePackages.log'; +&amp; { + $installed = &amp; $getCommand; + foreach( $selector in $selectors ) { + $result = [ordered] @{ + Selector = $selector; + }; + $found = $installed | Where-Object -FilterScript $filterCommand; + if( $found ) { + $result.Output = $found | &amp; $removeCommand; + if( $? ) { + $result.Message = "$type removed."; + } else { + $result.Message = "$type not removed."; + $result.Error = $Error[0]; + } + } else { + $result.Message = "$type not installed."; + } + $result | ConvertTo-Json -Depth 3 -Compress; + } +} *&gt;&amp;1 &gt;&gt; $logfile; + </File> + <File path="C:\Windows\Setup\Scripts\RemoveCapabilities.ps1" transformation="Text"> +$selectors = @( + 'OneCoreUAP.OneSync'; + 'App.Support.QuickAssist'; + 'Microsoft.Windows.SnippingTool'; + 'Hello.Face.18967'; + 'Hello.Face.Migration.18967'; + 'Hello.Face.20134'; + 'Media.WindowsMediaPlayer'; +); +$getCommand = { + Get-WindowsCapability -Online | Where-Object -Property 'State' -NotIn -Value @( + 'NotPresent'; + 'Removed'; + ); +}; +$filterCommand = { + ($_.Name -split '~')[0] -eq $selector; +}; +$removeCommand = { + [CmdletBinding()] + param( + [Parameter( Mandatory, ValueFromPipeline )] + $InputObject + ); + process { + $InputObject | Remove-WindowsCapability -Online -ErrorAction 'Continue'; + } +}; +$type = 'Capability'; +$logfile = 'C:\Windows\Setup\Scripts\RemoveCapabilities.log'; +&amp; { + $installed = &amp; $getCommand; + foreach( $selector in $selectors ) { + $result = [ordered] @{ + Selector = $selector; + }; + $found = $installed | Where-Object -FilterScript $filterCommand; + if( $found ) { + $result.Output = $found | &amp; $removeCommand; + if( $? ) { + $result.Message = "$type removed."; + } else { + $result.Message = "$type not removed."; + $result.Error = $Error[0]; + } + } else { + $result.Message = "$type not installed."; + } + $result | ConvertTo-Json -Depth 3 -Compress; + } +} *&gt;&amp;1 &gt;&gt; $logfile; + </File> + <File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1" transformation="Text"> +$selectors = @( + 'Recall'; + 'Microsoft-SnippingTool'; +); +$getCommand = { + Get-WindowsOptionalFeature -Online | Where-Object -Property 'State' -NotIn -Value @( + 'Disabled'; + 'DisabledWithPayloadRemoved'; + ); +}; +$filterCommand = { + $_.FeatureName -eq $selector; +}; +$removeCommand = { + [CmdletBinding()] + param( + [Parameter( Mandatory, ValueFromPipeline )] + $InputObject + ); + process { + $InputObject | Disable-WindowsOptionalFeature -Online -Remove -NoRestart -ErrorAction 'Continue'; + } +}; +$type = 'Feature'; +$logfile = 'C:\Windows\Setup\Scripts\RemoveFeatures.log'; +&amp; { + $installed = &amp; $getCommand; + foreach( $selector in $selectors ) { + $result = [ordered] @{ + Selector = $selector; + }; + $found = $installed | Where-Object -FilterScript $filterCommand; + if( $found ) { + $result.Output = $found | &amp; $removeCommand; + if( $? ) { + $result.Message = "$type removed."; + } else { + $result.Message = "$type not removed."; + $result.Error = $Error[0]; + } + } else { + $result.Message = "$type not installed."; + } + $result | ConvertTo-Json -Depth 3 -Compress; + } +} *&gt;&amp;1 &gt;&gt; $logfile; + </File> + <File path="C:\Windows\Setup\Scripts\TaskbarIcons.ps1" transformation="Text"> +Remove-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband' -Name '*'; + </File> + <File path="C:\Windows\Setup\Scripts\MoveActiveHours.vbs" transformation="Text"> +HKLM = &amp;H80000002 +key = "SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" +Set reg = GetObject("winmgmts://./root/default:StdRegProv") +current = Hour(Now) +reg.SetDWORDValue HKLM, key, "ActiveHoursStart", ( current + 23 ) Mod 24 +reg.SetDWORDValue HKLM, key, "ActiveHoursEnd", ( current + 11 ) Mod 24 +reg.SetDWORDValue HKLM, key, "SmartActiveHoursState", 2 + </File> + <File path="C:\Windows\Setup\Scripts\MoveActiveHours.xml" transformation="Text"> +&lt;Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"&gt; + &lt;Triggers&gt; + &lt;BootTrigger&gt; + &lt;Repetition&gt; + &lt;Interval&gt;PT4H&lt;/Interval&gt; + &lt;StopAtDurationEnd&gt;false&lt;/StopAtDurationEnd&gt; + &lt;/Repetition&gt; + &lt;Enabled&gt;true&lt;/Enabled&gt; + &lt;/BootTrigger&gt; + &lt;RegistrationTrigger&gt; + &lt;Repetition&gt; + &lt;Interval&gt;PT4H&lt;/Interval&gt; + &lt;StopAtDurationEnd&gt;false&lt;/StopAtDurationEnd&gt; + &lt;/Repetition&gt; + &lt;Enabled&gt;true&lt;/Enabled&gt; + &lt;/RegistrationTrigger&gt; + &lt;/Triggers&gt; + &lt;Principals&gt; + &lt;Principal id="Author"&gt; + &lt;UserId&gt;S-1-5-19&lt;/UserId&gt; + &lt;RunLevel&gt;LeastPrivilege&lt;/RunLevel&gt; + &lt;/Principal&gt; + &lt;/Principals&gt; + &lt;Settings&gt; + &lt;MultipleInstancesPolicy&gt;IgnoreNew&lt;/MultipleInstancesPolicy&gt; + &lt;DisallowStartIfOnBatteries&gt;true&lt;/DisallowStartIfOnBatteries&gt; + &lt;StopIfGoingOnBatteries&gt;true&lt;/StopIfGoingOnBatteries&gt; + &lt;AllowHardTerminate&gt;true&lt;/AllowHardTerminate&gt; + &lt;StartWhenAvailable&gt;false&lt;/StartWhenAvailable&gt; + &lt;RunOnlyIfNetworkAvailable&gt;false&lt;/RunOnlyIfNetworkAvailable&gt; + &lt;IdleSettings&gt; + &lt;StopOnIdleEnd&gt;true&lt;/StopOnIdleEnd&gt; + &lt;RestartOnIdle&gt;false&lt;/RestartOnIdle&gt; + &lt;/IdleSettings&gt; + &lt;AllowStartOnDemand&gt;true&lt;/AllowStartOnDemand&gt; + &lt;Enabled&gt;true&lt;/Enabled&gt; + &lt;Hidden&gt;false&lt;/Hidden&gt; + &lt;RunOnlyIfIdle&gt;false&lt;/RunOnlyIfIdle&gt; + &lt;WakeToRun&gt;false&lt;/WakeToRun&gt; + &lt;ExecutionTimeLimit&gt;PT72H&lt;/ExecutionTimeLimit&gt; + &lt;Priority&gt;7&lt;/Priority&gt; + &lt;/Settings&gt; + &lt;Actions Context="Author"&gt; + &lt;Exec&gt; + &lt;Command&gt;C:\Windows\System32\wscript.exe&lt;/Command&gt; + &lt;Arguments&gt;C:\Windows\Setup\Scripts\MoveActiveHours.vbs&lt;/Arguments&gt; + &lt;/Exec&gt; + &lt;/Actions&gt; +&lt;/Task&gt; + </File> + <File path="C:\Windows\Setup\Scripts\SetStartPins.ps1" transformation="Text"> +$json = '{"pinnedList":[]}'; +if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) { + return; +} +$key = 'Registry::HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start'; +New-Item -Path $key -ItemType 'Directory' -ErrorAction 'SilentlyContinue'; +Set-ItemProperty -LiteralPath $key -Name 'ConfigureStartPins' -Value $json -Type 'String'; + </File> + <File path="C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml" transformation="Text"> +&lt;LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"&gt; + &lt;LayoutOptions StartTileGroupCellWidth="6" /&gt; + &lt;DefaultLayoutOverride&gt; + &lt;StartLayoutCollection&gt; + &lt;StartLayout GroupCellWidth="6" xmlns="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" /&gt; + &lt;/StartLayoutCollection&gt; + &lt;/DefaultLayoutOverride&gt; +&lt;/LayoutModificationTemplate&gt; + </File> + <File path="C:\Windows\Setup\Scripts\unattend-01.cmd" transformation="Text"> +@echo off + +rem ---- Windows 11 Tweaks ---------------------------------------------------- + +rem --- Startmen&#xFC; links +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarDa /t REG_DWORD /d 0 /f +reg add "HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /v Standard /t REG_SZ /f +reg add "HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /F +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 1 /F +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsSearch" /v AllowCortana /t REG_DWORD /d 0 /F +reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\TabletPC" /v DisableSnippingTool /t REG_DWORD /d 1 /F + +rem reg add "HKEY_LOCAL_MACHINE\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 + +rem ---- OneDrive deaktivieren ------------------------------------------------ +taskkill /f /im OneDrive.exe +REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f +REG DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f +REG DELETE "HKEY_CURRENT_USER\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f +REG DELETE "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f +REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "OneDrive" /f + +reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f + +powercfg /change standby-timeout-ac 0 +powercfg /change standby-timeout-dc 10 +powercfg /change hibernate-timeout-ac 0 +powercfg /change hibernate-timeout-dc 10 +powercfg /change monitor-timeout-ac 30 +powercfg /change monitor-timeout-dc 10 +powercfg /change disk-timeout-ac 0 +powercfg /change disk-timeout-dc 20 + +reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f + +powercfg /SETACTIVE /SCHEME_MIN +powercfg /SETDCVALUEINDEX SCHEME_MIN SUB_BUTTONS LIDACTION 0 +powercfg /SETACVALUEINDEX SCHEME_MIN SUB_BUTTONS LIDACTION 0 +powercfg /SETDCVALUEINDEX SCHEME_MIN SUB_BUTTONS PBUTTONACTION 3 +powercfg /SETACVALUEINDEX SCHEME_MIN SUB_BUTTONS PBUTTONACTION 3 + +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search" /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowCortanaButton /t REG_DWORD /d 0 /f +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowTaskViewButton /t REG_DWORD /d 0 /f + +reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f + +reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v NoTileApplicationNotification /t REG_DWORD /d 1 /f + +reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace" /v {0DB7E03F-FC29-4DC6-9020-FF41B59E513A} /f + +reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v ShellFeedsTaskbarViewMode /t REG_DWORD /d 2 /f + </File> + <File path="C:\Windows\Setup\Scripts\Specialize.ps1" transformation="Text"> +$scripts = @( + { + reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f; + }; + { + Remove-Item -LiteralPath 'C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk', 'C:\Windows\System32\OneDriveSetup.exe', 'C:\Windows\SysWOW64\OneDriveSetup.exe' -ErrorAction 'Continue'; + }; + { + Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Force -ErrorAction 'SilentlyContinue'; + }; + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemovePackages.ps1' -Raw | Invoke-Expression; + }; + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveCapabilities.ps1' -Raw | Invoke-Expression; + }; + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveFeatures.ps1' -Raw | Invoke-Expression; + }; + { + net.exe accounts /maxpwage:UNLIMITED; + }; + { + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f + }; + { + netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes; + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f; + }; + { + reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /t REG_DWORD /d 4 /f; + reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoRebootWithLoggedOnUsers /t REG_DWORD /d 1 /f; + }; + { + Register-ScheduledTask -TaskName 'MoveActiveHours' -Xml $( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\MoveActiveHours.xml' -Raw ); + }; + { + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f; + }; + { + reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f; + }; + { + reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f; + }; + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetStartPins.ps1' -Raw | Invoke-Expression; + }; + { + C:\Windows\Setup\Scripts\unattend-01.cmd; + }; +); + +&amp; { + [float] $complete = 0; + [float] $increment = 100 / $scripts.Count; + foreach( $script in $scripts ) { + Write-Progress -Activity 'Running scripts to customize your Windows installation. Do not close this window.' -PercentComplete $complete; + &amp; $script; + $complete += $increment; + } +} *&gt;&amp;1 &gt;&gt; "C:\Windows\Setup\Scripts\Specialize.log"; + </File> + <File path="C:\Windows\Setup\Scripts\UserOnce.ps1" transformation="Text"> +$scripts = @( + { + Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage; + }; + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\TaskbarIcons.ps1' -Raw | Invoke-Expression; + }; + { + $params = @{ + Path = 'Registry::HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32'; + ErrorAction = 'SilentlyContinue'; + Force = $true; + }; + New-Item @params; + Set-ItemProperty @params -Name '(Default)' -Value '' -Type 'String'; + }; + { + Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'LaunchTo' -Type 'DWord' -Value 1; + }; + { + Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Search' -Name 'SearchboxTaskbarMode' -Type 'DWord' -Value 0; + }; + { + Get-Process -Name 'explorer' -ErrorAction 'SilentlyContinue' | Where-Object -FilterScript { + $_.SessionId -eq ( Get-Process -Id $PID ).SessionId; + } | Stop-Process -Force; + }; +); + +&amp; { + [float] $complete = 0; + [float] $increment = 100 / $scripts.Count; + foreach( $script in $scripts ) { + Write-Progress -Activity 'Running scripts to configure this user account. Do not close this window.' -PercentComplete $complete; + &amp; $script; + $complete += $increment; + } +} *&gt;&amp;1 &gt;&gt; "$env:TEMP\UserOnce.log"; + </File> + <File path="C:\Windows\Setup\Scripts\DefaultUser.ps1" transformation="Text"> +$scripts = @( + { + reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f; + }; + { + Remove-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run' -Name 'OneDriveSetup' -Force -ErrorAction 'Continue'; + }; + { + reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f; + }; + { + reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f; + }; + { + reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UnattendedSetup" /t REG_SZ /d "powershell.exe -NoProfile -Command \""Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\UserOnce.ps1' -Raw | Invoke-Expression;\""" /f; + }; +); + +&amp; { + [float] $complete = 0; + [float] $increment = 100 / $scripts.Count; + foreach( $script in $scripts ) { + Write-Progress -Activity 'Running scripts to modify the default user&#x2019;&#x2019;s registry hive. Do not close this window.' -PercentComplete $complete; + &amp; $script; + $complete += $increment; + } +} *&gt;&amp;1 &gt;&gt; "C:\Windows\Setup\Scripts\DefaultUser.log"; + </File> + <File path="C:\Windows\Setup\Scripts\FirstLogon.ps1" transformation="Text"> +$scripts = @( + { + Set-ItemProperty -LiteralPath 'Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoLogonCount' -Type 'DWord' -Force -Value 0; + }; + { + cmd.exe /c "rmdir C:\Windows.old"; + }; +); + +&amp; { + [float] $complete = 0; + [float] $increment = 100 / $scripts.Count; + foreach( $script in $scripts ) { + Write-Progress -Activity 'Running scripts to finalize your Windows installation. Do not close this window.' -PercentComplete $complete; + &amp; $script; + $complete += $increment; + } +} *&gt;&amp;1 &gt;&gt; "C:\Windows\Setup\Scripts\FirstLogon.log"; + </File> + </Extensions> +</unattend> \ No newline at end of file