Skip to content

Instantly share code, notes, and snippets.

@ashdar
Created March 16, 2023 11:54
Show Gist options
  • Save ashdar/89aeeaec3086e343732c74b7ec45e5a8 to your computer and use it in GitHub Desktop.
Save ashdar/89aeeaec3086e343732c74b7ec45e5a8 to your computer and use it in GitHub Desktop.

Revisions

  1. ashdar created this gist Mar 16, 2023.
    65 changes: 65 additions & 0 deletions Disable-BingButtonEdge.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    <#
    .SYNOPSIS
    If you don't like the 'Bing' Button that Edge wants to display, you can use this script to turn it off.
    .NOTE
    Ultimately, we are just setting a registry entry. You can also do this via Active Directory policies (and a couple of other ways).
    There is another, per-user rather than whole-machine, registry entry that you can set. (This is per a thread on Reddit, but I did
    not bookmark that thread and I don't have time to search for it now...)
    .LINK
    https://learn.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-keys?view=powershell-7.3
    .LINK
    https://devblogs.microsoft.com/scripting/update-or-add-registry-key-value-with-powershell/
    .LINK
    https://techdows.com/2023/03/disable-or-remove-bing-button-microsoft-edge.html
    #>
    #Requires -RunAsAdministrator

    $Path = "HKLM:\SOFTWARE\Policies\Microsoft"

    $RegistryKeyPath = $Path + '\' + 'Edge'
    $RegistryEntryName = "HubsSidebarEnabled"
    $RegistryEntryValue = "0"

    if (test-path $RegistryKeyPath) {
    $Message = "The Registry Key '{0}' already exists." -f @($RegistryKeyPath)
    Write-Verbose -Verbose -Message $Message
    Get-ChildItem -Path $RegistryKeyPath
    }
    else {
    $Message = "The Registry Key does not exist. Creating...."
    Write-Verbose -Verbose -Message $Message
    New-Item -Path $RegistryKeyPath | Out-Null
    }

    if (Get-ItemProperty -Path $RegistryKeyPath -name $RegistryEntryName -ErrorAction SilentlyContinue) {
    $Message = "The Registry Entry already exists."
    Write-Verbose -Verbose -Message $Message
    }
    else {
    $Message = "The Registry Entry does not exist. Creating...."
    Write-Verbose -Verbose -Message $Message
    New-ItemProperty -Path $RegistryKeyPath -Name $RegistryEntryName -Value $RegistryEntryValue -PropertyType 'DWORD' -Force | Out-Null
    }

    $Message = "This is the Registry Entry and its' path:"
    Write-Verbose -Verbose -Message $Message
    Get-ItemProperty HKLM:\software\Policies\Microsoft\Edge -name $RegistryEntryName

    Get-ChildItem -Path $RegistryKeyPath -Recurse
    $ValuePath = $RegistryKeyPath + '\' + $RegistryEntryName


    # Some output for the user, as a reminder of a next step...
    $Message = "You should not need to reboot the computer."
    Write-Verbose -Verbose $Message
    $Message = "You should be able to restart Edge and see the Bing Button has disappeared."
    Write-Verbose -Verbose $Message
    $Message = "If the 'Bing' button is still being shown, try pasting 'settings://policies' into the Edge address bar, press 'Enter' and then click the 'Reload Policies' button."
    Write-Verbose -Verbose $Message