Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions src/dependencies/local-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,10 @@ try {
}
}

# update the oem version so Settings/winver display the correct build tag
$oemYmlRelativePath = Join-Path -Path (Join-Path -Path 'Configuration' -ChildPath 'tweaks') -ChildPath (Join-Path -Path 'misc' -ChildPath 'config-oem-information.yml')
$oemScriptRelativePath = Join-Path -Path (Join-Path -Path (Join-Path -Path 'Executables' -ChildPath 'AtlasModules') -ChildPath 'Scripts') -ChildPath (Join-Path -Path 'Tasks' -ChildPath 'Set-OemInformation.ps1')
$oemVersionFiles = @($oemYmlRelativePath, $oemScriptRelativePath)
if ($oemVersionFiles | Where-Object { Test-Path -LiteralPath $_ -PathType Leaf }) {
# update the OEM version in the runtime task so Windows reports the correct build tag
$oemScriptRelativePath = Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path 'Executables' -ChildPath 'AtlasModules') -ChildPath 'Scripts') -ChildPath 'Tasks') -ChildPath 'Set-OemInformation.ps1'
$stagedOemScript = $false
if (Test-Path -LiteralPath $oemScriptRelativePath -PathType Leaf) {
try {
$confXml = [xml](Get-Content -Path 'playbook.conf' -Raw -Encoding UTF8)
$playbookNode = $confXml.Playbook
Expand All @@ -420,22 +419,15 @@ try {
$versionLabel += ' (dev)'
}

$updatedOemVersion = $false
foreach ($oemVersionFile in $oemVersionFiles) {
if (-not (Test-Path -LiteralPath $oemVersionFile -PathType Leaf)) {
continue
}
$oemContent = Get-Content -Path $oemScriptRelativePath -Raw -Encoding UTF8
$updatedOemContent = $oemContent -replace 'AtlasVersionUndefined', $versionLabel

$oemContent = Get-Content -Path $oemVersionFile -Raw -Encoding UTF8
$updatedOemContent = $oemContent -replace 'AtlasVersionUndefined', $versionLabel

if ($updatedOemContent -ne $oemContent) {
$playbookTempPath = Get-PlaybookTempPath
$tempOemPath = Join-Path -Path $playbookTempPath -ChildPath $oemVersionFile
Set-ParentDirectory -Path $tempOemPath
Set-Content -Path $tempOemPath -Value $updatedOemContent -Encoding UTF8
$updatedOemVersion = $true
}
if ($updatedOemContent -ne $oemContent) {
$playbookTempPath = Get-PlaybookTempPath
$tempOemScriptPath = Join-Path -Path $playbookTempPath -ChildPath $oemScriptRelativePath
Set-ParentDirectory -Path $tempOemScriptPath
Set-Content -Path $tempOemScriptPath -Value $updatedOemContent -Encoding UTF8
$stagedOemScript = $true
}

if (-not $updatedOemVersion) {
Expand All @@ -451,14 +443,15 @@ try {
}
}
else {
Write-Warning "Can't find an OEM version file, not setting OEM version."
Write-Warning "Can't find '$oemScriptRelativePath', not setting OEM version."
}

# skip local script + staged overrides so we dont pack duplicates
$excludeFiles = @('local-build.*', '*.apbx')
if ($stagedCustomYml) { $excludeFiles += 'custom.yml' }
if ($stagedStartYml) { $excludeFiles += 'start.yml' }
if ($stagedPlaybookConf) { $excludeFiles += 'playbook.conf' }
if ($stagedOemScript) { $excludeFiles += 'Set-OemInformation.ps1' }

$filesListPath = [IO.Path]::GetTempFileName()
$rootPathNormalized = $workingDirectory.TrimEnd([IO.Path]::DirectorySeparatorChar, [IO.Path]::AltDirectorySeparatorChar)
Expand Down
16 changes: 3 additions & 13 deletions src/playbook/Configuration/atlas/appx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ actions:

# Get current AppX packages to deprovision removed ones afterward
- !powerShell:
command: |
(Get-AppxPackage).PackageFamilyName |
Out-File """$([Environment]::GetFolderPath('Windows'))\AtlasModules\AtlasPackagesOld.txt"""
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Save-AppxPackageSnapshot.ps1'')'
runas: currentUserElevated
wait: true

Expand Down Expand Up @@ -81,22 +79,14 @@ actions:
# Removing using AME Wizard causes issues with Cross Device Experience Host installing
# - !appx: {name: 'Microsoft.YourPhone*', type: family}
- !powerShell:
command: |
Get-AppxPackage Microsoft.YourPhone* | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq 'Microsoft.YourPhone' } | Remove-AppxProvisionedPackage -Online
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Remove-PhoneLinkAppx.ps1'')'
runas: currentUserElevated
wait: true

