Created
June 1, 2025 18:49
-
-
Save Omair-Waheed/c3f6ff399f6207da3a1d4aed9116eecb to your computer and use it in GitHub Desktop.
My autounattend.xml for a Windows 11 installation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> | |
| <!-- Copy the link below if you'd like to customize your own. --> | |
| <!-- https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=en-US&Locale=en-US&Keyboard=00000409&GeoLocation=39&ProcessorArchitecture=amd64&ComputerNameMode=Random&CompactOsMode=Never&TimeZoneMode=Explicit&TimeZone=Pacific+Standard+Time&PartitionMode=Interactive&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=pro&InstallFromMode=Index&InstallFromIndex=6&UserAccountMode=InteractiveLocal&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=None&ShowFileExtensions=true&ClassicContextMenu=true&LaunchToThisPC=true&ShowEndTask=true&TaskbarSearch=Icon&TaskbarIconsMode=Empty&DisableWidgets=true&LeftTaskbar=true&HideTaskViewButton=true&ShowAllTrayIcons=true&DisableBingResults=true&StartTilesMode=Empty&StartPinsMode=Empty&DisableWindowsUpdate=true&DisableSac=true&DisableSmartScreen=true&DisableFastStartup=true&EnableLongPaths=true&HardenSystemDriveAcl=true&AllowPowerShellScripts=true&DisableLastAccess=true&PreventAutomaticReboot=true&DisableAppSuggestions=true&PreventDeviceEncryption=true&HideEdgeFre=true&DisableEdgeStartupBoost=true&DisablePointerPrecision=true&ProcessAudit=true&ProcessAuditCommandLine=true&EffectsMode=Default&DesktopIconsMode=Custom&IconRecycleBin=true&WifiMode=Interactive&ExpressSettings=DisableAll&KeysMode=Skip&StickyKeysMode=Disabled&ColorMode=Default&WallpaperMode=Default&Remove3DViewer=true&RemoveBingSearch=true&RemoveCamera=true&RemoveClipchamp=true&RemoveCopilot=true&RemoveCortana=true&RemoveDevHome=true&RemoveFamily=true&RemoveFeedbackHub=true&RemoveGetHelp=true&RemoveHandwriting=true&RemoveInternetExplorer=true&RemoveMaps=true&RemoveMathInputPanel=true&RemoveMixedReality=true&RemoveZuneVideo=true&RemoveNews=true&RemoveOffice365=true&RemoveOneDrive=true&RemoveOpenSSHClient=true&RemovePaint3D=true&RemovePeople=true&RemovePowerAutomate=true&RemovePowerShell2=true&RemoveQuickAssist=true&RemoveRecall=true&RemoveSkype=true&RemoveSolitaire=true&RemoveSpeech=true&RemoveTeams=true&RemoveGetStarted=true&RemoveToDo=true&RemoveVoiceRecorder=true&RemoveWallet=true&RemoveFaxAndScan=true&RemoveZuneMusic=true&RemoveWordPad=true&RemoveYourPhone=true&SystemScript1=%24params+%3D+%40%7B%0D%0A++++Path+%3D+%27Registry%3A%3AHKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CPolicies%5CExplorer%27%3B%0D%0A%7D%3B%0D%0ANew-Item+%40params+-ErrorAction+%27SilentlyContinue%27%3B%0D%0ASet-ItemProperty+%40params+-Name+%27NoDriveAutoRun%27+-Type+%27DWord%27+-Value+%24%28%0D%0A++++%28+1+-shl+26+%29+-+1%3B+%23+0x3FFFFFF%0D%0A%29%3B%0D%0ASet-ItemProperty+%40params+-Name+%27NoDriveTypeAutoRun%27+-Type+%27DWord%27+-Value+%24%28%0D%0A++++%28+1+-shl+8+%29+-+1%3B+%23+0xFF%0D%0A%29%3B%0D%0A&SystemScriptType1=Ps1&SystemScript2=Windows+Registry+Editor+Version+5.00%0D%0A%0D%0A%5BHKEY_LOCAL_MACHINE%5CSYSTEM%5CCurrentControlSet%5CControl%5CRemote+Assistance%5D%0D%0A%22fAllowToGetHelp%22%3Ddword%3A00000000&SystemScriptType2=Reg&WdacMode=Configure&WdacAuditMode=AuditingOnBootFailure&WdacScriptMode=Restricted --> | |
| <settings pass="offlineServicing"/> | |
| <settings pass="windowsPE"> | |
| <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <SetupUILanguage> | |
| <UILanguage>en-US</UILanguage> | |
| </SetupUILanguage> | |
| <InputLocale>0409:00000409</InputLocale> | |
| <SystemLocale>en-US</SystemLocale> | |
| <UILanguage>en-US</UILanguage> | |
| <UserLocale>en-US</UserLocale> | |
| </component> | |
| <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <ImageInstall> | |
| <OSImage> | |
| <Compact>false</Compact><!-- Compact OS compresses OS files. Degrades CPU performance and computer has to decompress when accessing. --> | |
| <InstallFrom> | |
| <MetaData wcm:action="add"> | |
| <Key>/IMAGE/INDEX</Key> | |
| <Value>6</Value> | |
| </MetaData> | |
| </InstallFrom> | |
| </OSImage> | |
| </ImageInstall> | |
| <UserData> | |
| <ProductKey> | |
| <Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key> | |
| <WillShowUI>OnError</WillShowUI> | |
| </ProductKey> | |
| <AcceptEula>true</AcceptEula> | |
| </UserData> | |
| <UseConfigurationSet>false</UseConfigurationSet> | |
| </component> | |
| </settings> | |
| <settings pass="generalize"/> | |
| <settings pass="specialize"> | |
| <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <RunSynchronous> | |
| <RunSynchronousCommand wcm:action="add"> | |
| <Order>1</Order> | |
| <Path>powershell.exe -WindowStyle Normal -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;"</Path> | |
| </RunSynchronousCommand> | |
| <RunSynchronousCommand wcm:action="add"> | |
| <Order>2</Order> | |
| <Path>powershell.exe -WindowStyle Normal -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\Specialize.ps1' -Raw | Invoke-Expression;"</Path> | |
| </RunSynchronousCommand> | |
| <RunSynchronousCommand wcm:action="add"> | |
| <Order>3</Order> | |
| <Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path> | |
| </RunSynchronousCommand> | |
| <RunSynchronousCommand wcm:action="add"> | |
| <Order>4</Order> | |
| <Path>powershell.exe -WindowStyle Normal -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\DefaultUser.ps1' -Raw | Invoke-Expression;"</Path> | |
| </RunSynchronousCommand> | |
| <RunSynchronousCommand wcm:action="add"> | |
| <Order>5</Order> | |
| <Path>reg.exe unload "HKU\DefaultUser"</Path> | |
| </RunSynchronousCommand> | |
| </RunSynchronous> | |
| </component> | |
| <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <TimeZone>Pacific Standard Time</TimeZone><!-- UTC -8. Change your own in settings. --> | |
| </component> | |
| </settings> | |
| <settings pass="auditSystem"/> | |
| <settings pass="auditUser"/> | |
| <settings pass="oobeSystem"> | |
| <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <InputLocale>0409:00000409</InputLocale> | |
| <SystemLocale>en-US</SystemLocale> | |
| <UILanguage>en-US</UILanguage> | |
| <UserLocale>en-US</UserLocale> | |
| </component> | |
| <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> | |
| <OOBE> | |
| <ProtectYourPC>3</ProtectYourPC> | |
| <HideEULAPage>true</HideEULAPage> | |
| <HideWirelessSetupInOOBE>false</HideWirelessSetupInOOBE> | |
| <HideOnlineAccountScreens>true</HideOnlineAccountScreens> | |
| </OOBE> | |
| </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'; $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; } }; $bytes = $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ); [System.IO.File]::WriteAllBytes( $path, $bytes ); } </ExtractScript> | |
| <File path="C:\Windows\Setup\Scripts\RemovePackages.ps1"> $selectors = @( 'Microsoft.Microsoft3DViewer'; 'Microsoft.BingSearch'; 'Microsoft.WindowsCamera'; 'Clipchamp.Clipchamp'; 'Microsoft.549981C3F5F10'; 'Microsoft.Windows.DevHome'; 'MicrosoftCorporationII.MicrosoftFamily'; 'Microsoft.WindowsFeedbackHub'; 'Microsoft.GetHelp'; 'Microsoft.Getstarted'; 'Microsoft.WindowsMaps'; 'Microsoft.MixedReality.Portal'; 'Microsoft.BingNews'; 'Microsoft.MicrosoftOfficeHub'; 'Microsoft.MSPaint'; 'Microsoft.People'; 'Microsoft.PowerAutomateDesktop'; 'MicrosoftCorporationII.QuickAssist'; 'Microsoft.SkypeApp'; 'Microsoft.MicrosoftSolitaireCollection'; 'MicrosoftTeams'; 'MSTeams'; 'Microsoft.Todos'; 'Microsoft.WindowsSoundRecorder'; 'Microsoft.Wallet'; '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'; & { $installed = & $getCommand; foreach( $selector in $selectors ) { $result = [ordered] @{ Selector = $selector; }; $found = $installed | Where-Object -FilterScript $filterCommand; if( $found ) { $result.Output = $found | & $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; } } *>&1 >> $logfile; </File> | |
| <File path="C:\Windows\Setup\Scripts\RemoveCapabilities.ps1"> $selectors = @( 'Print.Fax.Scan'; 'Language.Handwriting'; 'Browser.InternetExplorer'; 'MathRecognizer'; 'OpenSSH.Client'; 'App.Support.QuickAssist'; 'Language.Speech'; 'Language.TextToSpeech'; 'Microsoft.Windows.WordPad'; ); $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'; & { $installed = & $getCommand; foreach( $selector in $selectors ) { $result = [ordered] @{ Selector = $selector; }; $found = $installed | Where-Object -FilterScript $filterCommand; if( $found ) { $result.Output = $found | & $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; } } *>&1 >> $logfile; </File> | |
| <File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1"> $selectors = @( 'MicrosoftWindowsPowerShellV2Root'; 'Recall'; ); $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'; & { $installed = & $getCommand; foreach( $selector in $selectors ) { $result = [ordered] @{ Selector = $selector; }; $found = $installed | Where-Object -FilterScript $filterCommand; if( $found ) { $result.Output = $found | & $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; } } *>&1 >> $logfile; </File> | |
| <File path="C:\Windows\Setup\Scripts\TaskbarLayoutModification.xml"> <LayoutModificationTemplate xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" Version="1"> <CustomTaskbarLayoutCollection PinListPlacement="Replace"> <defaultlayout:TaskbarLayout> <taskbar:TaskbarPinList> <taskbar:DesktopApp DesktopApplicationLinkPath="#leaveempty" /> </taskbar:TaskbarPinList> </defaultlayout:TaskbarLayout> </CustomTaskbarLayoutCollection> </LayoutModificationTemplate> </File> | |
| <File path="C:\Windows\Setup\Scripts\UnlockStartLayout.vbs"> HKU = &H80000003 Set reg = GetObject("winmgmts://./root/default:StdRegProv") Set fso = CreateObject("Scripting.FileSystemObject") If reg.EnumKey(HKU, "", sids) = 0 Then If Not IsNull(sids) Then For Each sid In sids key = sid + "\Software\Policies\Microsoft\Windows\Explorer" name = "LockedStartLayout" If reg.GetDWORDValue(HKU, key, name, existing) = 0 Then reg.SetDWORDValue HKU, key, name, 0 End If Next End If End If </File> | |
| <File path="C:\Windows\Setup\Scripts\UnlockStartLayout.xml"> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <Triggers> <EventTrigger> <Enabled>true</Enabled> <Subscription><QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[Provider[@Name='UnattendGenerator'] and EventID=1]]</Select></Query></QueryList></Subscription> </EventTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-18</UserId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\Windows\System32\wscript.exe</Command> <Arguments>C:\Windows\Setup\Scripts\UnlockStartLayout.vbs</Arguments> </Exec> </Actions> </Task> </File> | |
| <File path="C:\Windows\Setup\Scripts\PauseWindowsUpdate.ps1"> $formatter = { $args[0].ToString( "yyyy'-'MM'-'dd'T'HH':'mm':'ssK" ); }; $now = [datetime]::UtcNow; $start = & $formatter $now; $end = & $formatter $now.AddDays( 7 ); $params = @{ LiteralPath = 'Registry::HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings'; Type = 'String'; Force = $true; }; Set-ItemProperty @params -Name 'PauseFeatureUpdatesStartTime' -Value $start; Set-ItemProperty @params -Name 'PauseFeatureUpdatesEndTime' -Value $end; Set-ItemProperty @params -Name 'PauseQualityUpdatesStartTime' -Value $start; Set-ItemProperty @params -Name 'PauseQualityUpdatesEndTime' -Value $end; Set-ItemProperty @params -Name 'PauseUpdatesStartTime' -Value $start; Set-ItemProperty @params -Name 'PauseUpdatesExpiryTime' -Value $end; </File> | |
| <File path="C:\Windows\Setup\Scripts\PauseWindowsUpdate.xml"> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <Triggers> <BootTrigger> <Repetition> <Interval>P1D</Interval> <StopAtDurationEnd>false</StopAtDurationEnd> </Repetition> <Enabled>true</Enabled> </BootTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-19</UserId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</Command> <Arguments>-Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\PauseWindowsUpdate.ps1' -Raw | Invoke-Expression;"</Arguments> </Exec> </Actions> </Task> </File> | |
| <File path="C:\Windows\Setup\Scripts\ShowAllTrayIcons.ps1"> if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) { # Windows 10 Set-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name 'EnableAutoTray' -Type 'DWord' -Value 0 -Force; } else { # Windows 11 Register-ScheduledTask -TaskName 'ShowAllTrayIcons' -Xml $( Get-Content -LiteralPath "C:\Windows\Setup\Scripts\ShowAllTrayIcons.xml" -Raw; ); } </File> | |
| <File path="C:\Windows\Setup\Scripts\ShowAllTrayIcons.xml"> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <Triggers> <LogonTrigger> <Repetition> <Interval>PT1M</Interval> <StopAtDurationEnd>false</StopAtDurationEnd> </Repetition> <Enabled>true</Enabled> </LogonTrigger> </Triggers> <Principals> <Principal id="Author"> <GroupId>S-1-5-32-545</GroupId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\Windows\System32\wscript.exe</Command> <Arguments>C:\Windows\Setup\Scripts\ShowAllTrayIcons.vbs</Arguments> </Exec> </Actions> </Task> </File> | |
| <File path="C:\Windows\Setup\Scripts\ShowAllTrayIcons.vbs"> HKCU = &H80000001 key = "Control Panel\NotifyIconSettings" Set reg = GetObject("winmgmts://./root/default:StdRegProv") If reg.EnumKey(HKCU, key, names) = 0 Then If Not IsNull(names) Then For Each name In names reg.SetDWORDValue HKCU, key + "\" + name, "IsPromoted", 1 Next End If End If </File> | |
| <File path="C:\Windows\Setup\Scripts\MoveActiveHours.vbs"> HKLM = &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"> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <Triggers> <BootTrigger> <Repetition> <Interval>PT4H</Interval> <StopAtDurationEnd>false</StopAtDurationEnd> </Repetition> <Enabled>true</Enabled> </BootTrigger> <RegistrationTrigger> <Repetition> <Interval>PT4H</Interval> <StopAtDurationEnd>false</StopAtDurationEnd> </Repetition> <Enabled>true</Enabled> </RegistrationTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-19</UserId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\Windows\System32\wscript.exe</Command> <Arguments>C:\Windows\Setup\Scripts\MoveActiveHours.vbs</Arguments> </Exec> </Actions> </Task> </File> | |
| <File path="C:\Windows\Setup\Scripts\SetStartPins.ps1"> $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"> <LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"> <LayoutOptions StartTileGroupCellWidth="6" /> <DefaultLayoutOverride> <StartLayoutCollection> <StartLayout GroupCellWidth="6" xmlns="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" /> </StartLayoutCollection> </DefaultLayoutOverride> </LayoutModificationTemplate> </File> | |
| <File path="C:\Windows\Setup\Scripts\Wdac.ps1"> Set-StrictMode -Version 'Latest'; $ErrorActionPreference = 'Stop'; $( try { $guid = '{d26bff32-33a2-48a3-b037-10357ee48427}'; $xml = "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\${guid}.xml"; $binary = "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\${guid}.cip"; Copy-Item -LiteralPath 'C:\Windows\schemas\CodeIntegrity\ExamplePolicies\DefaultWindows_Enforced.xml' -Destination $xml; Set-RuleOption -FilePath $xml -Option 0; Set-RuleOption -FilePath $xml -Option 6; Set-RuleOption -FilePath $xml -Option 9; Set-RuleOption -FilePath $xml -Option 16; Set-RuleOption -FilePath $xml -Option 18; Set-RuleOption -FilePath $xml -Option 5 -Delete; Set-RuleOption -FilePath $xml -Option 10; Merge-CIPolicy -PolicyPaths $xml -OutputFilePath $xml -Rules $( @( New-CIPolicyRule -FilePathRule 'C:\Windows\*'; New-CIPolicyRule -FilePathRule 'C:\Program Files\*'; New-CIPolicyRule -FilePathRule 'C:\Program Files (x86)\*'; New-CIPolicyRule -FilePathRule '%WINDIR%\debug\WIA\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\PLA\Reports\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\PLA\Rules\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\PLA\Templates\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\Registration\CRMLog\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\Com\dmp\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\FxsTmp\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\LogFiles\WMI\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\Microsoft\Crypto\RSA\MachineKeys\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\spool\drivers\color\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\spool\PRINTERS\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\spool\SERVERS\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\Tasks_Migrated\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\System32\Tasks\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\SysWOW64\Com\dmp\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\SysWOW64\FxsTmp\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\SysWOW64\Tasks\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\Tasks\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\Temp\*' -Deny; New-CIPolicyRule -FilePathRule '%WINDIR%\tracing\*' -Deny; ) | ForEach-Object -Process { $_; }; ); $doc = [xml]::new(); $doc.Load( $xml ); $nsmgr = [System.Xml.XmlNamespaceManager]::new( $doc.NameTable ); $nsmgr.AddNamespace( 'pol', 'urn:schemas-microsoft-com:sipolicy' ); $doc.SelectSingleNode( '/pol:SiPolicy/pol:PolicyID', $nsmgr ).InnerText = $guid; $doc.SelectSingleNode( '/pol:SiPolicy/pol:BasePolicyID', $nsmgr ).InnerText = $guid; $node = $doc.SelectSingleNode( '//pol:SigningScenario[@Value="12"]/pol:ProductSigners/pol:AllowedSigners', $nsmgr ); $node.ParentNode.RemoveChild( $node ); $doc.Save( $xml ); ConvertFrom-CIPolicy -XmlFilePath $xml -BinaryFilePath $binary; } catch { $_; } ) *>&1 | Out-File -Append -FilePath 'C:\Windows\Setup\Scripts\Wdac.log'; </File> | |
| <File path="C:\Windows\Setup\Scripts\unattend-01.ps1"> $params = @{ Path = 'Registry::HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'; }; New-Item @params -ErrorAction 'SilentlyContinue'; Set-ItemProperty @params -Name 'NoDriveAutoRun' -Type 'DWord' -Value $( ( 1 -shl 26 ) - 1; # 0x3FFFFFF ); Set-ItemProperty @params -Name 'NoDriveTypeAutoRun' -Type 'DWord' -Value $( ( 1 -shl 8 ) - 1; # 0xFF ); </File> | |
| <File path="C:\Windows\Setup\Scripts\unattend-02.reg"> Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Remote Assistance] "fAllowToGetHelp"=dword:00000000 </File> | |
| <File path="C:\Windows\Setup\Scripts\Specialize.ps1"> $scripts = @( { Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' -Force -ErrorAction 'SilentlyContinue'; }; { 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'; }; { reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f; }; { 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\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableCloudOptimizedContent" /t REG_DWORD /d 1 /f; [System.Diagnostics.EventLog]::CreateEventSource( 'UnattendGenerator', 'Application' ); }; { Register-ScheduledTask -TaskName 'UnlockStartLayout' -Xml $( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\UnlockStartLayout.xml' -Raw ); }; { Register-ScheduledTask -TaskName 'PauseWindowsUpdate' -Xml $( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\PauseWindowsUpdate.xml' -Raw ); }; { reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\CI\Policy" /v VerifiedAndReputablePolicyState /t REG_DWORD /d 0 /f; }; { reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v SmartScreenEnabled /t REG_SZ /d "Off" /f; reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components" /v ServiceEnabled /t REG_DWORD /d 0 /f; reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components" /v NotifyMalicious /t REG_DWORD /d 0 /f; reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components" /v NotifyPasswordReuse /t REG_DWORD /d 0 /f; reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WTDS\Components" /v NotifyUnsafeApp /t REG_DWORD /d 0 /f; reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v HideSystray /t REG_DWORD /d 1 /f; }; { reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f }; { icacls.exe C:\ /remove:g "*S-1-5-11" }; { auditpol.exe /set /subcategory:"{0CCE922B-69AE-11D9-BED3-505054503030}" /success:enable /failure:enable; }; { reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f; }; { Set-ExecutionPolicy -Scope 'LocalMachine' -ExecutionPolicy 'RemoteSigned' -Force; }; { fsutil.exe behavior set disableLastAccess 1; }; { 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\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f; }; { reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f; }; { reg.exe add "HKLM\Software\Policies\Microsoft\Edge" /v HideFirstRunExperience /t REG_DWORD /d 1 /f; }; { reg.exe add "HKLM\Software\Policies\Microsoft\Edge\Recommended" /v BackgroundModeEnabled /t REG_DWORD /d 0 /f; reg.exe add "HKLM\Software\Policies\Microsoft\Edge\Recommended" /v StartupBoostEnabled /t REG_DWORD /d 0 /f; }; { Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetStartPins.ps1' -Raw | Invoke-Expression; }; { reg.exe add "HKU\.DEFAULT\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 10 /f; }; { Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\Wdac.ps1' -Raw | Invoke-Expression; }; { Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\unattend-01.ps1' -Raw | Invoke-Expression; }; { reg.exe import "C:\Windows\Setup\Scripts\unattend-02.reg"; }; ); & { [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; '*** Will now execute command «{0}».' -f $( $str = $script.ToString().Trim() -replace '\s+', ' '; $max = 100; if( $str.Length -le $max ) { $str; } else { $str.Substring( 0, $max - 1 ) + '…'; } ); $start = [datetime]::Now; & $script; '*** Finished executing command after {0:0} ms.' -f [datetime]::Now.Subtract( $start ).TotalMilliseconds; "`r`n" * 3; $complete += $increment; } } *>&1 >> "C:\Windows\Setup\Scripts\Specialize.log"; </File> | |
| <File path="C:\Windows\Setup\Scripts\UserOnce.ps1"> $scripts = @( { Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage; }; { Set-WinHomeLocation -GeoId 39; }; { [System.Diagnostics.EventLog]::WriteEntry( 'UnattendGenerator', "User '$env:USERNAME' has requested to unlock the Start menu layout.", [System.Diagnostics.EventLogEntryType]::Information, 1 ); }; { $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 1; }; { New-Item -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Force; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{5399e694-6ce5-4d6c-8fce-1d8870fdcba0}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{b4bfcc3a-db2c-424c-b029-7fe99a87c641}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{a8cdff1c-4878-43be-b5fd-f8091c1c60d0}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{374de290-123f-4565-9164-39c4925e467b}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{f874310e-b6b7-47dc-bc84-b9e6b38f5903}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{1cf1260c-4dd0-4ebb-811f-33c572699fde}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{f02c1a0d-be21-4350-88b0-7367fc96ef3c}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{3add1653-eb32-4cb0-bbd7-dfa0abb5acca}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{645ff040-5081-101b-9f08-00aa002f954e}' -Value 0 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{20d04fe0-3aea-1069-a2d8-08002b30309d}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{a0953c92-50dc-43bf-be83-3742fed03c9c}' -Value 1 -Type 'DWord'; New-Item -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Force; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{5399e694-6ce5-4d6c-8fce-1d8870fdcba0}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{b4bfcc3a-db2c-424c-b029-7fe99a87c641}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{a8cdff1c-4878-43be-b5fd-f8091c1c60d0}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{374de290-123f-4565-9164-39c4925e467b}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{f874310e-b6b7-47dc-bc84-b9e6b38f5903}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{1cf1260c-4dd0-4ebb-811f-33c572699fde}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{f02c1a0d-be21-4350-88b0-7367fc96ef3c}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{3add1653-eb32-4cb0-bbd7-dfa0abb5acca}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{645ff040-5081-101b-9f08-00aa002f954e}' -Value 0 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{20d04fe0-3aea-1069-a2d8-08002b30309d}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -Value 1 -Type 'DWord'; Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{a0953c92-50dc-43bf-be83-3742fed03c9c}' -Value 1 -Type 'DWord'; }; { Get-Process -Name 'explorer' -ErrorAction 'SilentlyContinue' | Where-Object -FilterScript { $_.SessionId -eq ( Get-Process -Id $PID ).SessionId; } | Stop-Process -Force; }; ); & { [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; '*** Will now execute command «{0}».' -f $( $str = $script.ToString().Trim() -replace '\s+', ' '; $max = 100; if( $str.Length -le $max ) { $str; } else { $str.Substring( 0, $max - 1 ) + '…'; } ); $start = [datetime]::Now; & $script; '*** Finished executing command after {0:0} ms.' -f [datetime]::Now.Subtract( $start ).TotalMilliseconds; "`r`n" * 3; $complete += $increment; } } *>&1 >> "$env:TEMP\UserOnce.log"; </File> | |
| <File path="C:\Windows\Setup\Scripts\DefaultUser.ps1"> $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\Policies\Microsoft\Windows\Explorer" /v "StartLayoutFile" /t REG_SZ /d "C:\Windows\Setup\Scripts\TaskbarLayoutModification.xml" /f; reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\Explorer" /v "LockedStartLayout" /t REG_DWORD /d 1 /f; }; { 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 "Hidden" /t REG_DWORD /d 1 /f; }; { reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowSuperHidden" /t REG_DWORD /d 1 /f; }; { Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ShowAllTrayIcons.ps1' -Raw | Invoke-Expression; }; { reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowTaskViewButton /t REG_DWORD /d 0 /f; }; { reg.exe add "HKU\DefaultUser\Software\Microsoft\Edge\SmartScreenEnabled" /ve /t REG_DWORD /d 0 /f; reg.exe add "HKU\DefaultUser\Software\Microsoft\Edge\SmartScreenPuaEnabled" /ve /t REG_DWORD /d 0 /f; reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\AppHost" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f; reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\AppHost" /v PreventOverride /t REG_DWORD /d 0 /f; }; { $names = @( 'ContentDeliveryAllowed'; 'FeatureManagementEnabled'; 'OEMPreInstalledAppsEnabled'; 'PreInstalledAppsEnabled'; 'PreInstalledAppsEverEnabled'; 'SilentInstalledAppsEnabled'; 'SoftLandingEnabled'; 'SubscribedContentEnabled'; 'SubscribedContent-310093Enabled'; 'SubscribedContent-338387Enabled'; 'SubscribedContent-338388Enabled'; 'SubscribedContent-338389Enabled'; 'SubscribedContent-338393Enabled'; 'SubscribedContent-353698Enabled'; 'SystemPaneSuggestionsEnabled'; ); foreach( $name in $names ) { reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v $name /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; }; { $params = @{ LiteralPath = 'Registry::HKU\DefaultUser\Control Panel\Mouse'; Type = 'String'; Value = 0; Force = $true; }; Set-ItemProperty @params -Name 'MouseSpeed'; Set-ItemProperty @params -Name 'MouseThreshold1'; Set-ItemProperty @params -Name 'MouseThreshold2'; }; { reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\Explorer" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f; }; { reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings" /v TaskbarEndTask /t REG_DWORD /d 1 /f; }; { reg.exe add "HKU\DefaultUser\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 10 /f; }; { reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UnattendedSetup" /t REG_SZ /d "powershell.exe -WindowStyle Normal -NoProfile -Command \""Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\UserOnce.ps1' -Raw | Invoke-Expression;\""" /f; }; ); & { [float] $complete = 0; [float] $increment = 100 / $scripts.Count; foreach( $script in $scripts ) { Write-Progress -Activity 'Running scripts to modify the default user’’s registry hive. Do not close this window.' -PercentComplete $complete; '*** Will now execute command «{0}».' -f $( $str = $script.ToString().Trim() -replace '\s+', ' '; $max = 100; if( $str.Length -le $max ) { $str; } else { $str.Substring( 0, $max - 1 ) + '…'; } ); $start = [datetime]::Now; & $script; '*** Finished executing command after {0:0} ms.' -f [datetime]::Now.Subtract( $start ).TotalMilliseconds; "`r`n" * 3; $complete += $increment; } } *>&1 >> "C:\Windows\Setup\Scripts\DefaultUser.log"; </File> | |
| </Extensions> | |
| </unattend> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment