Added button to Remove Xbox fully from Windows

- Once removed, to restore you need to download the apps and enable services manually
- Refactored Remove UWP apps function into a module
- Improve some output for the console
- If Intel GPU detected will install DSA too, sorry if already installed on Intel CPU
- Added Warning color to layout
main
Plínio Larrubia 3 years ago committed by Plínio Larrubia
parent 5cdcceba8a
commit 658d4de61f
No known key found for this signature in database
GPG Key ID: 057B0A87CB137C69

@ -74,6 +74,7 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 |
<summary>Click to expand</summary>
- `Apply Tweaks`: Run every 'non-interactive' Tweak scripts;
- `Remove Xbox from Windows`: Wipe Xbox Apps, disable Services related to Xbox and GameBar/GameDVR;
- `Repair Windows`: Try to Completely fix the Windows worst problems via Command Line; ([`backup-system.ps1`](./src/scripts/backup-system.ps1) and [`repair-windows.ps1`](./src/scripts/repair-windows.ps1))
- `Reinstall Pre-Installed Apps`: Rebloat Windows with all the Pre-Installed Apps; ([`reinstall-pre-installed-apps.ps1`](./src/utils/reinstall-pre-installed-apps.ps1))
- `Revert Tweaks`: Re-apply some tweaks and [Revert] all possible ones, covering the `Scheduled Tasks`, `Services`, `Privacy and Performance`, `Personal` and `Optional Features` tweaks;

