-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...esktop/3. General Configuration/Microsoft Copilot/Disable Microsoft Copilot (default).ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#Requires -RunAsAdministrator | ||
|
||
param ( | ||
[switch]$NonInteractive | ||
) | ||
|
||
$windir = [Environment]::GetFolderPath('Windows') | ||
& "$windir\AtlasModules\initPowerShell.ps1" | ||
|
||
# Remove PWA/app version | ||
Get-AppxPackage -AllUsers Microsoft.Copilot* | Remove-AppxPackage -AllUsers | ||
|
||
# Kill Explorer to ensure Registry changes apply | ||
$exp = Stop-Explorer | ||
|
||
# Registry changes | ||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowCopilotButton" -Value 0 -Force -EA 0 | ||
New-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\WindowsCopilot" -Name "TurnOffWindowsCopilot" -PropertyType DWord -Value 1 -Force | ||
|
||
# Start Explorer again | ||
Restart-Explorer -ExplorerStarted $exp | ||
|
||
Write-Host "Finished, changes are applied." -ForegroundColor Green | ||
Read-Pause |
44 changes: 44 additions & 0 deletions
44
...bles/AtlasDesktop/3. General Configuration/Microsoft Copilot/Enable Microsoft Copilot.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#Requires -RunAsAdministrator | ||
|
||
param ( | ||
[switch]$NonInteractive | ||
) | ||
|
||
$windir = [Environment]::GetFolderPath('Windows') | ||
& "$windir\AtlasModules\initPowerShell.ps1" | ||
|
||
# Check if Edge is installed | ||
$edgeArgs = @{ | ||
OnlyEdge = $true | ||
NonInteractive = $NonInteractive | ||
} | ||
Invoke-EdgeTest @edgeArgs | ||
|
||
# Decide if Copilot is available | ||
# If not, it could be 24H2 (which replaces it with an app) | ||
try { | ||
$copilotAvailable = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\Shell\Copilot" -Name "IsCopilotAvailable" -EA 0 | ||
} catch { | ||
$appText = "You can find the Copilot app in your Start Menu." | ||
} | ||
|
||
if ($copilotAvailable -eq 0) { | ||
Write-Warning "Copilot on the taskbar isn't available, the app will be installed instead." | ||
& "$winver\AtlasModules\Scripts\wingetCheck.cmd" /nodashes $(if ($NonInteractive) { '/silent' }) | ||
if ($LASTEXITCODE -ne 0) { exit 1 } | ||
|
||
Write-Output "Installing Copilot..." | ||
winget install -e --id 9NHT9RB2F4HD --uninstall-previous -h --accept-source-agreements --accept-package-agreements --force --disable-interactivity | Out-Null | ||
} else { | ||
# Show in taskbar | ||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowCopilotButton" -Value 1 -EA 0 | ||
} | ||
|
||
# Delete policy | ||
Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\WindowsCopilot" -Name "TurnOffWindowsCopilot" -Force -EA 0 | ||
|
||
# Restart Explorer to apply changes | ||
Restart-Explorer | ||
|
||
Write-Host "Finished, changes are applied. $appText" -ForegroundColor Green | ||
Read-Pause |
Binary file not shown.
60 changes: 60 additions & 0 deletions
60
src/playbook/Executables/AtlasModules/Scripts/Modules/Edge/Edge.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
$windir = [Environment]::GetFolderPath('Windows') | ||
$removeEdge = "$windir\AtlasModules\Scripts\ScriptWrappers\RemoveEdge.ps1" | ||
$edgePath = "$([Environment]::GetFolderPath('ProgramFilesx86'))\Microsoft\Edge\Application\msedge.exe" | ||
|
||
function Invoke-EdgeTest { | ||
param ( | ||
[switch]$OnlyEdge, | ||
[switch]$OnlyWebView, | ||
[switch]$NonInteractive | ||
) | ||
|
||
$dashes = "-" * 101 | ||
Write-Output "`n$dashes" | ||
|
||
function Install { | ||
try { | ||
$edgeArgs = @{ | ||
NonInteractive = $true | ||
InstallWebView = $true | ||
} | ||
if (!$edgeInstalled) { $edgeArgs.Add('InstallEdge', $true); Write-Output "" } | ||
|
||
& $removeEdge @edgeArgs | ||
} catch { | ||
Write-Host "`nSomething went wrong trying to update or install Edge: $_" -ForegroundColor Red | ||
if (!$NonInteractive) { Read-Pause } | ||
exit 1 | ||
} | ||
} | ||
|
||
try { | ||
# Install only WebView if Edge is already installed, or if OnlyWebView set | ||
if ($OnlyWebView -or (Test-Path $edgePath)) { | ||
if ($OnlyEdge) { | ||
Write-Output "Edge is already installed, which is good as it's required for this script. :)" | ||
return | ||
} | ||
|
||
$edgeInstalled = $true | ||
Write-Output "Updating Edge WebView 2..." | ||
Install | ||
return | ||
} else { | ||
$edgeInstalled = $false | ||
} | ||
|
||
Write-Output "Microsoft Edge is required to use this script." | ||
choice /c:yn /n /m "Would you like to install Edge? [Y/N] " | ||
if ($LASTEXITCODE -eq 2) { | ||
Read-Pause -NewLine | ||
exit | ||
} | ||
Install | ||
return | ||
} finally { | ||
Write-Output "$dashes`n" | ||
} | ||
} | ||
|
||
Export-ModuleMember -Function Invoke-EdgeTest |
30 changes: 30 additions & 0 deletions
30
src/playbook/Executables/AtlasModules/Scripts/Modules/Explorer/Explorer.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function Get-ExplorerStatus { | ||
if (Get-Process -Name explorer -EA 0) { | ||
$true | ||
} else { | ||
$false | ||
} | ||
} | ||
|
||
function Restart-Explorer { | ||
param ( | ||
[switch]$ExplorerStarted = !(Get-ExplorerStatus) | ||
) | ||
if ($ExplorerStarted) { return } | ||
Stop-Process -Name explorer -Force -EA 0 | ||
} | ||
|
||
|
||
function Start-Explorer { | ||
Start-Process explorer | ||
} | ||
|
||
function Stop-Explorer { | ||
# If Explorer isn't started, return false | ||
if (!(Get-ExplorerStatus)) { return $false } | ||
|
||
taskkill /f /im explorer.exe *>$null | ||
return $true | ||
} | ||
|
||
Export-ModuleMember -Function Get-ExplorerStatus, Restart-Explorer, Start-Explorer, Stop-Explorer |
62 changes: 62 additions & 0 deletions
62
src/playbook/Executables/AtlasModules/Scripts/Modules/WinGet/WinGet.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
function Invoke-WinGetCheck { | ||
param ( | ||
[switch]$NonInteractive, | ||
[switch]$NoDashes, | ||
[switch]$NonFatal | ||
) | ||
|
||
$dashes = '-' * 101 | ||
if (!$Silent -and !$NoDashes) { | ||
Write-Host $dashes | ||
} | ||
|
||
# Check internet by pinging Microsoft | ||
if (!(Test-Connection -ComputerName "www.microsoft.com" -Count 1 -Quiet)) { | ||
if ($NonFatal) { return $false } | ||
|
||
Write-Error "You must have an internet connection to continue." | ||
if (!$NonInteractive) { Read-Pause } | ||
|
||
exit 2 | ||
} | ||
|
||
Write-Host "Checking for WinGet..." | ||
|
||
function WingetError($uri, $action) { | ||
Write-Host @" | ||
You need the latest version of WinGet to use this script. | ||
WinGet is included with 'App Installer' on the Microsoft Store, it's also on GitHub. | ||
"@ -ForegroundColor Yellow | ||
|
||
choice /c:yn /n /m "Would you like to open the Microsoft Store to $action it? [Y/N] " | ||
if ($LASTEXITCODE -eq 1) { | ||
Start-Process $uri | ||
} | ||
exit 3 | ||
} | ||
|
||
# Check if WinGet is installed | ||
if (!(Get-Command "winget" -EA 0)) { | ||
if ($NonFatal) { return $false } | ||
|
||
# Open Microsoft Store for App Installer if not installed | ||
WingetError "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" "install" | ||
} | ||
|
||
# Check WinGet functionality by searching for VSCode | ||
winget search "Microsoft Visual Studio Code" --accept-source-agreements --disable-interactivity --ignore-warnings *>$null | ||
if (!$?) { | ||
if ($Silent) { exit 1 } | ||
|
||
# Open Microsoft Store to update apps if search fails | ||
WingetError "ms-windows-store://downloadsandupdates" "update" | ||
} | ||
|
||
if (!$NoDashes) { | ||
Write-Host "$dashes`n" | ||
} | ||
|
||
return $true | ||
} | ||
|
||
Export-ModuleMember -Function Invoke-WinGetCheck |
58 changes: 58 additions & 0 deletions
58
src/playbook/Executables/AtlasModules/Scripts/WingetCheck.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
param ( | ||
[switch]$NonInteractive, | ||
[switch]$NoDashes, | ||
[switch]$NonFatal | ||
) | ||
|
||
$dashes = '-' * 101 | ||
if (!$Silent -and !$NoDashes) { | ||
Write-Output $dashes | ||
} | ||
|
||
# Check internet by pinging Microsoft | ||
if (!(Test-Connection -ComputerName "www.microsoft.com" -Count 1 -Quiet)) { | ||
if ($NonFatal) { return $false } | ||
|
||
Write-Error "You must have an internet connection to continue." | ||
if (!$NonInteractive) { Read-Pause } | ||
|
||
exit 2 | ||
} | ||
|
||
Write-Output "Checking for WinGet..." | ||
|
||
function WingetError($uri, $action) { | ||
Write-Host @" | ||
You need the latest version of WinGet to use this script. | ||
WinGet is included with 'App Installer' on the Microsoft Store. | ||
"@ -ForegroundColor Yellow | ||
|
||
choice /c:yn /n /m "Would you like to open the Microsoft Store to $action it? [Y/N] " | ||
if ($LASTEXITCODE -eq 1) { | ||
Start-Process $uri | ||
} | ||
exit 3 | ||
} | ||
|
||
# Check if WinGet is installed | ||
if (!(Get-Command "winget" -EA 0)) { | ||
if ($NonFatal) { return $false } | ||
|
||
# Open Microsoft Store for App Installer if not installed | ||
WingetError "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" "install" | ||
} | ||
|
||
# Check WinGet functionality by searching for VSCode | ||
winget search "Microsoft Visual Studio Code" --accept-source-agreements --disable-interactivity --ignore-warnings *>$null | ||
if (!$?) { | ||
if ($Silent) { exit 1 } | ||
|
||
# Open Microsoft Store to update apps if search fails | ||
WingetError "ms-windows-store://downloadsandupdates" "update" | ||
} | ||
|
||
if (!$NoDashes) { | ||
Write-Output "$dashes`n" | ||
} | ||
|
||
return $true |