# Prevent provisioned applications from being reinstalled
# https://learn.microsoft.com/en-us/windows/application-management/remove-provisioned-apps-during-update
- !powerShell:
command: |
$a = """$([Environment]::GetFolderPath('Windows'))\AtlasModules\AtlasPackagesOld.txt"""
Compare-Object -ReferenceObject (Get-Content $a) -DifferenceObject ((Get-AppxPackage).PackageFamilyName) |
Where-Object { $_.SideIndicator -eq '<=' } |
Select-Object -ExpandProperty InputObject |
Foreach-Object { New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned" -Name $_ -Force };
Remove-Item $a -Force
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Set-AppxDeprovisionedPackages.ps1'')'
runas: currentUserElevated
wait: true

Expand Down
23 changes: 1 addition & 22 deletions src/playbook/Configuration/atlas/start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,7 @@ actions:
- !writeStatus: {status: 'Setting the environment'}
- !powerShell:
wait: true
command: |
function Add-ToPath ([array]$Paths) {
$machine = [System.EnvironmentVariableTarget]::Machine
$separator = [IO.Path]::PathSeparator

$Paths | ForEach-Object {
if (!(Test-Path $_ -PathType Container)) {
Write-Error """Path '$_' doesn't exist as a container."""
}
}

$newPath = @()
$newPath += [Environment]::GetEnvironmentVariable('PATH', $machine) -split $separator
if ($newPath.Count -eq 0) { Write-Warning 'The PATH variable is currently empty.' }
$newPath += $Paths
$newPath = $newPath | Where-Object { $_ } | Select-Object -Unique

[Environment]::SetEnvironmentVariable('PATH', """$($newPath -join $separator)""", $machine)
}

$modulesPath = """$([Environment]::GetFolderPath('Windows'))\AtlasModules"""
Add-ToPath """$modulesPath""", """$modulesPath\Tools""", """$modulesPath\Scripts"""
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Initialize-AtlasPath.ps1'')'

################ NO LOCAL BUILD ################

Expand Down
21 changes: 3 additions & 18 deletions src/playbook/Configuration/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,21 @@ actions:
wait: true
runas: currentUserElevated
- !powerShell:
command: |
Start-Process -FilePath """$windir\AtlasDesktop\6. Advanced Configuration\Process Explorer\Uninstall Process Explorer.cmd""" -ArgumentList "/silent" -WindowStyle Hidden
taskkill /IM taskmgr.exe
command: '& ".\AtlasModules\Scripts\Tasks\Stop-ProcessExplorerUpgrade.ps1"'
weight: 2
wait: true
exeDir: true
onUpgrade: true
- !powerShell:
command: |
$windir = [Environment]::GetFolderPath('Windows')
Remove-Item -LiteralPath "$windir\AtlasDesktop" -Force -Recurse
Remove-Item -LiteralPath "$windir\AtlasModules" -Force -Recurse
command: '& ".\AtlasModules\Scripts\Tasks\Remove-PreviousAtlasInstall.ps1"'
wait: true
exeDir: true
oobe: false
onUpgrade: true

- !writeStatus: { status: "Copying files" }
- !powerShell:
command: |
$windir = [Environment]::GetFolderPath('Windows')
@(
'AtlasModules',
'AtlasDesktop'
) | ForEach-Object {
if (!(Test-Path $_)) { exit 1 }
Copy-Item -Path $_ -Destination $windir -Force -Recurse
if (!$?) { exit 2 }
}
Copy-Item -Path 'Themes\*' -Destination """$windir\Resources\Themes""" -Force -Recurse
command: '& ".\AtlasModules\Scripts\Tasks\Copy-AtlasPayload.ps1"'
weight: 10
wait: true
exeDir: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ actions:
type: REG_DWORD

- !powerShell:
command: |
$razerPath = Join-Path $env:windir 'Installer\Razer'

