986 lines
50 KiB
XML
986 lines
50 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=00000409&GeoLocation=244&ProcessorArchitecture=amd64&ComputerNameMode=Script&ComputerNameScript=%24adapter+%3D+Get-NetAdapter+-Name+%27Ethernet*%27+-ErrorAction+%27SilentlyContinue%27+%7C+Select-Object+-First+1%3B%0D%0Aif%28+%24adapter+%29+%7B%0D%0A++++return+%27PC-%27+%2B+%28+%24adapter.MacAddress+-replace+%27-%27%2C+%27%27+%29%3B%0D%0A%7D+else+%7B%0D%0A++++%22Could+not+find+Ethernet+adapter.%22+%7C+Write-Warning%3B%0D%0A%7D&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=Eastern+Standard+Time&PartitionMode=Unattended&PartitionLayout=GPT&EspSize=1000&RecoveryMode=Partition&RecoverySize=1000&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=pro_workstations&InstallFromMode=Automatic&PEMode=Generated&Disable8Dot3Names=true&UserAccountMode=Unattended&AccountName0=Ari&AccountDisplayName0=&AccountPassword0=&AccountGroup0=Administrators&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&ShowFileExtensions=true&ClassicContextMenu=true&LaunchToThisPC=true&ShowEndTask=true&TaskbarSearch=Hide&TaskbarIconsMode=Empty&DisableWidgets=true&LeftTaskbar=true&HideTaskViewButton=true&DisableBingResults=true&StartTilesMode=Empty&StartPinsMode=Empty&DisableFastStartup=true&EnableLongPaths=true&EnableRemoteDesktop=true&HardenSystemDriveAcl=true&HideEdgeFre=true&DisableEdgeStartupBoost=true&DeleteWindowsOld=true&EffectsMode=Performance&DesktopIconsMode=Custom&StartFoldersMode=Custom&StartFolderPersonalFolder=true&VirtIoGuestTools=true&WifiMode=Skip&ExpressSettings=DisableAll&LockKeysMode=Skip&StickyKeysMode=Disabled&ColorMode=Custom&SystemColorTheme=Dark&AppsColorTheme=Dark&AccentColor=%23000000&AccentColorOnStart=true&AccentColorOnBorders=true&EnableTransparency=true&WallpaperMode=Script&WallpaperScript=%24url+%3D+%27https%3A%2F%2Fwallpapercave.com%2Fwp%2Fwp6016634.jpg%27%3B%0D%0Areturn+%28+Invoke-WebRequest+-Uri+%24url+-UseBasicParsing+-TimeoutSec+30+%29.Content%3B&LockScreenMode=Script&LockScreenScript=%24url+%3D+%27https%3A%2F%2Fwallpapercave.com%2Fwp%2Fwp6016634.jpg%27%3B%0D%0Areturn+%28+Invoke-WebRequest+-Uri+%24url+-UseBasicParsing+-TimeoutSec+30+%29.Content%3B&Remove3DViewer=true&RemoveBingSearch=true&RemoveCalculator=true&RemoveCamera=true&RemoveClipchamp=true&RemoveClock=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&RemoveMixedReality=true&RemoveZuneVideo=true&RemoveNews=true&RemoveNotepad=true&RemoveOffice365=true&RemoveOneDrive=true&RemoveOneNote=true&RemoveOneSync=true&RemoveOpenSSHClient=true&RemoveOutlook=true&RemovePaint=true&RemovePaint3D=true&RemovePeople=true&RemovePhotos=true&RemovePowerAutomate=true&RemovePowerShell2=true&RemovePowerShellISE=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&RemoveWindowsTerminal=true&RemoveWordPad=true&RemoveXboxApps=true&RemoveYourPhone=true&SystemScript0=powercfg.exe+%2Fhibernate+off&SystemScriptType0=Cmd&SystemScript1=%24sb+%3D+%5BScriptBlock%5D%3A%3ACreate%28%28New-Object+Net.WebClient%29.DownloadString%28%27https%3A%2F%2Fget.activated.win%27%29%29%0D%0A%24params+%3D+%40%28%27%2FZ-Windows%27%29%0D%0Aif+%28%5BSystem.Environment%5D%3A%3AOSVersion.Version.Build+-lt+22000%29+%7B+%24params+%2B%3D+%27%2FZ-ESU%27+%7D%0D%0A%26+%24sb+%40params&SystemScriptType1=Ps1&WdacMode=Skip-->
|
|
<settings pass="offlineServicing"></settings>
|
|
<settings pass="windowsPE">
|
|
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
<RunSynchronous>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>1</Order>
|
|
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo:SELECT DISK=0&echo:CLEAN&echo:CONVERT GPT&echo:CREATE PARTITION EFI SIZE=1000&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>2</Order>
|
|
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo:SHRINK MINIMUM=1000&echo:FORMAT QUICK FS=NTFS LABEL=^"Windows^"&echo:ASSIGN LETTER=W&echo:CREATE PARTITION PRIMARY&echo:FORMAT QUICK FS=NTFS LABEL=^"Recovery^"&echo:ASSIGN LETTER=R)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>3</Order>
|
|
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo:SET ID=^"de94bba4-06d1-4d40-a16a-bfd50179d6ac^"&echo:GPT ATTRIBUTES=0x8000000000000001)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>4</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:rem Set keyboard layout&echo:wpeutil.exe SetKeyboardLayout 0409:00000409&echo:@for ^%^%d in (C D E F G H I J K L M N O P Q T U V Y Z^) do @()"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>5</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:if exist ^%^%d:\sources\install.wim set ^"IMAGE_FILE=^%^%d:\sources\install.wim^"&echo:if exist ^%^%d:\sources\install.esd set ^"IMAGE_FILE=^%^%d:\sources\install.esd^")"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>6</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:if exist ^%^%d:\sources\install.swm set ^"IMAGE_FILE=^%^%d:\sources\install.swm^" ^& set ^"SWM_PARAM=/SWMFile:^%^%d:\sources\install*.swm^"&echo:if exist ^%^%d:\autounattend.xml set ^"XML_FILE=^%^%d:\autounattend.xml^")"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>7</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:if exist ^%^%d:\$OEM$ set ^"OEM_FOLDER=^%^%d:\$OEM$^"&echo:if exist ^%^%d:\$WinPEDriver$ set ^"PEDRIVERS_FOLDER=^%^%d:\$WinPEDriver$^"&echo:^))"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>8</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:@if not defined IMAGE_FILE echo Could not locate install.wim, install.esd or install.swm. ^& pause ^& exit /b 1&echo:@if not defined XML_FILE echo Could not locate autounattend.xml. ^& pause ^& exit /b 1)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>9</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:rem Install drivers from $WinPEDriver$ folder&echo:if defined PEDRIVERS_FOLDER (&echo:for /R ^%PEDRIVERS_FOLDER^% ^%^%f IN (*.inf^) do drvload.exe ^"^%^%f^"&echo:^))"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>10</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:diskpart.exe /s X:\diskpart.txt ^|^| ( echo diskpart.exe encountered an error. ^& pause ^& exit /b 1 ^)&echo:set ^"OS_VERSION=Windows 11^"&echo:for /f ^"tokens=3 delims=.^" ^%^%v in ('ver'^) do ()"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>11</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:if ^%^%v LSS 20000 set ^"OS_VERSION=Windows 10^"&echo:^))"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>12</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:dism.exe /Apply-Image /ImageFile:^%IMAGE_FILE^% ^%SWM_PARAM^% /Name:^"^%OS_VERSION^% Pro for Workstations^" /ApplyDir:W:\ ^|^| ( echo dism.exe encountered an error. ^& pause ^& exit /b 1 ^))"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>13</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:bcdboot.exe W:\Windows /s S: ^|^| ( echo bcdboot.exe encountered an error. ^& pause ^& exit /b 1 ^)&echo:mkdir W:\Windows\Panther&echo:copy ^%XML_FILE^% W:\Windows\Panther\unattend.xml&echo:if defined PEDRIVERS_FOLDER ()"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>14</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:dism.exe /Add-Driver /Image:W:\ /Driver:^"^%PEDRIVERS_FOLDER^%^" /Recurse&echo:^)&echo:rem Strip 8.3 file names&echo:fsutil.exe 8dot3name set W: 1&echo:fsutil.exe 8dot3name strip /s /f W:\)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>15</Order>
|
|
<Path>cmd.exe /c ">>"X:\pe.cmd" (echo:rem Continue with next stage of Windows Setup after reboot&echo:wpeutil.exe reboot)"</Path>
|
|
</RunSynchronousCommand>
|
|
<RunSynchronousCommand wcm:action="add">
|
|
<Order>16</Order>
|
|
<Path>cmd.exe /c "X:\pe.cmd"</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>TEMPNAME</ComputerName>
|
|
<TimeZone>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">
|
|
<UserAccounts>
|
|
<LocalAccounts>
|
|
<LocalAccount wcm:action="add">
|
|
<Name>Ari</Name>
|
|
<DisplayName></DisplayName>
|
|
<Group>Administrators</Group>
|
|
<Password>
|
|
<Value></Value>
|
|
<PlainText>true</PlainText>
|
|
</Password>
|
|
</LocalAccount>
|
|
</LocalAccounts>
|
|
</UserAccounts>
|
|
<AutoLogon>
|
|
<Username>Ari</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 -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\GetComputerName.ps1">
|
|
$adapter = Get-NetAdapter -Name 'Ethernet*' -ErrorAction 'SilentlyContinue' | Select-Object -First 1;
|
|
if( $adapter ) {
|
|
return 'PC-' + ( $adapter.MacAddress -replace '-', '' );
|
|
} else {
|
|
"Could not find Ethernet adapter." | Write-Warning;
|
|
}
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\SetComputerName.ps1">
|
|
$ErrorActionPreference = 'Stop';
|
|
Set-StrictMode -Version 'Latest';
|
|
& {
|
|
$newName = ( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ComputerName.txt' -Raw ).Trim();
|
|
if( [string]::IsNullOrWhitespace( $newName ) ) {
|
|
throw "No computer name was provided.";
|
|
}
|
|
|
|
$keys = @(
|
|
@{
|
|
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName';
|
|
Name = 'ComputerName';
|
|
};
|
|
@{
|
|
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
Name = 'Hostname';
|
|
};
|
|
@{
|
|
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
Name = 'NV Hostname';
|
|
};
|
|
);
|
|
|
|
while( $true ) {
|
|
foreach( $key in $keys ) {
|
|
Set-ItemProperty @key -Type 'String' -Value $newName;
|
|
}
|
|
Start-Sleep -Milliseconds 50;
|
|
}
|
|
} *>&1 >> 'C:\Windows\Setup\Scripts\SetComputerName.log';
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\RemovePackages.ps1">
|
|
$selectors = @(
|
|
'Microsoft.Microsoft3DViewer';
|
|
'Microsoft.BingSearch';
|
|
'Microsoft.WindowsCalculator';
|
|
'Microsoft.WindowsCamera';
|
|
'Clipchamp.Clipchamp';
|
|
'Microsoft.WindowsAlarms';
|
|
'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.WindowsNotepad';
|
|
'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';
|
|
'MicrosoftTeams';
|
|
'MSTeams';
|
|
'Microsoft.Todos';
|
|
'Microsoft.WindowsSoundRecorder';
|
|
'Microsoft.Wallet';
|
|
'Microsoft.BingWeather';
|
|
'Microsoft.WindowsTerminal';
|
|
'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 >> $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';
|
|
'Microsoft.Windows.PowerShell.ISE';
|
|
'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 >> $logfile;
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1">
|
|
$selectors = @(
|
|
'MediaPlayback';
|
|
'MicrosoftWindowsPowerShellV2Root';
|
|
'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 >> $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>&lt;QueryList&gt;&lt;Query Id="0" Path="Application"&gt;&lt;Select Path="Application"&gt;*[System[Provider[@Name='UnattendGenerator'] and EventID=1]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</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\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\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\SetColorTheme.ps1">
|
|
$lightThemeSystem = 0;
|
|
$lightThemeApps = 0;
|
|
$accentColorOnStart = 1;
|
|
$enableTransparency = 1;
|
|
$htmlAccentColor = '#000000';
|
|
& {
|
|
$params = @{
|
|
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize';
|
|
Force = $true;
|
|
Type = 'DWord';
|
|
};
|
|
Set-ItemProperty @params -Name 'SystemUsesLightTheme' -Value $lightThemeSystem;
|
|
Set-ItemProperty @params -Name 'AppsUseLightTheme' -Value $lightThemeApps;
|
|
Set-ItemProperty @params -Name 'ColorPrevalence' -Value $accentColorOnStart;
|
|
Set-ItemProperty @params -Name 'EnableTransparency' -Value $enableTransparency;
|
|
};
|
|
& {
|
|
Add-Type -AssemblyName 'System.Drawing';
|
|
$accentColor = [System.Drawing.ColorTranslator]::FromHtml( $htmlAccentColor );
|
|
|
|
function ConvertTo-DWord {
|
|
param(
|
|
[System.Drawing.Color]
|
|
$Color
|
|
);
|
|
|
|
[byte[]] $bytes = @(
|
|
$Color.R;
|
|
$Color.G;
|
|
$Color.B;
|
|
$Color.A;
|
|
);
|
|
return [System.BitConverter]::ToUInt32( $bytes, 0);
|
|
}
|
|
|
|
$startColor = [System.Drawing.Color]::FromArgb( 0xD2, $accentColor );
|
|
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'StartColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'AccentColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\DWM' -Name 'AccentColor' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
$params = @{
|
|
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent';
|
|
Name = 'AccentPalette';
|
|
};
|
|
$palette = Get-ItemPropertyValue @params;
|
|
$index = 20;
|
|
$palette[ $index++ ] = $accentColor.R;
|
|
$palette[ $index++ ] = $accentColor.G;
|
|
$palette[ $index++ ] = $accentColor.B;
|
|
$palette[ $index++ ] = $accentColor.A;
|
|
Set-ItemProperty @params -Value $palette -Type 'Binary' -Force;
|
|
};
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\GetWallpaper.ps1">
|
|
$url = 'https://wallpapercave.com/wp/wp6016634.jpg';
|
|
return ( Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 30 ).Content;
|
|
</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-WallpaperImage -LiteralPath 'C:\Windows\Setup\Scripts\Wallpaper';
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\GetLockScreenImage.ps1">
|
|
$url = 'https://wallpapercave.com/wp/wp6016634.jpg';
|
|
return ( Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 30 ).Content;
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\unattend-01.cmd">
|
|
powercfg.exe /hibernate off
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\unattend-02.ps1">
|
|
$sb = [ScriptBlock]::Create((New-Object Net.WebClient).DownloadString('https://get.activated.win'))
|
|
$params = @('/Z-Windows')
|
|
if ([System.Environment]::OSVersion.Version.Build -lt 22000) { $params += '/Z-ESU' }
|
|
& $sb @params
|
|
</File>
|
|
<File path="C:\Windows\Setup\Scripts\Specialize.ps1">
|
|
$scripts = @(
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetComputerName.ps1' -Raw | Invoke-Expression > 'C:\Windows\Setup\Scripts\ComputerName.txt';
|
|
Start-Process -FilePath ( Get-Process -Id $PID ).Path -ArgumentList '-NoProfile', '-Command', 'Get-Content -LiteralPath "C:\Windows\Setup\Scripts\SetComputerName.ps1" -Raw | Invoke-Expression;' -WindowStyle 'Hidden';
|
|
Start-Sleep -Seconds 10;
|
|
};
|
|
{
|
|
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
};
|
|
{
|
|
reg.exe add "HKCR\.txt\ShellNew" /v ItemName /t REG_EXPAND_SZ /d "@C:\Windows\system32\notepad.exe,-470" /f;
|
|
reg.exe add "HKCR\.txt\ShellNew" /v NullFile /t REG_SZ /f;
|
|
reg.exe add "HKCR\txtfilelegacy" /v FriendlyTypeName /t REG_EXPAND_SZ /d "@C:\Windows\system32\notepad.exe,-469" /f;
|
|
reg.exe add "HKCR\txtfilelegacy" /ve /t REG_SZ /d "Text Document" /f;
|
|
};
|
|
{
|
|
Remove-Item -LiteralPath 'C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk', 'C:\Windows\System32\OneDriveSetup.exe', 'C:\Windows\SysWOW64\OneDriveSetup.exe' -ErrorAction 'Continue';
|
|
};
|
|
{
|
|
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
};
|
|
{
|
|
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 );
|
|
};
|
|
{
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
|
|
};
|
|
{
|
|
netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes;
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
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\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;
|
|
};
|
|
{
|
|
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;
|
|
};
|
|
{
|
|
try {
|
|
$bytes = Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetWallpaper.ps1' -Raw | Invoke-Expression;
|
|
[System.IO.File]::WriteAllBytes( 'C:\Windows\Setup\Scripts\Wallpaper', $bytes );
|
|
} catch {
|
|
$_;
|
|
}
|
|
};
|
|
{
|
|
try {
|
|
$bytes = Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetLockScreenImage.ps1' -Raw | Invoke-Expression;
|
|
[System.IO.File]::WriteAllBytes( 'C:\Windows\Setup\Scripts\LockScreenImage', $bytes );
|
|
reg.exe add "HKLM\Software\Microsoft\Windows\CurrentVersion\PersonalizationCSP" /v LockScreenImagePath /t REG_SZ /d "C:\Windows\Setup\Scripts\LockScreenImage" /f;
|
|
} catch {
|
|
$_;
|
|
}
|
|
};
|
|
{
|
|
C:\Windows\Setup\Scripts\unattend-01.cmd;
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\unattend-02.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 = @(
|
|
{
|
|
Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;
|
|
};
|
|
{
|
|
[System.Diagnostics.EventLog]::WriteEntry( 'UnattendGenerator', "User '$env:USERNAME' has requested to unlock the Start menu layout.", [System.Diagnostics.EventLogEntryType]::Information, 1 );
|
|
};
|
|
{
|
|
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::HKCU\Software\Microsoft\Windows\CurrentVersion\Search' -Name 'SearchboxTaskbarMode' -Type 'DWord' -Value 0;
|
|
};
|
|
{
|
|
Set-ItemProperty -LiteralPath 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Type 'DWord' -Value 2 -Force;
|
|
};
|
|
{
|
|
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 1 -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 1 -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';
|
|
};
|
|
{
|
|
Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Start' -Name 'VisiblePlaces' -Value $( [convert]::FromBase64String('SrC9dEr5aE+L1kOYBx2ovA==') ) -Type 'Binary';
|
|
};
|
|
{
|
|
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetColorTheme.ps1' -Raw | Invoke-Expression;
|
|
};
|
|
{
|
|
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 >> "$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;
|
|
};
|
|
{
|
|
reg.exe add "HKU\DefaultUser\Software\Microsoft\Notepad" /v ShowStoreBanner /t REG_DWORD /d 0 /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\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 ShowTaskViewButton /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f;
|
|
};
|
|
{
|
|
reg.exe add "HKU\DefaultUser\Software\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\DWM" /v ColorPrevalence /t REG_DWORD /d 1 /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;
|
|
};
|
|
{
|
|
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 >> "C:\Windows\Setup\Scripts\FirstLogon.log";
|
|
</File>
|
|
</Extensions>
|
|
</unattend> |