Check if registry path exists before deleting

- Update button name for Xbox Game tweaks
main
Plínio Larrubia 2 years ago committed by Plínio Larrubia
parent f838d573e2
commit 373d963189
No known key found for this signature in database
GPG Key ID: 057B0A87CB137C69

@ -177,7 +177,7 @@ function Show-GUI() {
$CbSearchAppForUnknownExt = New-CheckBox -Text "Enable Search App for Unknown Ext." -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbPhotoViewer
$CbTelemetry = New-CheckBox -Text "Enable Telemetry" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbSearchAppForUnknownExt
$CbWSearchService = New-CheckBox -Text "Enable WSearch Service" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbTelemetry
$CbXboxGameBarDVRandMode = New-CheckBox -Text "Enable Xbox Game: Bar/DVR/Mode" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbWSearchService
$CbXboxGameBarDVRandMode = New-CheckBox -Text "Enable Xbox Game Bar/DVR/Mode" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbWSearchService
$ClOptionalFeatures = New-Label -Text "Optional Features" -Width $PanelWidth -Height $CaptionLabelHeight -LocationX 0 -ElementBefore $CbXboxGameBarDVRandMode
$CbInternetExplorer = New-CheckBox -Text "Internet Explorer" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $ClOptionalFeatures
@ -691,10 +691,10 @@ function Show-GUI() {
$CbXboxGameBarDVRandMode.Add_Click( {
If ($CbXboxGameBarDVRandMode.CheckState -eq "Checked") {
Enable-XboxGameBarDVRandMode
$CbXboxGameBarDVRandMode.Text = "[ON] Xbox Game: Bar/DVR/Mode *"
$CbXboxGameBarDVRandMode.Text = "[ON] Xbox Game Bar/DVR/Mode *"
} Else {
Disable-XboxGameBarDVRandMode
$CbXboxGameBarDVRandMode.Text = "[OFF] Xbox Game: Bar/DVR/Mode"
$CbXboxGameBarDVRandMode.Text = "[OFF] Xbox Game Bar/DVR/Mode"
}
})

@ -8,9 +8,10 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
$DesktopPath = [Environment]::GetFolderPath("Desktop");
$PathToLMPoliciesCloudContent = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$PathToLMPoliciesSystem = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System"
$PathToLMPoliciesAppGameDVR = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR"
$PathToLMPoliciesCortana = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
$PathToLMPoliciesGameDVR = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR"
$PathToLMPoliciesSystem = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System"
$PathToCUClipboard = "HKCU:\Software\Microsoft\Clipboard"
$PathToCUOnlineSpeech = "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy"
$PathToCUThemes = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
@ -347,7 +348,7 @@ function Enable-WSearchService() {
function Disable-XboxGameBarDVRandMode() {
# Adapted from: https://docs.microsoft.com/en-us/answers/questions/241800/completely-disable-and-remove-xbox-apps-and-relate.html
Write-Status -Types "-", "Performance" -Status "Disabling Xbox Game Bar DVR..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Name "value" -Type DWord -Value 0
Set-ItemProperty -Path "$PathToLMPoliciesAppGameDVR" -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")) {
@ -373,7 +374,9 @@ function Disable-XboxGameBarDVRandMode() {
function Enable-XboxGameBarDVRandMode() {
Write-Status -Types "*", "Performance" -Status "Enabling Xbox Game Bar DVR..."
Write-Status -Types "*", "Performance" -Status "Removing GameDVR policies..."
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Recurse
If ((Test-Path "$PathToLMPoliciesAppGameDVR")) {
Remove-Item -Path "$PathToLMPoliciesAppGameDVR" -Recurse
}
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 1
If (!(Test-Path "$PathToLMPoliciesGameDVR")) {
@ -395,5 +398,4 @@ function Enable-XboxGameBarDVRandMode() {
Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter"
Write-Status -Types "*", "Performance" -Status "Enabling GameBar Presence Writer..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" -Name "ActivationType" -Type DWord -Value 1
}

Loading…
Cancel
Save