@ -59,6 +59,9 @@ function Show-GUI() {
# Panel 1 ~> Small Buttons
$NextYLocation = $ApplyTweaks.Location.Y + $ApplyTweaks.Height + $DistanceBetweenButtons
$RemoveXbox = Create-Button -Text "Remove Xbox from Windows" -Width $SBWidth -Height $SBHeight -LocationX $ButtonX -LocationY $NextYLocation -FontSize $FontSize1 -ForeColor $WarningColor
$NextYLocation = $RemoveXbox.Location.Y + $RemoveXbox.Height + $DistanceBetweenButtons
$RepairWindows = Create-Button -Text "Repair Windows" -Width $SBWidth -Height $SBHeight -LocationX $ButtonX -LocationY $NextYLocation -FontSize $FontSize1
$NextYLocation = $RepairWindows.Location.Y + $RepairWindows.Height + $DistanceBetweenButtons
@ -399,7 +402,7 @@ function Show-GUI() {
$Form.Controls.AddRange(@($Panel1, $Panel2, $Panel3))
# Add Elements to each Panel
$Panel1.Controls.AddRange(@($TitleLabel1, $ApplyTweaks, $RepairWindows, $InstallOneDrive, $ReinstallBloatApps, $PictureBox1))
$Panel1.Controls.AddRange(@($TitleLabel1, $ApplyTweaks, $RemoveXbox, $RepairWindows, $InstallOneDrive, $ReinstallBloatApps, $PictureBox1))
$Panel2.Controls.AddRange(@($TitleLabel2, $RevertScript, $DarkMode, $LightMode, $EnableSearchIdx, $DisableSearchIdx, $EnableBgApps, $DisableBgApps, $EnableTelemetry, $DisableTelemetry, $EnableCortana, $DisableCortana))
$Panel3.Controls.AddRange(@($TitleLabel3, $CaptionLabel1))
$Panel3.Controls.AddRange(@($Panel3_1, $Panel3_2))
@ -455,6 +458,23 @@ function Show-GUI() {
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
})
$RemoveXbox.Add_Click( {
Push-Location -Path "$PSScriptRoot\src\utils\"
Get-ChildItem -Recurse *.ps*1 | Unblock-File
$Scripts = @(
"remove-xbox-from-windows.ps1"
)
ForEach ($FileName in $Scripts) {
Write-TitleCounter -Text "$FileName" -MaxNum $Scripts.Length
Import-Module -DisableNameChecking .\"$FileName" -Force
}
Pop-Location
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
})
$RepairWindows.Add_Click( {
Push-Location -Path "$PSScriptRoot\src\scripts\"
Get-ChildItem -Recurse *.ps*1 | Unblock-File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 225 KiB

@ -137,6 +137,7 @@ function Set-GUILayout() {
$Global:LightBlue = "#00ffff"
$Global:LightGray = "#eeeeee"
$Global:WinDark = "#252525"
$Global:WarningColor = "#eed202"
# <== GUI ELEMENT LAYOUT ==>

@ -0,0 +1,23 @@
function Remove-UWPApps() {
[CmdletBinding()] #<<-- This turns a regular function into an advanced function
param (
[Array] $Apps
)
ForEach ($Bloat in $Apps) {
If ((Get-AppxPackage -AllUsers -Name $Bloat) -or (Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat)) {
Write-Host "[-][UWP] Trying to remove $Bloat ..."
Get-AppxPackage -AllUsers -Name $Bloat | Remove-AppxPackage # App
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -AllUsers # Payload
}
Else {
Write-Warning "[?][UWP] $Bloat was already removed or not found."
}
}
}

@ -5,7 +5,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Install-DriversUpdaters() {
$Ask = "Do you plan to play games on this PC?
All the following Driver Updaters will be installed.
All the following Driver Updaters will be installed:
+ $CPU driver updater (if found)
+ $GPU driver updater (if found)"
@ -13,11 +13,12 @@ function Install-DriversUpdaters() {
'Yes' {
# Check for CPU drivers
If ($CPU.contains("AMD")) {
Write-Section -Text "Installing AMD $CPU chipset drivers updaters!"
Write-Warning "Search for $CPU chipset driver on the AMD website."
Write-Warning "This will only download an updater if AMD makes one."
}
ElseIf ($CPU.contains("Intel")) {
Write-Section -Text "Installing Intel $CPU chipset drivers!"
Write-Section -Text "Installing Intel $CPU chipset drivers updaters!"
Write-Caption -Text "Installing: intel-dsa"
winget install --silent --source "winget" --id "Intel.IntelDriverAndSupportAssistant" | Out-Host # Intel® Driver & Support Assistant (Intel® DSA)
}
@ -30,7 +31,9 @@ function Install-DriversUpdaters() {
}
If ($GPU.contains("Intel")) {
Write-Section -Text "Intel $GPU Graphics driver!"
Write-Section -Text "Intel $GPU Graphics driver updater already included!"
Write-Caption -Text "Installing: intel-dsa"
winget install --silent --source "winget" --id "Intel.IntelDriverAndSupportAssistant" | Out-Host # Intel® Driver & Support Assistant (Intel® DSA)
}
If ($GPU.contains("NVIDIA")) {

@ -4,7 +4,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Install-GamingPackages() {
$Ask = "Do you plan to play games on this PC?
All the following Gaming Dependencies will be installed.
All the following Gaming Dependencies will be installed:
+ Microsoft DirectX
+ Microsoft .NET (Framework, Runtime & SDK)
+ Microsoft Visual C++ Packages (2005-2022)"

@ -68,7 +68,7 @@ function Optimize-Services() {
ForEach ($Service in $DisableServices) {
If (Get-Service $Service -ErrorAction SilentlyContinue) {
If (($Revert -eq $true) -and ($Service -match "RemoteRegistry")) {
Write-Warning "[?][Services] Skipping $Service to avoid a security breach..."
Write-Warning "[?][Services] Skipping $Service to avoid a security vulnerability..."
Continue
}
Write-Host "$($EnableStatus[0]) $Service at Startup..."

@ -1,3 +1,4 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"remove-uwp-apps.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Remove-BloatwareApps() {
@ -139,21 +140,7 @@ function Remove-BloatwareApps() {
#"Windows.ContactSupport"
)
ForEach ($Bloat in $Apps) {
If ((Get-AppxPackage -AllUsers -Name $Bloat) -or (Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat)) {
Write-Host "[-][UWP] Trying to remove $Bloat ..."
Get-AppxPackage -AllUsers -Name $Bloat | Remove-AppxPackage # App
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -AllUsers # Payload
}
Else {
Write-Warning "[?][UWP] $Bloat was already removed or not found."
}
}
Remove-UWPApps -Apps $Apps
}
function Main() {

@ -1,7 +1,7 @@
function Main() {
Write-Host "[-] Disabling Search Indexing (Recommended for HDDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Stop-Service "WSearch" -Force -NoWait
Write-Host "[-][Services] Disabling Search Indexing (Recommended for HDDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Stop-Service "WSearch" -Force -NoWait
}
Main

@ -1,7 +1,7 @@
function Main() {
Write-Host "[+] Enabling Search Indexing (Recommended for SSDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Automatic
Start-Service "WSearch"
Write-Host "[+][Services] Enabling Search Indexing (Recommended for SSDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Automatic
Start-Service "WSearch"
}
Main

@ -0,0 +1,63 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"remove-uwp-apps.psm1"
function Remove-Xbox() {
$Global:PathToLMPoliciesGameDVR = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR"
$Ask = "This will remove all Xbox apps
and Disable Xbox services (Except from Accessories)"
switch (Show-Question -Title "Warning" -Message $Ask) {
'Yes' {
Write-Host "[-][Services] Disabling Xbox Services (Except from Accessories)..."
Get-Service -Name "XblAuthManager" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Get-Service -Name "XblGameSave" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Get-Service -Name "XboxNetApiSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Stop-Service "XblAuthManager" -Force -NoWait
Stop-Service "XblGameSave" -Force -NoWait
Stop-Service "XboxNetApiSvc" -Force -NoWait
# Only disable if you'll not get ANY Xbox Accessory (Xbox Wireless Controller, Xbox Wireless Receiver, Steering Wheel, etc.)
#Get-Service -Name "XboxGipSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
#Stop-Service "XboxGipSvc" -Force -NoWait
Write-Host "[-][UWP] Wiping Xbox completely from Windows..."
$XboxApps = @(
"Microsoft.XboxApp" # Xbox Console Companion (Replaced by new App)
"Microsoft.XboxGameCallableUI"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxSpeechToTextOverlay"
"Microsoft.XboxGamingOverlay" # Xbox Game Bar
"Microsoft.XboxIdentityProvider" # Xbox Identity Provider (Xbox Dependency)
"Microsoft.Xbox.TCUI" # Xbox Live API communication (Xbox Dependency)
)
Remove-UWPApps -Apps $XboxApps
Write-Host "[-][Priv&Perf] Disabling Xbox Game Bar & Game DVR..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Name "value" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0
If (!(Test-Path "$PathToLMPoliciesGameDVR")) {
New-Item -Path "$PathToLMPoliciesGameDVR" -Force | Out-Null
}
Set-ItemProperty -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR" -Type DWord -Value 0
}
'No' {
Write-Host "You choose No. (No = Cancel)"
}
'Cancel' {
# With Yes, No and Cancel, the user can press Esc to exit
Write-Host "You choose Cancel. (Cancel = No)"
}
}
}
function Main() {
Remove-Xbox # Remove all Xbox related Apps, services, etc.
}
Main
Loading…
Cancel
Save