549 lines
No EOL
23 KiB
XML
549 lines
No EOL
23 KiB
XML
<?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=00000424&UseKeyboard2=true&Locale2=en-US&Keyboard2=00000409&GeoLocation=212&ProcessorArchitecture=amd64&BypassNetworkCheck=true&ComputerNameMode=Custom&ComputerName=ucilnica&CompactOsMode=Default&TimeZoneMode=Implicit&PartitionMode=Custom&DiskpartScript=REM&InstallToMode=Custom&InstallToDisk=0&InstallToPartition=3&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=education&InstallFromMode=Automatic&PEMode=Default&UserAccountMode=Unattended&AccountName0=local_admin&AccountDisplayName0=FRI+IT&AccountPassword0=6tfc5rdx&AccountGroup0=Administrators&AccountName1=Student&AccountDisplayName1=Student&AccountPassword1=vaje&AccountGroup1=Users&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&ShowFileExtensions=true&LaunchToThisPC=true&TaskbarSearch=Box&TaskbarIconsMode=Default&DisableWidgets=true&StartTilesMode=Default&StartPinsMode=Default&DisableFastStartup=true&EnableRemoteDesktop=true&HardenSystemDriveAcl=true&PreventDeviceEncryption=true&EffectsMode=Default&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&RemoveClock=true&RemoveCopilot=true&RemoveCortana=true&RemoveDevHome=true&RemoveFamily=true&RemoveFeedbackHub=true&RemoveGameAssist=true&RemoveHandwriting=true&RemoveInternetExplorer=true&RemoveMaps=true&RemoveMathInputPanel=true&RemoveMixedReality=true&RemoveNews=true&RemoveOffice365=true&RemoveOneSync=true&RemovePaint=true&RemovePhotos=true&RemovePowerAutomate=true&RemovePowerShellISE=true&RemoveQuickAssist=true&RemoveRecall=true&RemoveRdpClient=true&RemoveSkype=true&RemoveSolitaire=true&RemoveSpeech=true&RemoveStepsRecorder=true&RemoveStickyNotes=true&RemoveGetStarted=true&RemoveToDo=true&RemoveWallet=true&RemoveFaxAndScan=true&RemoveWindowsHello=true&RemoveWordPad=true&RemoveYourPhone=true&SystemScript0=Get-WindowsCapability+-Name+OpenSSH.Server*+-Online+%7C%0D%0A++++Add-WindowsCapability+-Online%0D%0A%0D%0A%24firewallParams+%3D+%40%7B%0D%0A++++Name++++++++%3D+%27sshd-Server-In-TCP%27%0D%0A++++DisplayName+%3D+%27Inbound+rule+for+OpenSSH+Server+%28sshd%29+on+TCP+port+22%27%0D%0A++++Action++++++%3D+%27Allow%27%0D%0A++++Direction+++%3D+%27Inbound%27%0D%0A++++Enabled+++++%3D+%27True%27++%23+This+is+not+a+boolean+but+an+enum%0D%0A++++Profile+++++%3D+%27Any%27%0D%0A++++Protocol++++%3D+%27TCP%27%0D%0A++++LocalPort+++%3D+22%0D%0A%7D%0D%0ANew-NetFirewallRule+%40firewallParams%0D%0A%0D%0A%24shellParams+%3D+%40%7B%0D%0A++++Path+++++++++%3D+%27HKLM%3A%5CSOFTWARE%5COpenSSH%27%0D%0A++++Name+++++++++%3D+%27DefaultShell%27%0D%0A++++Value++++++++%3D+%27C%3A%5CWindows%5CSystem32%5CWindowsPowerShell%5Cv1.0%5Cpowershell.exe%27%0D%0A++++PropertyType+%3D+%27String%27%0D%0A++++Force++++++++%3D+%24true%0D%0A%7D%0D%0ANew-ItemProperty+%40shellParams%0D%0A%0D%0A%23+Set+default+to+powershell.exe%0D%0A%24shellParams+%3D+%40%7B%0D%0A++++Path+++++++++%3D+%27HKLM%3A%5CSOFTWARE%5COpenSSH%27%0D%0A++++Name+++++++++%3D+%27DefaultShell%27%0D%0A++++Value++++++++%3D+%27C%3A%5CWindows%5CSystem32%5CWindowsPowerShell%5Cv1.0%5Cpowershell.exe%27%0D%0A++++PropertyType+%3D+%27String%27%0D%0A++++Force++++++++%3D+%24true%0D%0A%7D%0D%0ANew-ItemProperty+%40shellParams%0D%0A%0D%0A%23+Set+real-time+clock+to+UTC%0D%0A%24shellParams+%3D+%40%7B%0D%0A++++Path+%3D+%27HKLM%3A%5CSYSTEM%5CCurrentControlSet%5CControl%5CTimeZoneInformation%27%0D%0A++++Name+%3D+%27RealTimeIsUniversal%27%0D%0A++++Value+%3D+%271%27%0D%0A++++PropertyType+%3D+%27DWord%27%0D%0A%7D%0D%0ANew-ItemProperty+%40shellParams%0D%0A%0D%0A%0D%0ASet-Service+-Name+sshd+-StartupType+Automatic+-Status+Running&SystemScriptType0=Ps1&WdacMode=Skip-->
|
|
<settings pass="offlineServicing"></settings>
|
|
<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:00000424;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>
|
|
<InstallTo>
|
|
<DiskID>0</DiskID>
|
|
<PartitionID>3</PartitionID>
|
|
</InstallTo>
|
|
</OSImage>
|
|
</ImageInstall>
|
|
<UserData>
|
|
<ProductKey>
|
|
<Key>YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY</Key>
|
|
<WillShowUI>OnError</WillShowUI>
|
|
</ProductKey>
|
|
<AcceptEula>true</AcceptEula>
|
|
</UserData>
|
|
<UseConfigurationSet>false</UseConfigurationSet>
|
|
<RunSynchronous>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>1</Order>
|
|
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo:REM)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>2</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>
|
|
</RunSynchronous>
|
|
</component>
|
|
</settings>
|
|
<settings pass="generalize"></settings>
|
|
<settings pass="specialize">
|
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
<ComputerName>ucilnica</ComputerName>
|
|
</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:00000424;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">
|
|
<UserAccounts>
|
|
<LocalAccounts>
|
|
<LocalAccount wcm:action="add">
|
|
<Name>local_admin</Name>
|
|
<DisplayName>FRI IT</DisplayName>
|
|
<Group>Administrators</Group>
|
|
<Password>
|
|
<Value>6tfc5rdx</Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</LocalAccount>
|
|
<LocalAccount wcm:action="add">
|
|
<Name>Student</Name>
|
|
<DisplayName>Student</DisplayName>
|
|
<Group>Users</Group>
|
|
<Password>
|
|
<Value>vaje</Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</LocalAccount>
|
|
</LocalAccounts>
|
|
</UserAccounts>
|
|
<AutoLogon>
|
|
<Username>local_admin</Username>
|
|
<Enabled>true</Enabled>
|
|
<LogonCount>1</LogonCount>
|
|
<Password>
|
|
<Value>6tfc5rdx</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 -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.Microsoft3DViewer';
|
|
'Microsoft.BingSearch';
|
|
'Microsoft.WindowsCalculator';
|
|
'Microsoft.WindowsCamera';
|
|
'Microsoft.WindowsAlarms';
|
|
'Microsoft.549981C3F5F10';
|
|
'Microsoft.Windows.DevHome';
|
|
'MicrosoftCorporationII.MicrosoftFamily';
|
|
'Microsoft.WindowsFeedbackHub';
|
|
'Microsoft.Edge.GameAssist';
|
|
'Microsoft.Getstarted';
|
|
'Microsoft.WindowsMaps';
|
|
'Microsoft.MixedReality.Portal';
|
|
'Microsoft.BingNews';
|
|
'Microsoft.MicrosoftOfficeHub';
|
|
'Microsoft.Paint';
|
|
'Microsoft.Windows.Photos';
|
|
'Microsoft.PowerAutomateDesktop';
|
|
'MicrosoftCorporationII.QuickAssist';
|
|
'Microsoft.SkypeApp';
|
|
'Microsoft.MicrosoftSolitaireCollection';
|
|
'Microsoft.MicrosoftStickyNotes';
|
|
'Microsoft.Todos';
|
|
'Microsoft.Wallet';
|
|
'Microsoft.YourPhone';
|
|
);
|
|
$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';
|
|
'OneCoreUAP.OneSync';
|
|
'Microsoft.Windows.MSPaint';
|
|
'Microsoft.Windows.PowerShell.ISE';
|
|
'App.Support.QuickAssist';
|
|
'Language.Speech';
|
|
'Language.TextToSpeech';
|
|
'App.StepsRecorder';
|
|
'Hello.Face.18967';
|
|
'Hello.Face.Migration.18967';
|
|
'Hello.Face.20134';
|
|
'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 = @(
|
|
'Microsoft-RemoteDesktopConnection';
|
|
'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\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 >> 'C:\Windows\Setup\Scripts\VirtIoGuestTools.log';
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\unattend-01.ps1">
|
|
Get-WindowsCapability -Name OpenSSH.Server* -Online |
|
|
Add-WindowsCapability -Online
|
|
|
|
$firewallParams = @{
|
|
Name = 'sshd-Server-In-TCP'
|
|
DisplayName = 'Inbound rule for OpenSSH Server (sshd) on TCP port 22'
|
|
Action = 'Allow'
|
|
Direction = 'Inbound'
|
|
Enabled = 'True' # This is not a boolean but an enum
|
|
Profile = 'Any'
|
|
Protocol = 'TCP'
|
|
LocalPort = 22
|
|
}
|
|
New-NetFirewallRule @firewallParams
|
|
|
|
$shellParams = @{
|
|
Path = 'HKLM:\SOFTWARE\OpenSSH'
|
|
Name = 'DefaultShell'
|
|
Value = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
|
|
PropertyType = 'String'
|
|
Force = $true
|
|
}
|
|
New-ItemProperty @shellParams
|
|
|
|
# Set default to powershell.exe
|
|
$shellParams = @{
|
|
Path = 'HKLM:\SOFTWARE\OpenSSH'
|
|
Name = 'DefaultShell'
|
|
Value = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
|
|
PropertyType = 'String'
|
|
Force = $true
|
|
}
|
|
New-ItemProperty @shellParams
|
|
|
|
# Set real-time clock to UTC
|
|
$shellParams = @{
|
|
Path = 'HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
|
|
Name = 'RealTimeIsUniversal'
|
|
Value = '1'
|
|
PropertyType = 'DWord'
|
|
}
|
|
New-ItemProperty @shellParams
|
|
|
|
|
|
Set-Service -Name sshd -StartupType Automatic -Status Running
|
|
</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;
|
|
};
|
|
{
|
|
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemovePackages.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveCapabilities.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveFeatures.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
{
|
|
net.exe accounts /maxpwage:UNLIMITED;
|
|
};
|
|
{
|
|
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;
|
|
};
|
|
{
|
|
icacls.exe C:\ /remove:g "*S-1-5-11"
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f;
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\unattend-01.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
);
|
|
|
|
& {
|
|
[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 = @(
|
|
{
|
|
Set-WinHomeLocation -GeoId 212;
|
|
};
|
|
{
|
|
Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;
|
|
};
|
|
{
|
|
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'LaunchTo' -Type 'DWord' -Value 1;
|
|
};
|
|
);
|
|
|
|
& {
|
|
[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;
|
|
};
|
|
{
|
|
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\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>
|
|
<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;
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\VirtIoGuestTools.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
);
|
|
|
|
& {
|
|
[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 >> "C:\Windows\Setup\Scripts\FirstLogon.log";
|
|
</File>
|
|
</Extensions>
|
|
</unattend> |