Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
- <!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=en-US&Locale=en-US&Keyboard=00000409&GeoLocation=244&ProcessorArchitecture=amd64&BypassNetworkCheck=true&ComputerNameMode=Custom&ComputerName=Zeus&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=AUS+Eastern+Standard+Time&PartitionMode=Interactive&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=pro&InstallFromMode=Automatic&PEMode=Default&UserAccountMode=InteractiveLocal&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&ShowFileExtensions=true&ClassicContextMenu=true&LaunchToThisPC=true&ShowEndTask=true&TaskbarSearch=Box&TaskbarIconsMode=Default&DisableWidgets=true&LeftTaskbar=true&ShowAllTrayIcons=true&DisableBingResults=true&StartTilesMode=Default&StartPinsMode=Empty&HardenSystemDriveAcl=true&PreventAutomaticReboot=true&DisableEdgeStartupBoost=true&DeleteWindowsOld=true&EffectsMode=Performance&DesktopIconsMode=Default&StartFoldersMode=Default&WifiMode=Interactive&ExpressSettings=DisableAll&LockKeysMode=Skip&StickyKeysMode=Disabled&ColorMode=Default&WallpaperMode=Solid&WallpaperColor=%23008080&LockScreenMode=Default&RemoveBingSearch=true&RemoveXboxApps=true&WdacMode=Skip-->
- <settings pass="offlineServicing"></settings>
- <settings pass="windowsPE">
- <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
- <UILanguage>en-US</UILanguage>
- </component>
- <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
- <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>
- <settings pass="specialize">
- <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
- <ComputerName>Zeus</ComputerName>
- <TimeZone>AUS Eastern Standard Time</TimeZone>
- </component>
- <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>
- </settings>
- <settings pass="auditSystem"></settings>
- <settings pass="auditUser"></settings>
- <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>
- <FirstLogonCommands>
- <SynchronousCommand wcm:action="add">
- <Order>1</Order>
- <CommandLine>powershell.exe -WindowStyle Normal -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';
- $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.BingSearch';
- 'Microsoft.Xbox.TCUI';
- 'Microsoft.XboxApp';
- 'Microsoft.XboxGameOverlay';
- 'Microsoft.XboxGamingOverlay';
- 'Microsoft.XboxIdentityProvider';
- 'Microsoft.XboxSpeechToTextOverlay';
- 'Microsoft.GamingApp';
- );
- $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 | Out-String >> $logfile;
- </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:\Windows\Setup\Scripts\SetWallpaper.ps1">
- Add-Type -TypeDefinition '
- using System.Drawing;
- using System.Runtime.InteropServices;
- public static class WallpaperSetter {
- [DllImport("user32.dll")]
- private static extern bool SetSysColors(
- int cElements,
- int[] lpaElements,
- int[] lpaRgbValues
- );
- [DllImport("user32.dll")]
- private static extern bool SystemParametersInfo(
- uint uiAction,
- uint uiParam,
- string pvParam,
- uint fWinIni
- );
- public static void SetDesktopBackground(Color color) {
- SystemParametersInfo(20, 0, "", 0);
- SetSysColors(1, new int[] { 1 }, new int[] { ColorTranslator.ToWin32(color) });
- }
- public static void SetDesktopImage(string file) {
- SystemParametersInfo(20, 0, file, 0);
- }
- }
- ' -ReferencedAssemblies 'System.Drawing';
- function Set-WallpaperColor {
- param(
- [string]
- $HtmlColor
- );
- $color = [System.Drawing.ColorTranslator]::FromHtml( $HtmlColor );
- [WallpaperSetter]::SetDesktopBackground( $color );
- Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 1 -Force;
- Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value '' -Force;
- Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Colors' -Name 'Background' -Type 'String' -Value "$($color.R) $($color.G) $($color.B)" -Force;
- }
- function Set-WallpaperImage {
- param(
- [string]
- $LiteralPath
- );
- if( $LiteralPath | Test-Path ) {
- [WallpaperSetter]::SetDesktopImage( $LiteralPath );
- Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 0 -Force;
- Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value $LiteralPath -Force;
- } else {
- "Cannot use '$LiteralPath' as a desktop wallpaper because that file does not exist.";
- }
- }
- Set-WallpaperColor -HtmlColor '#008080';
- </File>
- <File path="C:\Windows\Setup\Scripts\Specialize.ps1">
- $scripts = @(
- {
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f;
- };
- {
- Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemovePackages.ps1' -Raw | Invoke-Expression;
- };
- {
- net.exe accounts /maxpwage:UNLIMITED;
- };
- {
- icacls.exe C:\ /remove:g "*S-1-5-11"
- };
- {
- 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\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /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;
- };
- {
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ControlAnimations" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\AnimateMinMax" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\TaskbarAnimations" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMAeroPeekEnabled" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\MenuAnimation" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\TooltipAnimation" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\SelectionFade" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMSaveThumbnailEnabled" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\CursorShadow" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewShadow" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ThumbnailsOrIcon" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewAlphaSelect" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DragFullWindows" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ComboBoxAnimation" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\FontSmoothing" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListBoxSmoothScrolling" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- Set-ItemProperty -LiteralPath "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DropShadow" -Name 'DefaultValue' -Value 0 -Type 'DWord' -Force;
- };
- {
- reg.exe add "HKU\.DEFAULT\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 10 /f;
- };
- );
- & {
- [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 | Out-String >> "C:\Windows\Setup\Scripts\Specialize.log";
- </File>
- <File path="C:\Windows\Setup\Scripts\UserOnce.ps1">
- $scripts = @(
- {
- reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f;
- };
- {
- Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'LaunchTo' -Type 'DWord' -Value 1;
- };
- {
- Set-ItemProperty -LiteralPath 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Type 'DWord' -Value 2 -Force;
- };
- {
- Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetWallpaper.ps1' -Raw | Invoke-Expression;
- };
- {
- 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 | Out-String >> "$env:TEMP\UserOnce.log";
- </File>
- <File path="C:\Windows\Setup\Scripts\DefaultUser.ps1">
- $scripts = @(
- {
- reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled /t REG_DWORD /d 0 /f;
- };
- {
- reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /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 TaskbarAl /t REG_DWORD /d 0 /f;
- };
- {
- 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 | Out-String >> "C:\Windows\Setup\Scripts\DefaultUser.log";
- </File>
- <File path="C:\Windows\Setup\Scripts\FirstLogon.ps1">
- $scripts = @(
- {
- cmd.exe /c "rmdir C:\Windows.old";
- };
- {
- Remove-Item -LiteralPath @(
- 'C:\Windows\Panther\unattend.xml';
- 'C:\Windows\Panther\unattend-original.xml';
- 'C:\Windows\Setup\Scripts\Wifi.xml';
- ) -Force -ErrorAction 'SilentlyContinue' -Verbose;
- };
- );
- & {
- [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;
- '*** 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 | Out-String >> "C:\Windows\Setup\Scripts\FirstLogon.log";
- </File>
- </Extensions>
- </unattend>
Advertisement