From 72c70ffc96a354890efa0e762d3fc94efb1ad835 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:42:41 +0100 Subject: [PATCH] feat: 24H2 features & fixes (#1149) ### Questions - [x] Did you test your changes or double-check that they work? - [x] Did you read and follow the [Atlas Contribution Guidelines](https://docs.atlasos.net/contributions/)? ### Describe your pull request Does these for 24H2: - Adds support for the Copilot app - Fixes the 'Accounts' settings page ads - It's also more reliable generally now - Remove & kill new Appx Teams **This PR doesn't bring 24H2 support;** it implements needed changes I noticed when testing the Windows Insider Canary branch. These changes are required for when 24H2 is officially released, but they don't really impact 23H2. --- src/playbook/Configuration/atlas/appx.yml | 14 +++++++--- .../Disable Microsoft Copilot (default).cmd | 26 ++++++++++++++++++ .../Disable Microsoft Copilot (default).reg | 4 --- .../Enable Microsoft Copilot.cmd | 27 +++++++++++++------ .../AtlasModules/Scripts/wingetCheck.cmd | 12 ++++++--- src/playbook/Executables/CLIENTCBS.ps1 | 10 ++++--- 6 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).cmd delete mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).reg diff --git a/src/playbook/Configuration/atlas/appx.yml b/src/playbook/Configuration/atlas/appx.yml index e817644583..204c0c4bb7 100644 --- a/src/playbook/Configuration/atlas/appx.yml +++ b/src/playbook/Configuration/atlas/appx.yml @@ -22,19 +22,26 @@ actions: wait: true # AppX Microsoft Teams - # Seems legacy - not in 23H2? + # Seems legacy - not in 23H2 - !taskKill: {name: 'msteams*', ignoreErrors: true} - !appx: {name: 'MicrosoftTeams*', type: family} - !registryValue: {path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications', value: 'ConfigureChatAutoInstall', data: '0', type: REG_DWORD} + # New AppX Teams in 24H2 + - !taskKill: {name: 'ms-teams*', ignoreErrors: true} + - !appx: {name: 'MSTeams*', type: family} + # 24H2 Copilot app + - !appx: {name: 'Microsoft.Copilot*', type: family} + + # Other apps - !appx: {name: 'Clipchamp.Clipchamp*', type: family} - !appx: {name: 'Disney.37853FC22B2CE*', type: family} - !appx: {name: 'SpotifyAB.SpotifyMusic*', type: family} - !appx: {name: 'Microsoft.549981C3F5F10*', type: family} # Cortana - - !appx: {name: 'Microsoft.XboxApp*', type: family} # Legacy Xbox Console Companion + - !appx: {name: 'Microsoft.XboxApp*', type: family} # Xbox Console Companion (deprecated) - !appx: {name: 'microsoft.windowscommunicationsapps*', type: family} # Mail and Calendar - !appx: {name: 'Microsoft.MSPaint*', type: family} # Paint 3D - - !appx: {name: 'Microsoft.Getstarted*', type: family} # Tips + - !appx: {name: 'Microsoft.Getstarted*', type: family} # Tips (deprecated) - !appx: {name: 'Microsoft.ZuneVideo*', type: family} # Films & TV - !appx: {name: 'MicrosoftCorporationII.MicrosoftFamily*', type: family} - !appx: {name: 'Microsoft.MixedReality.Portal*', type: family} @@ -79,6 +86,7 @@ actions: wait: true # Clear caches of Client.CBS and more + # Start menu cache is cleared later - !writeStatus: {status: 'Clearing AppX caches'} - !appx: {operation: clearCache, name: '*MicrosoftWindows.Client.CBS*'} - !appx: {operation: clearCache, name: '*Microsoft.Windows.Search*'} diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).cmd b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).cmd new file mode 100644 index 0000000000..8424303de0 --- /dev/null +++ b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).cmd @@ -0,0 +1,26 @@ +@echo off + +set "___args="%~f0" %*" +fltmc > nul 2>&1 || ( + echo Administrator privileges are required. + powershell -c "Start-Process -Verb RunAs -FilePath 'cmd' -ArgumentList """/c $env:___args"""" 2> nul || ( + echo You must run this script as admin. + if "%*"=="" pause + exit /b 1 + ) + exit /b +) + +echo Disabling and uninstalling Copilot... + +powershell -NoP -NonI "Get-AppxPackage -AllUsers Microsoft.Copilot* | Remove-AppxPackage -AllUsers" +taskkill /f /im explorer.exe > nul 2>&1 +reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d "0" /f > nul +reg add "HKCU\Software\Policies\Microsoft\Windows\WindowsCopilot" /v "TurnOffWindowsCopilot" /t REG_DWORD /d "1" /f > nul +start explorer.exe + +echo] +echo Finished, changes are applied. +echo Press any key to exit... +pause > nul +exit /b \ No newline at end of file diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).reg b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).reg deleted file mode 100644 index ff7ca231f9..0000000000 --- a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).reg +++ /dev/null @@ -1,4 +0,0 @@ -Windows Registry Editor Version 5.00 - -[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsCopilot] -"TurnOffWindowsCopilot"=dword:00000001 diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Enable Microsoft Copilot.cmd b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Enable Microsoft Copilot.cmd index f40ccc594c..f040239983 100644 --- a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Enable Microsoft Copilot.cmd +++ b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Microsoft Copilot/Enable Microsoft Copilot.cmd @@ -11,24 +11,35 @@ fltmc > nul 2>&1 || ( exit /b ) -echo Please note that some regions or devices may not have Copilot avaliable. -echo This means that the script can seem to 'not work', but it would do if it was avaliable. -pause - -cls +:: Check for Edge support echo] call "%windir%\AtlasModules\Scripts\edgeCheck.cmd" /edgeonly if %errorlevel% neq 0 exit /b 1 echo] echo Enabling Copilot... + +:: Decide if Copilot is avaliable +:: If not, it could be 24H2 (which replaces it with an app) +set "appText= " +reg query HKCU\Software\Microsoft\Windows\Shell\Copilot /v IsCopilotAvailable 2>&1 | find "0x0" > nul +if %errorlevel%==0 (call :app) else (reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d "1" /f > nul) + taskkill /f /im explorer.exe > nul 2>&1 reg delete "HKCU\Software\Policies\Microsoft\Windows\WindowsCopilot" /v "TurnOffWindowsCopilot" /f > nul 2>&1 -reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d "1" /f > nul start explorer.exe +:finish echo] -echo Finished, changes are applied. +echo Finished, changes are applied. %appText% echo Press any key to exit... pause > nul -exit /b \ No newline at end of file +exit /b + +:app +echo NOTE: Copilot on the taskbar isn't available, the app will be installed instead. +set "appText=You can find the Copilot app in your Start Menu." +call "%windir%\AtlasModules\Scripts\wingetCheck.cmd" /nodashes +if %errorlevel% neq 0 exit /b 1 +echo Installing Copilot... +winget install -e --id 9NHT9RB2F4HD --uninstall-previous -h --accept-source-agreements --accept-package-agreements --force --disable-interactivity > nul \ No newline at end of file diff --git a/src/playbook/Executables/AtlasModules/Scripts/wingetCheck.cmd b/src/playbook/Executables/AtlasModules/Scripts/wingetCheck.cmd index 31fdf23117..ab3e1f0bf0 100644 --- a/src/playbook/Executables/AtlasModules/Scripts/wingetCheck.cmd +++ b/src/playbook/Executables/AtlasModules/Scripts/wingetCheck.cmd @@ -2,9 +2,11 @@ set "dashes=-----------------------------------------------------------------------------------------------------" set "silent=" -echo "%~1 %~2" | find "/silent" > nul && set silent=true +set "nodashes=" +echo "%*" | find "/silent" > nul && set silent=true +echo "%*" | find "/nodashes" > nul && set nodashes=true -if not defined silent echo %dashes% +if not defined silent (if not defined nodashes echo %dashes%) ping -n 1 -4 www.microsoft.com > nul 2>&1 if errorlevel == 1 ( @@ -36,8 +38,10 @@ winget search "Microsoft Visual Studio Code" --accept-source-agreements > nul 2> ) if not defined silent ( - echo %dashes% - echo] + if not defined nodashes ( + echo %dashes% + echo] + ) ) exit /b diff --git a/src/playbook/Executables/CLIENTCBS.ps1 b/src/playbook/Executables/CLIENTCBS.ps1 index 4890d95f4f..4ff073d6de 100644 --- a/src/playbook/Executables/CLIENTCBS.ps1 +++ b/src/playbook/Executables/CLIENTCBS.ps1 @@ -8,10 +8,9 @@ # Variables $windir = [Environment]::GetFolderPath('Windows') -$cbsPublic = "$windir\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\Public" -$settingsExtensions = "$cbsPublic\wsxpacks\Account\SettingsExtensions.json" +$settingsExtensions = (Get-ChildItem "$windir\SystemApps" -Recurse).FullName | Where-Object { $_ -like '*wsxpacks\Account\SettingsExtensions.json*' } $arm = ((Get-CimInstance -Class Win32_ComputerSystem).SystemType -match 'ARM64') -or ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') -if (!(Test-Path $settingsExtensions)) { +if ($settingsExtensions.Count -eq 0) { Write-Output "Settings extensions ($settingsExtensions) not found." Write-Output "User is likely on Windows 10, nothing to do. Exiting..." exit @@ -37,7 +36,10 @@ function Find-VelocityID($Node) { return $ids } -$ids = Find-VelocityID -Node $(Get-Content -Path $settingsExtensions | ConvertFrom-Json) +$ids = @() +foreach ($settingsJson in $settingsExtensions) { + $ids += Find-VelocityID -Node $(Get-Content -Path $settingsJson | ConvertFrom-Json) +} # No IDs check if ($ids.Count -le 0) {