Files
windows-builder/includes/$OEM$/$$/OEM/setup/scripts/first-time-setup.ps1
2026-06-02 03:37:09 -07:00

96 lines
4.2 KiB
PowerShell

# Check PowerShell version for use in path
if ($PSVersionTable.PSVersion.Major -ge 3) {
# Use new variable syntax in PowerShell 3 and above
$currentDir = $PSScriptRoot
}
else {
# Use old variable syntax in Windows PowerShell 3 and below
$currentDir = (Get-Item .).FullName
}
# Import script-helper.ps1
. "$currentDir\..\..\scripts\script-helper.ps1"
# Get system information
$systemInfo = Get-SystemInfo
#$windowsInfo = Get-WindowsVersionDetails
# If the device windows is running on is a Mac, Prompt to install Mac-specific software
if ($systemInfo.deviceIsMac) {
Write-Output "Mac hardware detected - Running Mac-specific setup..."
#Start-Process -FilePath "$windowsDrive\Windows\OEM\setup\scripts\tweaks\setup-mac.ps1" -ArgumentList "" -Wait
}
#### If there are any specific scripts to run for certain Windows versions (25H2, Pro, 21600, etc), add them here ####
#if ($windowsInfo.CodeRelease -eq "21H2") {
# Write-Output "Running Windows 10 21H2 specific setup..."
# Start-Process -FilePath "$windowsDrive\Windows\OEM\setup\scripts\tweaks\setup-21H2.ps1" -ArgumentList "" -Wait
#}
#if ($windowsInfo.Edition -eq "Education") {
# Write-Output "Running Windows 10/11 Education specific setup..."
# Start-Process -FilePath "$windowsDrive\Windows\OEM\setup\scripts\tweaks\setup-education.ps1" -ArgumentList "" -Wait
#}
#### Set lock screen image (system-wide, applies before first login) ####
$lockScreenPath = "$windowsDrive\Windows\Web\Wallpaper\Windows\flooded-city.jpg"
if (Test-Path $lockScreenPath) {
$policyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization"
if (-not (Test-Path $policyPath)) { New-Item -Path $policyPath -Force | Out-Null }
Set-ItemProperty -Path $policyPath -Name "LockScreenImagePath" -Value $lockScreenPath -Type String
Set-ItemProperty -Path $policyPath -Name "LockScreenImageUrl" -Value $lockScreenPath -Type String
Set-ItemProperty -Path $policyPath -Name "LockScreenImageStatus" -Value 1 -Type DWord
Write-Output "Lock screen image set to $lockScreenPath"
# just in case, also disable spotlight
Set-ItemProperty -Path $policyPath -Name "NoLockScreenSlideshow" -Value 1 -Type DWord
} else {
Write-Warning "Lock screen image not found at $lockScreenPath - skipping."
}
# Install cursors to registry
Install-CursorScheme -SchemeName "Posy's Cursor" -CursorDir "$windowsDrive\Windows\Cursors\Posys Cursor" -Files @{
pointer = "Posy cursor.cur"
help = "Posy help.cur"
working = "Posy background max 96.ani"
busy = "Posy wait max 96.ani"
precision = "Posy precise.cur"
text = "Posy beam.cur"
hand = "Posy pen.cur"
unavailable = "Posy forbidden.cur"
vert = "Posy size NS.cur"
horz = "Posy size EW.cur"
dgn1 = "Posy size NwSe.cur"
dgn2 = "Posy size NeSw.cur"
move = "Posy move.cur"
alternate = "Posy alt.cur"
link = "Posy hand.cur"
person = "Posy cursor.cur" # fallback
pin = "Posy cursor.cur" # fallback
}
Install-CursorScheme -SchemeName "nikocursor" -CursorDir "$windowsDrive\Windows\Cursors\niko1X" -Files @{
pointer = "normal.ani"
help = "help.ani"
working = "working.ani"
busy = "busy.ani"
precision = "precision.ani"
text = "text.ani"
hand = "handwriting.ani"
unavailable = "unavailable.ani"
vert = "vertical.ani"
horz = "horizontal.ani"
dgn1 = "diagonal1.ani"
dgn2 = "diagonal2.ani"
move = "move.ani"
alternate = "alternate.ani"
link = "link.ani"
person = "person.ani"
pin = "pin.ani"
}
#### Install UWP UI Components for all users ####
Write-Output "Installing UWP UI Components for all users..."
& "$windowsDrive\Windows\OEM\setup\scripts\UWP-Components.ps1"
#### Install Normal Apps (Machine wide) ####
Start-Process -FilePath "$windowsDrive\Windows\OEM\MultiStaller.exe" -ArgumentList "--config", "$windowsDrive\Windows\OEM\setup\apps-machine-wide.yml" -WindowStyle Maximized -Wait
Start-Process -FilePath "$windowsDrive\Windows\OEM\ChromeMassInstaller.exe" -ArgumentList "--no_pref" -Wait