mirror of
https://github.com/zoicware/RemoveWindowsAI.git
synced 2026-01-11 02:04:44 +01:00
This commit is contained in:
@@ -273,9 +273,17 @@ function Disable-Registry-Keys {
|
||||
$config = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Local State"
|
||||
if (Test-Path $config) {
|
||||
#powershell core bug where json that has empty strings will error
|
||||
#$jsonContent = (Get-Content $config).Replace('""', '"_empty"') | ConvertFrom-Json
|
||||
$jsonContent = (Get-Content $config -Raw) -replace '(?<!\\)""', '"_empty"' -replace '{\s*}', '{"_empty":"_empty"}' | ConvertFrom-Json
|
||||
try {
|
||||
$jsonContent = (Get-Content $config).Replace('""', '"_empty"') | ConvertFrom-Json -ErrorAction Stop
|
||||
$fail = $false
|
||||
}
|
||||
catch {
|
||||
Write-Status -msg 'Unable to set Edge flags to disable Copilot due to a different langauge being used' -errorOutput $true
|
||||
Write-Status -msg 'You can manually disable the Copilot flags at [edge://flags] in the browser' -errorOutput $true
|
||||
$fail = $true
|
||||
}
|
||||
|
||||
if (!$fail) {
|
||||
try {
|
||||
if (($jsonContent.browser | Get-Member -MemberType NoteProperty enabled_labs_experiments -ErrorAction Stop) -eq $null) {
|
||||
$jsonContent.browser | Add-Member -MemberType NoteProperty -Name enabled_labs_experiments -Value @()
|
||||
@@ -305,6 +313,7 @@ function Disable-Registry-Keys {
|
||||
Write-Status -msg 'Edge Browser has never been opened on this machine unable to set flags...' -errorOutput $true
|
||||
Write-Status -msg 'Open Edge once and run this tweak again' -errorOutput $true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user