New-Item -Path $razerPath -ItemType Directory -Force | Out-Null
Get-ChildItem -LiteralPath $razerPath -Force -ErrorAction SilentlyContinue |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue

$denyRule = '*S-1-1-0:(W)'
icacls $razerPath /deny $denyRule | Out-Null
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Block-RazerInstaller.ps1'')'
runas: currentUserElevated
wait: true
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ title: Add Music & Videos To Home
description: After disabling recent files in Quick Access, Music & Videos disappear. This fixes that.
actions:
- !powerShell:
command: |
$o = new-object -com shell.application
$currentPins = $o.Namespace('shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}').Items() | ForEach-Object { $_.Path }
foreach ($path in @(
[Environment]::GetFolderPath('MyVideos'),
[Environment]::GetFolderPath('MyMusic')
)) {
if ($currentPins -notcontains $path) {
$o.Namespace($path).Self.InvokeVerb('pintohome')
}
}
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Add-MusicVideosToHome.ps1'')'
runas: currentUser
wait: true
24 changes: 24 additions & 0 deletions src/playbook/Configuration/tweaks/misc/add-newUser-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,33 @@
title: Add newUsers.ps1 script
description: Adds the newUsers.ps1 script to RunOnce, which applies any tweaks that are dynamically generated on new user creation
actions:
- !powerShell:
command: |
$markerPath = 'HKLM:\SOFTWARE\AtlasOS\UserSetup'
$null = New-Item -Path $markerPath -Force
$acl = Get-Acl -Path $markerPath
$users = New-Object System.Security.Principal.SecurityIdentifier 'S-1-5-32-545'
$rule = New-Object System.Security.AccessControl.RegistryAccessRule(
$users,
[System.Security.AccessControl.RegistryRights]'ReadKey, SetValue',
[System.Security.AccessControl.AccessControlType]::Allow
)
$acl.SetAccessRule($rule)
Set-Acl -Path $markerPath -AclObject $acl
wait: true
- !registryValue:
path: 'HKU\AME_UserHive_Default\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'
value: 'RunScript'
data: |
powershell -EP RemoteSigned -NoP & """$([Environment]::GetFolderPath('Windows'))\AtlasModules\Scripts\newUsers.ps1"""
type: REG_SZ
- !registryValue:
path: 'HKU\AME_UserHive_Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Search'
value: 'SearchboxTaskbarMode'
data: '1'
type: REG_DWORD
- !registryValue:
path: 'HKU\AME_UserHive_Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Search'
value: 'SearchboxTaskbarModeCache'
data: '1'
type: REG_DWORD
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@ title: Configure OEM Information
description: Configures OEM information to contain the Atlas version and the Atlas Discord server
actions:
- !powerShell:
command: |
$version = 'AtlasVersionUndefined'

Write-Output 'Setting boot entry name...'
bcdedit /set description """AtlasOS $(('10', '11')[[int]([System.Environment]::OSVersion.Version.Build -ge 22000)]) $version"""

