691 lines
33 KiB
HCL
691 lines
33 KiB
HCL
<?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=fr-FR&Locale=fr-FR&Keyboard=0000040c&UseKeyboard2=true&Locale2=en-US&Keyboard2=00000409&GeoLocation=84&ProcessorArchitecture=amd64&BypassRequirementsCheck=true&ComputerNameMode=Random&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=Romance+Standard+Time&PartitionMode=Unattended&PartitionLayout=GPT&EspSize=300&RecoveryMode=None&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=pro&InstallFromMode=Automatic&PEMode=Default&UserAccountMode=Unattended&AccountName0=Admin&AccountDisplayName0=&AccountPassword0=&AccountGroup0=Administrators&AccountName1=Installer&AccountDisplayName1=Installer&AccountPassword1=Stid_2026-03&AccountGroup1=Users&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&ShowFileExtensions=true&ClassicContextMenu=true&TaskbarSearch=Box&TaskbarIconsMode=Default&DisableWidgets=true&StartTilesMode=Default&StartPinsMode=Empty&DisableDefender=true&DisableUac=true&DisableSystemRestore=true&EnableRemoteDesktop=true&AllowPowerShellScripts=true&TurnOffSystemSounds=true&DisableAppSuggestions=true&PreventDeviceEncryption=true&HideEdgeFre=true&DisableEdgeStartupBoost=true&EffectsMode=Performance&DesktopIconsMode=Default&StartFoldersMode=Default&VirtIoGuestTools=true&WifiMode=Skip&ExpressSettings=DisableAll&LockKeysMode=Skip&StickyKeysMode=Default&ColorMode=Default&WallpaperMode=Default&LockScreenMode=Default&Remove3DViewer=true&RemoveBingSearch=true&RemoveCalculator=true&RemoveCamera=true&RemoveClipchamp=true&RemoveCopilot=true&RemoveCortana=true&RemoveDevHome=true&RemoveWindowsHello=true&RemoveFamily=true&RemoveFeedbackHub=true&RemoveGameAssist=true&RemoveGetHelp=true&RemoveHandwriting=true&RemoveInternetExplorer=true&RemoveMailCalendar=true&RemoveMaps=true&RemoveMathInputPanel=true&RemoveMediaFeatures=true&RemoveStore=true&RemoveMixedReality=true&RemoveZuneVideo=true&RemoveNews=true&RemoveOffice365=true&RemoveOneDrive=true&RemoveOneNote=true&RemoveOneSync=true&RemoveOpenSSHClient=true&RemoveOutlook=true&RemovePaint=true&RemovePaint3D=true&RemovePeople=true&RemovePhotos=true&RemovePowerAutomate=true&RemoveQuickAssist=true&RemoveRecall=true&RemoveRdpClient=true&RemoveSkype=true&RemoveSnippingTool=true&RemoveSolitaire=true&RemoveSpeech=true&RemoveStepsRecorder=true&RemoveStickyNotes=true&RemoveTeams=true&RemoveGetStarted=true&RemoveToDo=true&RemoveVoiceRecorder=true&RemoveWallet=true&RemoveWeather=true&RemoveFaxAndScan=true&RemoveWindowsMediaPlayer=true&RemoveZuneMusic=true&RemoveWordPad=true&RemoveXboxApps=true&RemoveYourPhone=true&WdacMode=Skip&AppLockerMode=Skip-->
|
|
<settings pass="offlineServicing"></settings>
|
|
<settings pass="windowsPE">
|
|
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
<UILanguage>fr-FR</UILanguage>
|
|
</component>
|
|
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
<ImageInstall>
|
|
<OSImage>
|
|
<InstallTo>
|
|
<DiskID>0</DiskID>
|
|
<PartitionID>3</PartitionID>
|
|
</InstallTo>
|
|
</OSImage>
|
|
</ImageInstall>
|
|
<UserData>
|
|
<ProductKey>
|
|
<Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
|
|
<WillShowUI>OnError</WillShowUI>
|
|
</ProductKey>
|
|
<AcceptEula>true</AcceptEula>
|
|
</UserData>
|
|
<UseConfigurationSet>false</UseConfigurationSet>
|
|
<RunSynchronous>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>1</Order>
|
|
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>2</Order>
|
|
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>3</Order>
|
|
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>4</Order>
|
|
<Path>cmd.exe /c >>X:\diskpart.txt (echo:SELECT DISK=0&echo:CLEAN&echo:CONVERT GPT&echo:CREATE PARTITION EFI SIZE=300&echo:FORMAT QUICK FS=FAT32 LABEL=^"System^"&echo:ASSIGN LETTER=S&echo:CREATE PARTITION MSR SIZE=16&echo:CREATE PARTITION PRIMARY)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>5</Order>
|
|
<Path>cmd.exe /c >>X:\diskpart.txt (echo:FORMAT QUICK FS=NTFS LABEL=^"Windows^"&echo:ASSIGN LETTER=W)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>6</Order>
|
|
<Path>cmd.exe /c "diskpart.exe /s "X:\diskpart.txt" >>"X:\diskpart.log" || ( type "X:\diskpart.log" & echo diskpart encountered an error. & pause & exit /b 1 )"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>7</Order>
|
|
<Path>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^"^))</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>8</Order>
|
|
<Path>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^"^))</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>9</Order>
|
|
<Path>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&echo:Execute = exec.ExitCode&echo:End Function)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>10</Order>
|
|
<Path>cmd.exe /c >>X:\defender.vbs (echo:Function FindHiveFiles&echo:Set FindHiveFiles = CreateObject(^"Scripting.Dictionary^"^)&echo:For Each drive In fso.Drives&echo:If drive.IsReady And drive.DriveLetter ^<^> ^"X^" Then)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>11</Order>
|
|
<Path>cmd.exe /c >>X:\defender.vbs (echo:For Each folder In Array(^"$Windows.~BT\NewOS\Windows^", ^"Windows^"^)&echo:file = fso.BuildPath(fso.BuildPath(drive.RootFolder, folder^), ^"System32\config\SYSTEM^"^))</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>12</Order>
|
|
<Path>cmd.exe /c >>X:\defender.vbs (echo:If fso.FileExists(file^) And fso.FileExists(file + ^".LOG1^"^) And fso.FileExists(file + ^".LOG2^"^) Then&echo:FindHiveFiles.Add file, Nothing&echo:End If&echo:Next&echo:End If&echo:Next&echo:End Function)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>13</Order>
|
|
<Path>cmd.exe /c >>X:\defender.vbs (echo:For Each file In FindHiveFiles&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)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>14</Order>
|
|
<Path>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^)&echo:Wend)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>15</Order>
|
|
<Path>cmd.exe /c >>X:\defender.vbs (echo:For Each service In Array(^"Sense^", ^"WdBoot^", ^"WdFilter^", ^"WdNisDrv^", ^"WdNisSvc^", ^"WinDefend^"^))</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>16</Order>
|
|
<Path>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^"^))</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>17</Order>
|
|
<Path>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&echo:WScript.Sleep 1000&echo:Next&echo:Loop)</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>18</Order>
|
|
<Path>cmd.exe /c "start /MIN cscript.exe //E:vbscript X:\defender.vbs"</Path>
|
|
</RunSynchronousCommand>
|
|
</RunSynchronous>
|
|
</component>
|
|
</settings>
|
|
<settings pass="generalize"></settings>
|
|
<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" -ExecutionPolicy "Unrestricted" -NoProfile -File "C:\Windows\Setup\Scripts\Specialize.ps1"</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" -ExecutionPolicy "Unrestricted" -NoProfile -File "C:\Windows\Setup\Scripts\DefaultUser.ps1"</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>Romance Standard Time</TimeZone>
|
|
</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>040c:0000040c;0409:00000409</InputLocale>
|
|
<SystemLocale>fr-FR</SystemLocale>
|
|
<UILanguage>fr-FR</UILanguage>
|
|
<UserLocale>fr-FR</UserLocale>
|
|
</component>
|
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
<UserAccounts>
|
|
<LocalAccounts>
|
|
<LocalAccount wcm:action="add">
|
|
<Name>Admin</Name>
|
|
<DisplayName></DisplayName>
|
|
<Group>Administrators</Group>
|
|
<Password>
|
|
<Value></Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</LocalAccount>
|
|
<LocalAccount wcm:action="add">
|
|
<Name>Installer</Name>
|
|
<DisplayName>Installer</DisplayName>
|
|
<Group>Users</Group>
|
|
<Password>
|
|
<Value>Stid_2026-03</Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</LocalAccount>
|
|
</LocalAccounts>
|
|
</UserAccounts>
|
|
<AutoLogon>
|
|
<Username>Admin</Username>
|
|
<Enabled>true</Enabled>
|
|
<LogonCount>1</LogonCount>
|
|
<Password>
|
|
<Value></Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</AutoLogon>
|
|
<OOBE>
|
|
<ProtectYourPC>3</ProtectYourPC>
|
|
<HideEULAPage>true</HideEULAPage>
|
|
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
|
<HideOnlineAccountScreens>false</HideOnlineAccountScreens>
|
|
</OOBE>
|
|
<FirstLogonCommands>
|
|
<SynchronousCommand wcm:action="add">
|
|
<Order>1</Order>
|
|
<CommandLine>powershell.exe -WindowStyle "Normal" -ExecutionPolicy "Unrestricted" -NoProfile -File "C:\Windows\Setup\Scripts\FirstLogon.ps1"</CommandLine>
|
|
</SynchronousCommand>
|
|
</FirstLogonCommands>
|
|
</component>
|
|
</settings>
|
|
<Extensions xmlns="https://schneegans.de/windows/unattend-generator/">
|
|
<Build>
|
|
<Commit>
|
|
<Hash>b5944ad0b8d26588e78d963562e0f80ee2e33aeb</Hash>
|
|
<GitHubUrl>https://github.com/cschneegans/unattend-generator/commit/b5944ad0b8d26588e78d963562e0f80ee2e33aeb</GitHubUrl>
|
|
</Commit>
|
|
</Build>
|
|
<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.WindowsCalculator';
|
|
'Microsoft.WindowsCamera';
|
|
'Clipchamp.Clipchamp';
|
|
'Microsoft.Copilot';
|
|
'Microsoft.549981C3F5F10';
|
|
'Microsoft.Windows.DevHome';
|
|
'MicrosoftCorporationII.MicrosoftFamily';
|
|
'Microsoft.WindowsFeedbackHub';
|
|
'Microsoft.Edge.GameAssist';
|
|
'Microsoft.GetHelp';
|
|
'Microsoft.Getstarted';
|
|
'microsoft.windowscommunicationsapps';
|
|
'Microsoft.WindowsMaps';
|
|
'Microsoft.MixedReality.Portal';
|
|
'Microsoft.BingNews';
|
|
'Microsoft.MicrosoftOfficeHub';
|
|
'Microsoft.Office.OneNote';
|
|
'Microsoft.OutlookForWindows';
|
|
'Microsoft.Paint';
|
|
'Microsoft.MSPaint';
|
|
'Microsoft.People';
|
|
'Microsoft.Windows.Photos';
|
|
'Microsoft.PowerAutomateDesktop';
|
|
'MicrosoftCorporationII.QuickAssist';
|
|
'Microsoft.SkypeApp';
|
|
'Microsoft.ScreenSketch';
|
|
'Microsoft.MicrosoftSolitaireCollection';
|
|
'Microsoft.MicrosoftStickyNotes';
|
|
'Microsoft.WindowsStore';
|
|
'Microsoft.StorePurchaseApp';
|
|
'MicrosoftTeams';
|
|
'MSTeams';
|
|
'Microsoft.Todos';
|
|
'Microsoft.WindowsSoundRecorder';
|
|
'Microsoft.Wallet';
|
|
'Microsoft.BingWeather';
|
|
'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';
|
|
& {
|
|
$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 -Width 1KB -Stream >> $logfile;
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\RemoveCapabilities.ps1">
|
|
$selectors = @(
|
|
'Print.Fax.Scan';
|
|
'Language.Handwriting';
|
|
'Browser.InternetExplorer';
|
|
'MathRecognizer';
|
|
'OneCoreUAP.OneSync';
|
|
'OpenSSH.Client';
|
|
'Microsoft.Windows.MSPaint';
|
|
'App.Support.QuickAssist';
|
|
'Microsoft.Windows.SnippingTool';
|
|
'Language.Speech';
|
|
'Language.TextToSpeech';
|
|
'App.StepsRecorder';
|
|
'Hello.Face.18967';
|
|
'Hello.Face.Migration.18967';
|
|
'Hello.Face.20134';
|
|
'Media.WindowsMediaPlayer';
|
|
'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 | Out-String -Width 1KB -Stream >> $logfile;
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1">
|
|
$selectors = @(
|
|
'MediaPlayback';
|
|
'Microsoft-RemoteDesktopConnection';
|
|
'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';
|
|
& {
|
|
$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 -Width 1KB -Stream >> $logfile;
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\TurnOffSystemSounds.ps1">
|
|
$excludes = Get-ChildItem -LiteralPath 'Registry::HKU\DefaultUser\AppEvents\EventLabels' |
|
|
Where-Object -FilterScript { ($_ | Get-ItemProperty).ExcludeFromCPL -eq 1; } |
|
|
Select-Object -ExpandProperty 'PSChildName';
|
|
Get-ChildItem -Path 'Registry::HKU\DefaultUser\AppEvents\Schemes\Apps\*\*' |
|
|
Where-Object -Property 'PSChildName' -NotIn $excludes |
|
|
Get-ChildItem -Include '.Current' | Set-ItemProperty -Name '(Default)' -Value '';
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\VirtIoGuestTools.ps1">
|
|
& {
|
|
foreach( $letter in 'DEFGHIJKLMNOPQRSTUVWXYZ'.ToCharArray() ) {
|
|
$exe = "${letter}:\virtio-win-guest-tools.exe";
|
|
if( Test-Path -LiteralPath $exe ) {
|
|
Start-Process -FilePath $exe -ArgumentList '/passive', '/norestart' -Wait;
|
|
return;
|
|
}
|
|
}
|
|
'VirtIO Guest Tools image (virtio-win-*.iso) is not attached to this VM.';
|
|
} *>&1 | Out-String -Width 1KB -Stream >> 'C:\Windows\Setup\Scripts\VirtIoGuestTools.log';
|
|
</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\Specialize.ps1">
|
|
$scripts = @(
|
|
{
|
|
reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f;
|
|
};
|
|
{
|
|
ReAgentc.exe /disable;
|
|
Remove-Item -LiteralPath 'C:\Windows\System32\Recovery\Winre.wim' -Force -ErrorAction 'SilentlyContinue';
|
|
};
|
|
{
|
|
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';
|
|
};
|
|
{
|
|
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\RemovePackages.ps1';
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\RemoveCapabilities.ps1';
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\RemoveFeatures.ps1';
|
|
};
|
|
{
|
|
net.exe accounts /maxpwage:UNLIMITED;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications" /v DisableNotifications /t REG_DWORD /d 1 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /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;
|
|
};
|
|
{
|
|
Set-ExecutionPolicy -Scope 'LocalMachine' -ExecutionPolicy 'RemoteSigned' -Force;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" /v DisableStartupSound /t REG_DWORD /d 1 /f;
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EditionOverrides" /v UserSetting_DisableStartupSound /t REG_DWORD /d 1 /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;
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\SetStartPins.ps1';
|
|
};
|
|
{
|
|
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;
|
|
};
|
|
);
|
|
|
|
& {
|
|
[float] $complete = 0;
|
|
[float] $increment = 100 / $scripts.Count;
|
|
foreach( $script in $scripts ) {
|
|
Write-Progress -Id 0 -Activity 'Running scripts to customize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
'*** Will now execute command «{0}».' -f $(
|
|
$script.ToString().Trim() -replace '\s+', ' ' -replace '^(.{99})(.+)$', '$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 -Width 1KB -Stream >> "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-ItemProperty -LiteralPath 'Registry::HKCU\AppEvents\Schemes' -Name '(Default)' -Type 'String' -Value '.None';
|
|
};
|
|
{
|
|
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f;
|
|
};
|
|
{
|
|
Set-ItemProperty -LiteralPath 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Type 'DWord' -Value 2 -Force;
|
|
};
|
|
{
|
|
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 -Id 0 -Activity 'Running scripts to configure this user account. Do not close this window.' -PercentComplete $complete;
|
|
'*** Will now execute command «{0}».' -f $(
|
|
$script.ToString().Trim() -replace '\s+', ' ' -replace '^(.{99})(.+)$', '$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 -Width 1KB -Stream >> "$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;
|
|
};
|
|
{
|
|
reg.exe add "HKU\DefaultUser\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /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\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;
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\TurnOffSystemSounds.ps1';
|
|
};
|
|
{
|
|
$names = @(
|
|
'ContentDeliveryAllowed';
|
|
'FeatureManagementEnabled';
|
|
'OEMPreInstalledAppsEnabled';
|
|
'PreInstalledAppsEnabled';
|
|
'PreInstalledAppsEverEnabled';
|
|
'SilentInstalledAppsEnabled';
|
|
'SoftLandingEnabled';
|
|
'SubscribedContentEnabled';
|
|
'SubscribedContent-310093Enabled';
|
|
'SubscribedContent-338387Enabled';
|
|
'SubscribedContent-338388Enabled';
|
|
'SubscribedContent-338389Enabled';
|
|
'SubscribedContent-338393Enabled';
|
|
'SubscribedContent-353694Enabled';
|
|
'SubscribedContent-353696Enabled';
|
|
'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\RunOnce" /v "UnattendedSetup" /t REG_SZ /d "powershell.exe -WindowStyle \""Normal\"" -ExecutionPolicy \""Unrestricted\"" -NoProfile -File \""C:\Windows\Setup\Scripts\UserOnce.ps1\""" /f;
|
|
};
|
|
);
|
|
|
|
& {
|
|
[float] $complete = 0;
|
|
[float] $increment = 100 / $scripts.Count;
|
|
foreach( $script in $scripts ) {
|
|
Write-Progress -Id 0 -Activity 'Running scripts to modify the default user’’s registry hive. Do not close this window.' -PercentComplete $complete;
|
|
'*** Will now execute command «{0}».' -f $(
|
|
$script.ToString().Trim() -replace '\s+', ' ' -replace '^(.{99})(.+)$', '$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 -Width 1KB -Stream >> "C:\Windows\Setup\Scripts\DefaultUser.log";
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\FirstLogon.ps1">
|
|
$scripts = @(
|
|
{
|
|
Set-ItemProperty -LiteralPath 'Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoLogonCount' -Type 'DWord' -Force -Value 0;
|
|
};
|
|
{
|
|
Disable-ComputerRestore -Drive 'C:\';
|
|
};
|
|
{
|
|
& 'C:\Windows\Setup\Scripts\VirtIoGuestTools.ps1';
|
|
};
|
|
{
|
|
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 -Id 0 -Activity 'Running scripts to finalize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
'*** Will now execute command «{0}».' -f $(
|
|
$script.ToString().Trim() -replace '\s+', ' ' -replace '^(.{99})(.+)$', '$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 -Width 1KB -Stream >> "C:\Windows\Setup\Scripts\FirstLogon.log";
|
|
</File>
|
|
</Extensions>
|
|
</unattend>
|