Write-Output 'Setting other versioned OEM information...'
$reportedVer = """Atlas Playbook $version"""
# Shows in Settings
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation' -Name 'Model' -Value $reportedVer -Force
# Shows in winver
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name 'RegisteredOrganization' -Value $reportedVer -Force
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Set-OemInformation.ps1'')'
wait: true
- !registryValue:
path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ actions:
# Delete ARM-specific files
# FTH files (which are also non-ARM) are deleted in its own YML
- !powerShell:
command: |
Remove-Item -Path """$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\4. Interface Tweaks\Start Menu\*Open-Shell*""" -Force -Recurse
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Remove-VersionSpecificAtlasFiles.ps1'')'
wait: true
cpuArch: 'Arm64'
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,6 @@ title: Removes the drive letter from the EFI partition.
description: This happens after clean install without formatting the drive
actions:
- !powerShell:
command: |
try {
# Find EFI System Partition on any disk
$efiPartition = Get-Partition | Where-Object { $_.GptType -eq '{C12A7328-F81F-11D2-BA4B-00A0C93EC93B}' } | Select-Object -First 1

if ($null -eq $efiPartition) {
Write-Output "No EFI partition found, skipping."
exit 0
}

if ([string]::IsNullOrEmpty($efiPartition.DriveLetter)) {
Write-Output "EFI partition has no drive letter, skipping."
exit 0
}

Write-Output "Removing drive letter '$($efiPartition.DriveLetter):' from EFI partition..."
Remove-PartitionAccessPath -DiskNumber $efiPartition.DiskNumber -PartitionNumber $efiPartition.PartitionNumber -AccessPath "$($efiPartition.DriveLetter):\"
Write-Output "Successfully removed EFI partition drive letter."
}
catch {
Write-Output "Failed to remove EFI partition drive letter: $_"
# Non-fatal error, continue installation
exit 0
}
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Remove-EfiDriveLetter.ps1'')'
wait: true
runas: currentUserElevated
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ description: Disables Service Host splitting for much lower RAM usage and proces
actions:
# https://learn.microsoft.com/en-us/windows/application-management/svchost-service-refactoring
- !powerShell:
command: |
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Services' |
Where-Object { $_.Name -notmatch 'Xbl|Xbox' } |
Foreach-Object {
if ($null -ne (Get-ItemProperty -Path """Registry::$_""" -EA 0).Start) {
Set-ItemProperty -Path """Registry::$_""" -Name 'SvcHostSplitDisable' -Type DWORD -Value 1 -Force -EA 0
}
}
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Disable-ServiceHostSplit.ps1'')'
wait: true
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,18 @@ actions:
value: 'SearchboxTaskbarMode'
data: '1'
type: REG_DWORD
- !registryValue:
path: 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search'
value: 'SearchboxTaskbarModeCache'
data: '1'
type: REG_DWORD

# Fallback for OOBE as it doesn't seem to work
- !powerShell:
command: |
New-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Force | Out-Null
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name SearchboxTaskbarMode -Value 1 -Type DWord -Force
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name SearchboxTaskbarModeCache -Value 1 -Type DWord -Force
exeDir: true
oobe: only

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ title: Add Network Sharing Shortcut
description: Adds a network sharing settings shortcut to the Atlas 'File Sharing' folder for QoL
actions:
- !powerShell:
command: |
.\AtlasModules\initPowerShell.ps1
New-Shortcut -Source 'control.exe' `
-Destination """$([Environment]::GetFolderPath('Windows'))\AtlasDesktop\3. General Configuration\File Sharing\Sharing Settings.lnk""" `
-Arguments '/name Microsoft.NetworkAndSharingCenter /page Advanced'
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Add-NetworkSharingShortcut.ps1'')'
exeDir: true
wait: true
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ title: Disable Microsoft Store Recommended Search Results
description: Disables recommended Microsoft Store apps in Start Menu
actions:
- !powerShell:
command: |
$storeDb = Join-Path $env:LocalAppData 'Packages\Microsoft.WindowsStore_8wekyb3d8bbwe\LocalState\store.db'
$storeDbParent = Split-Path -Path $storeDb -Parent

New-Item -Path $storeDbParent -ItemType Directory -Force | Out-Null
if (!(Test-Path -LiteralPath $storeDb)) {
New-Item -Path $storeDb -ItemType File -Force | Out-Null
}

icacls $storeDb /deny "*S-1-1-0:F" | Out-Null
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Disable-StoreSearchRecommendations.ps1'')'
runas: currentUserElevated
wait: true
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ actions:
# https://admx.help/?Category=Windows_11_2022&Policy=Microsoft.Policies.WindowsUpdate::TargetReleaseVersion
- !registryValue: {path: 'HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate', value: 'TargetReleaseVersion', data: '1', type: REG_DWORD}
- !powerShell:
command: 'if ((Get-CimInstance -Class Win32_OperatingSystem).Caption -match 11) {$a = ''Windows 11''} else {$a = ''Windows 10''}; New-ItemProperty -Path ''HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate'' -Name ''ProductVersion'' -Value $a -PropertyType String -Force'
wait: true
- !powerShell:
command: '$ver = (Get-ItemProperty ''HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'').DisplayVersion; New-ItemProperty -Path ''HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate'' -Name ''TargetReleaseVersion'' -Value $ver -PropertyType String -Force'
command: '& (Join-Path ([Environment]::GetFolderPath(''Windows'')) ''AtlasModules\Scripts\Tasks\Set-FeatureUpdateTarget.ps1'')'
wait: true
Loading
Loading