├── .gitignore ├── .github └── workflows │ └── push.yml ├── README.md ├── LICENCE ├── powershell_script ├── cleanup.ps1 └── edge.ps1 └── edge.bat /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | test.ps1 3 | -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Push to padsalatushal.githbub.io 2 | 3 | on: push 4 | 5 | jobs: 6 | copy-file: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | 12 | - name: Push to another repo 13 | uses: dmnemec/copy_file_to_another_repo_action@main 14 | env: 15 | API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 16 | with: 17 | source_file: 'edge.bat' 18 | destination_repo: 'padsalatushal/padsalatushal.github.io' 19 | user_email: 'padsalatushal@email.com' # your email 20 | user_name: 'padsalatushal' # your login 21 | commit_message: 'update from source repo' 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Edge-Removal 2 | 3 | ## Description 4 | - This script remove edge completely from windows 5 | - Requires you to Run Script file ADMINISTRATOR! (if you don't use launch command) 6 | 7 | ## Demo 8 | ![ezgif com-gif-maker](https://user-images.githubusercontent.com/57517785/200296891-13b724e5-e3c4-4224-9d32-d3eb9a59ab9d.gif) 9 | 10 | ## Launch Command (Powershell) : 11 | ```bash 12 | irm overflows.live/edge | iex 13 | ``` 14 | Or 15 | ```bash 16 | iwr -useb https://padsalatushal.github.io/edge.bat | iex 17 | ``` 18 | 19 | If you are having TLS 1.2 Issues or You cannot find or resolve host then run with the following command: 20 | 21 | ```bash 22 | [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/padsalatushal/Edge-Removal/main/Edge_Removal.bat') 23 | ``` 24 | 25 | ## Resources 26 | 27 | https://github.com/AveYo/fox 28 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Padsala Tushal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /powershell_script/cleanup.ps1: -------------------------------------------------------------------------------- 1 | 2 | ## targets 3 | $remove_win32 = "Microsoft Edge", "Microsoft Edge Update", "Microsoft EdgeWebView" 4 | $remove_appx = "MicrosoftEdge", "Win32WebViewHost" 5 | 6 | ## set useless policies 7 | foreach ($p in 'HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node') { 8 | $path = "$p\Microsoft\EdgeUpdate" 9 | Write-Host " setting useless policies" 10 | Write-Host $path 11 | Set-ItemProperty -Path $path -Name "InstallDefault" -Value 0 -Force > $null 2>&1 12 | Set-ItemProperty -Path $path -Name "Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -Value 0 -Force > $null 2>&1 13 | Set-ItemProperty -Path $path -Name "Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" -Value 1 -Force > $null 2>&1 14 | Set-ItemProperty -Path $path -Name "DoNotUpdateToEdgeWithChromium" -Value 1 -Force > $null 2>&1 15 | } 16 | 17 | $edgeupdate = 'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 18 | 19 | foreach ($p in 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node') { 20 | $path = "$p\$edgeupdate\Commands\on-logon-autolaunch" 21 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 22 | $path = "$p\$edgeupdate\Commands\on-logon-startup-boost" 23 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 24 | $path = "$p\$edgeupdate\Commands\on-os-upgrade" 25 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 26 | } 27 | 28 | ## clear win32 uninstall block 29 | foreach ($hk in 'HKCU:', 'HKLM:') { 30 | foreach ($wow in '', '\Wow6432Node') { 31 | foreach ($i in $remove_win32) { 32 | $path = "$hk\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall\$i" 33 | Remove-ItemProperty -Path $path -Name NoRemove -Force -ErrorAction SilentlyContinue 34 | Set-ItemProperty -Path $path -Name AllowUninstall -Value 1 -Force > $null 2>&1 35 | } 36 | } 37 | } 38 | 39 | ## find all Edge setup.exe and gather BHO paths 40 | $setup = "" 41 | $bho = "$env:ProgramData\ie_to_edge_stub.exe","$env:Public\ie_to_edge_stub.exe" 42 | 43 | "LocalApplicationData", "ProgramFilesX86", "ProgramFiles" | ForEach-Object { 44 | $setup += Get-ChildItem "$([Environment]::GetFolderPath($_))\Microsoft\Edge*\setup.exe" -Recurse -ErrorAction SilentlyContinue 45 | $bho += Get-ChildItem "$([Environment]::GetFolderPath($_))\Microsoft\Edge*\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue 46 | } 47 | Write-Host "Printing BHo" 48 | # Write-Host $bho 49 | 50 | ## shut edge down 51 | $processesToKill = 'MicrosoftEdgeUpdate','chredge','msedge','edge','msedgewebview2','Widgets' 52 | 53 | foreach ($processName in $processesToKill) { 54 | Get-Process -Name $processName -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process $_ -Force } 55 | } 56 | 57 | # Use dedicated C:\Scripts path due to Sigma rules FUD 58 | $DIR = "$env:SystemDrive\Scripts" 59 | $null = mkdir $DIR -ErrorAction SilentlyContinue 60 | 61 | # Export OpenWebSearch innovative redirector 62 | foreach ($b in $bho) { 63 | if (Test-Path $b) { 64 | try { 65 | Copy-Item $b "$DIR\ie_to_edge_stub.exe" -Force -ErrorAction SilentlyContinue 66 | } catch { } 67 | } 68 | } 69 | 70 | # Clear appx uninstall block and remove 71 | $provisioned = Get-AppxProvisionedPackage -Online 72 | $appxpackage = Get-AppxPackage -AllUsers 73 | $store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore' 74 | $store_reg = ($store) 75 | 76 | Write-Host "line 74" 77 | Write-Host $store_reg 78 | $users = 'S-1-5-18' 79 | 80 | if (Test-Path $store) { 81 | $users += (Get-ChildItem $store | Where-Object { $_ -like '*S-1-5-21*' }).PSChildName 82 | } 83 | 84 | foreach ($choice in $remove_appx) { 85 | if ('' -eq $choice.Trim()) { continue } 86 | 87 | foreach ($appx in $provisioned | Where-Object { $_.PackageName -like "*$choice*" }) { 88 | $PackageFamilyName = ($appxpackage | Where-Object { $_.Name -eq $appx.DisplayName }).PackageFamilyName 89 | Write-Host $PackageFamilyName 90 | $path = "$store_reg\Deprovisioned\$PackageFamilyName" 91 | New-Item -Path '$store_reg\Deprovisioned\$PackageFamilyName' -Name '' -Value '' -Force 92 | # cmd /c "reg add ""$store_reg\Deprovisioned\$PackageFamilyName"" /f >nul 2>nul" 93 | cmd /c "dism /online /remove-provisionedappxpackage /packagename:$($appx.PackageName) >nul 2>nul" 94 | # Set-ItemProperty -Path $path -Name CommandLine -Value 'systray.exe' -Force > $null 2>&1 95 | # dism /online /remove-provisionedappxpackage /packagename:$appxPackageName >$null 2>&1 96 | 97 | #powershell -nop -c remove-appxprovisionedpackage -packagename "'$($appx.PackageName)'" -online 2>&1 >'' 98 | } 99 | 100 | foreach ($appx in $appxpackage | Where-Object { $_.PackageFullName -like "*$choice*" }) { 101 | $inbox = (Get-ItemProperty "$store\InboxApplications\*$($appx.Name)*").Path.PSChildName 102 | $PackageFamilyName = $appx.PackageFamilyName 103 | $PackageFullName = $appx.PackageFullName 104 | 105 | foreach ($app in $inbox) { 106 | Write-Host "listing on inbox" 107 | write-host $inbox 108 | cmd /c "reg delete ""$store_reg\InboxApplications\$app"" /f >nul 2>nul" 109 | } 110 | 111 | $registryPath = "$store_reg\Deprovisioned\$PackageFamilyName" 112 | New-Item -Path $registryPath -Force | Out-Null 113 | Write-Host "LIne 110" 114 | Write-Host $registryPath 115 | cmd /c "reg add ""$store_reg\Deprovisioned\$PackageFamilyName"" /f >nul 2>nul" 116 | 117 | # Set-ItemProperty -Path $registryPath -Force -ErrorAction SilentlyContinue 118 | 119 | 120 | foreach ($sid in $users) { 121 | $registryPath = "$store_reg\EndOfLife\$sid\$PackageFullName" 122 | # New-Item -Path $registryPath -Force | Out-Null 123 | cmd /c "reg add ""$store_reg\EndOfLife\$sid\$PackageFullName"" /f >nul 2>nul" 124 | # Set-ItemProperty -Path $registryPath -Force -ErrorAction SilentlyContinue 125 | 126 | } 127 | cmd /c "dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >nul 2>nul" 128 | powershell -nop -c "remove-appxpackage -package '$PackageFullName' -AllUsers" 2>&1 >'' 129 | # dism /Online /Set-NonRemovableAppPolicy /PackageFamily:$PackageFamilyName /NonRemovable:0 >$null 2>&1 130 | # Remove-AppxPackage -Package $PackageFullName -AllUsers | Out-Null 131 | 132 | foreach ($sid in $users) { 133 | $registryPath = "$store_reg\EndOfLife\$sid\$PackageFullName" 134 | cmd /c "reg delete ""$store_reg\EndOfLife\$sid\$PackageFullName"" /f >nul 2>nul" 135 | # Remove-Item -Path $registryPath -Force -ErrorAction SilentlyContinue 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /powershell_script/edge.ps1: -------------------------------------------------------------------------------- 1 | 2 | ## targets 3 | $remove_win32 = "Microsoft Edge", "Microsoft Edge Update", "Microsoft EdgeWebView" 4 | $remove_appx = "MicrosoftEdge", "Win32WebViewHost" 5 | 6 | ## set useless policies 7 | foreach ($p in 'HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node') { 8 | $path = "$p\Microsoft\EdgeUpdate" 9 | Write-Host " setting useless policies" 10 | Write-Host $path 11 | Set-ItemProperty -Path $path -Name "InstallDefault" -Value 0 -Force > $null 2>&1 12 | Set-ItemProperty -Path $path -Name "Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" -Value 0 -Force > $null 2>&1 13 | Set-ItemProperty -Path $path -Name "Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" -Value 1 -Force > $null 2>&1 14 | Set-ItemProperty -Path $path -Name "DoNotUpdateToEdgeWithChromium" -Value 1 -Force > $null 2>&1 15 | } 16 | 17 | $edgeupdate = 'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 18 | 19 | foreach ($p in 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node') { 20 | $path = "$p\$edgeupdate\Commands\on-logon-autolaunch" 21 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 22 | $path = "$p\$edgeupdate\Commands\on-logon-startup-boost" 23 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 24 | $path = "$p\$edgeupdate\Commands\on-os-upgrade" 25 | Set-ItemProperty -Path $path -Name "CommandLine" -Value 'systray.exe' -Force > $null 2>&1 26 | } 27 | 28 | ## clear win32 uninstall block 29 | foreach ($hk in 'HKCU:', 'HKLM:') { 30 | foreach ($wow in '', '\Wow6432Node') { 31 | foreach ($i in $remove_win32) { 32 | $path = "$hk\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall\$i" 33 | Remove-ItemProperty -Path $path -Name NoRemove -Force -ErrorAction SilentlyContinue 34 | Set-ItemProperty -Path $path -Name AllowUninstall -Value 1 -Force > $null 2>&1 35 | } 36 | } 37 | } 38 | 39 | ## find all Edge setup.exe and gather BHO paths 40 | $setup = "" 41 | $bho = "$env:ProgramData\ie_to_edge_stub.exe","$env:Public\ie_to_edge_stub.exe" 42 | 43 | "LocalApplicationData", "ProgramFilesX86", "ProgramFiles" | ForEach-Object { 44 | $setup += Get-ChildItem "$([Environment]::GetFolderPath($_))\Microsoft\Edge*\setup.exe" -Recurse -ErrorAction SilentlyContinue 45 | $bho += Get-ChildItem "$([Environment]::GetFolderPath($_))\Microsoft\Edge*\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue 46 | } 47 | Write-Host "Printing BHo" 48 | Write-Host $bho 49 | 50 | ## shut edge down 51 | $processesToKill = 'MicrosoftEdgeUpdate','chredge','msedge','edge','msedgewebview2','Widgets' 52 | 53 | foreach ($processName in $processesToKill) { 54 | Get-Process -Name $processName -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process $_ -Force } 55 | } 56 | 57 | # Use dedicated C:\Scripts path due to Sigma rules FUD 58 | $DIR = "$env:SystemDrive\Scripts" 59 | $null = mkdir $DIR -ErrorAction SilentlyContinue 60 | 61 | # Export OpenWebSearch innovative redirector 62 | foreach ($b in $bho) { 63 | if (Test-Path $b) { 64 | try { 65 | Copy-Item $b "$DIR\ie_to_edge_stub.exe" -Force -ErrorAction SilentlyContinue 66 | } catch { } 67 | } 68 | } 69 | 70 | # Clear appx uninstall block and remove 71 | $provisioned = Get-AppxProvisionedPackage -Online 72 | $appxpackage = Get-AppxPackage -AllUsers 73 | $store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore' 74 | $store_reg = ($store) 75 | 76 | # Write-Host "line 74" 77 | # Write-Host $store_reg 78 | $users = 'S-1-5-18' 79 | 80 | if (Test-Path $store) { 81 | $users += (Get-ChildItem $store | Where-Object { $_ -like '*S-1-5-21*' }).PSChildName 82 | } 83 | 84 | foreach ($choice in $remove_appx) { 85 | if ('' -eq $choice.Trim()) { continue } 86 | 87 | foreach ($appx in $provisioned | Where-Object { $_.PackageName -like "*$choice*" }) { 88 | $PackageFamilyName = ($appxpackage | Where-Object { $_.Name -eq $appx.DisplayName }).PackageFamilyName 89 | Write-Host $PackageFamilyName 90 | $path = "$store_reg\Deprovisioned\$PackageFamilyName" 91 | New-Item -Path $path -Name '' -Value '' -Force 92 | # cmd /c "reg add ""$store_reg\Deprovisioned\$PackageFamilyName"" /f >nul 2>nul" 93 | cmd /c "dism /online /remove-provisionedappxpackage /packagename:$($appx.PackageName) >nul 2>nul" 94 | # Set-ItemProperty -Path $path -Name CommandLine -Value 'systray.exe' -Force > $null 2>&1 95 | # dism /online /remove-provisionedappxpackage /packagename:$appxPackageName >$null 2>&1 96 | 97 | #powershell -nop -c remove-appxprovisionedpackage -packagename "'$($appx.PackageName)'" -online 2>&1 >'' 98 | } 99 | 100 | foreach ($appx in $appxpackage | Where-Object { $_.PackageFullName -like "*$choice*" }) { 101 | $inbox = (Get-ItemProperty "$store\InboxApplications\*$($appx.Name)*").Path.PSChildName 102 | $PackageFamilyName = $appx.PackageFamilyName 103 | $PackageFullName = $appx.PackageFullName 104 | Write-Host "LIne 98" 105 | Write-Host $PackageFullName 106 | 107 | foreach ($app in $inbox) { 108 | $registryPath = "$store_reg\Deprovisioned\$PackageFamilyName" 109 | Write-Host "LINE 103" 110 | Write-Host $registryPath 111 | cmd /c "reg delete ""$store_reg\InboxApplications\$app"" /f >nul 2>nul" 112 | # Remove-ItemProperty -Path $registryPath -Name PropertyName -Force -ErrorAction SilentlyContinue 113 | } 114 | 115 | $registryPath = "$store_reg\Deprovisioned\$PackageFamilyName" 116 | New-Item -Path $registryPath -Force | Out-Null 117 | Write-Host "LIne 110" 118 | Write-Host $registryPath 119 | cmd /c "reg add ""$store_reg\Deprovisioned\$PackageFamilyName"" /f >nul 2>nul" 120 | 121 | # Set-ItemProperty -Path $registryPath -Force -ErrorAction SilentlyContinue 122 | 123 | 124 | foreach ($sid in $users) { 125 | $registryPath = "$store_reg\EndOfLife\$sid\$PackageFullName" 126 | # New-Item -Path $registryPath -Force | Out-Null 127 | cmd /c "reg add ""$store_reg\EndOfLife\$sid\$PackageFullName"" /f >nul 2>nul" 128 | # Set-ItemProperty -Path $registryPath -Force -ErrorAction SilentlyContinue 129 | 130 | } 131 | cmd /c "dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >nul 2>nul" 132 | powershell -nop -c "remove-appxpackage -package '$PackageFullName' -AllUsers" 2>&1 >'' 133 | # dism /Online /Set-NonRemovableAppPolicy /PackageFamily:$PackageFamilyName /NonRemovable:0 >$null 2>&1 134 | # Remove-AppxPackage -Package $PackageFullName -AllUsers | Out-Null 135 | 136 | foreach ($sid in $users) { 137 | $registryPath = "$store_reg\EndOfLife\$sid\$PackageFullName" 138 | cmd /c "reg delete ""$store_reg\EndOfLife\$sid\$PackageFullName"" /f >nul 2>nul" 139 | # Remove-Item -Path $registryPath -Force -ErrorAction SilentlyContinue 140 | } 141 | } 142 | } 143 | 144 | ## shut edge down, again 145 | $processesToKill = 'MicrosoftEdgeUpdate','chredge','msedge','edge','msedgewebview2','Widgets' 146 | 147 | foreach ($processName in $processesToKill) { 148 | Get-Process -Name $processName -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process $_ -Force } 149 | } 150 | 151 | # brute-run found Edge setup.exe with uninstall args 152 | 153 | $purge = '--uninstall --system-level --force-uninstall' 154 | if ($also_remove_webview -eq 1){ 155 | foreach ($s in $setup) { 156 | try { 157 | Start-Process -Wait $s -ArgumentList "--msedgewebview $purge" 158 | } catch { 159 | # Catch any errors if the process fails 160 | } 161 | } 162 | } 163 | foreach ($s in $setup) { 164 | try { 165 | Start-Process -Wait $s -ArgumentList "--msedge $purge" 166 | } catch { 167 | # Catch any errors if the process fails 168 | } 169 | } 170 | 171 | # prevent latest cumulative update (LCU) failing due to non-matching EndOfLife Edge entries 172 | foreach ($i in $remove_appx) { 173 | Get-ChildItem "$store\EndOfLife" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_ -like "*${i}*" } | ForEach-Object { 174 | $registryKey = $_.Name 175 | if (Test-Path $registryKey) { 176 | Remove-Item -Path $registryKey -Force -ErrorAction SilentlyContinue 177 | } 178 | } 179 | 180 | Get-ChildItem "$store\Deleted\EndOfLife" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_ -like "*${i}*" } | ForEach-Object { 181 | $registryKey = $_.Name 182 | if (Test-Path $registryKey) { 183 | Remove-Item -Path $registryKey -Force -ErrorAction SilentlyContinue 184 | } 185 | } 186 | } 187 | 188 | # extra cleanup 189 | $desktop = [Environment]::GetFolderPath('Desktop') 190 | $appdata = [Environment]::GetFolderPath('ApplicationData') 191 | 192 | Remove-Item -Path "$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue 193 | Remove-Item -Path "$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue 194 | Remove-Item -Path "$desktop\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue 195 | 196 | 197 | $IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options' 198 | $MSEP = ("$env:ProgramFiles", "$env:ProgramFiles(x86)")[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application' 199 | $MIN = ('--headless', '--width 1 --height 1')[([Environment]::OSVersion.Version.Build) -gt 25179] 200 | $CMD = "$env:systemroot\system32\conhost.exe $MIN" 201 | $DIR = (Get-Location).Path 202 | Write-Host "PRINTING dir" 203 | Write-Host $DIR 204 | 205 | Write-Host "printing msep" 206 | Write-Host $MSEP 207 | 208 | Write-Host "printing min" 209 | Write-Host $MIN 210 | 211 | Write-Host "printing cmd" 212 | Write-Host $CMD 213 | Write-Host "printing ifeo" 214 | Write-Host $IFEO 215 | 216 | 217 | # Set the registry keys for microsoft-edge protocol 218 | Set-ItemProperty -Path 'REGISTRY::HKEY_CLASSES_ROOT\microsoft-edge' -Name '(Default)' -Value 'URL:microsoft-edge' -Force 219 | Set-ItemProperty -Path 'REGISTRY::HKEY_CLASSES_ROOT\microsoft-edge' -Name 'URL Protocol' -Value '' -Force 220 | Set-ItemProperty -Path 'REGISTRY::HKEY_CLASSES_ROOT\microsoft-edge' -Name 'NoOpenWith' -Value '' -Force 221 | New-Item -Path 'REGISTRY::HKEY_CLASSES_ROOT\microsoft-edge\shell\open\command' -Name '(Default)' -Value "$DIR\ie_to_edge_stub.exe %1" -Force 222 | 223 | 224 | New-Item -Path 'REGISTRY::HKEY_CLASSES_ROOT\MSEdgeHTM'-Name 'NoOpenWith' -Value '' -Force 225 | New-Item -Path 'REGISTRY::HKEY_CLASSES_ROOT\MSEdgeHTM\shell\open\command' -Name '(Default)' -Value "$DIR\ie_to_edge_stub.exe %1" -Force 226 | 227 | Write-Host '226' 228 | # Set the registry keys for ie_to_edge_stub.exe 229 | New-Item -Path "$IFEO\ie_to_edge_stub.exe" -Name 'UseFilter' -Value 1 -Force 230 | 231 | New-Item -Path "$IFEO\ie_to_edge_stub.exe\0" -Name 'FilterFullPath' -Value "$DIR\ie_to_edge_stub.exe" -Force 232 | New-Item -Path "$IFEO\ie_to_edge_stub.exe\0" -Name 'Debugger' -Value "$CMD $DIR\OpenWebSearch.cmd" -Force 233 | 234 | # Set the registry keys for msedge.exe 235 | New-Item -Path "$IFEO\msedge.exe" -Name 'UseFilter' -Value 1 -Force 236 | New-Item -Path "$IFEO\msedge.exe\0" -Name 'FilterFullPath' -Value "$MSEP\msedge.exe" -Force 237 | New-Item -Path "$IFEO\msedge.exe\0" -Name 'Debugger' -Value "$CMD $DIR\OpenWebSearch.cmd" -Force 238 | 239 | #Openwebsearch 240 | $OpenWebSearch = @' 241 | @title OpenWebSearch Redux & echo off & set ?= open start menu web search, widgets links or help in your chosen browser 242 | for /f %%E in ('"prompt $E$S& for %%e in (1) do rem"') do echo;%%E[2t 2>nul & rem AveYo: minimize prompt 243 | call :reg_var "HKCU\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" ProgID ProgID 244 | if /i "%ProgID%" equ "MSEdgeHTM" echo;Default browser is set to Edge! Change it or remove OpenWebSearch script. & pause & exit /b 245 | call :reg_var "HKCR\%ProgID%\shell\open\command" "" Browser 246 | set Choice=& for %%. in (%Browser%) do if not defined Choice set "Choice=%%~." 247 | call :reg_var "HKCR\MSEdgeMHT\shell\open\command" "" FallBack 248 | set "Edge=" & for %%. in (%FallBack%) do if not defined Edge set "Edge=%%~." 249 | set "URI=" & set "URL=" & set "NOOP=" & set "PassTrough=%Edge:msedge=edge%" 250 | set "CLI=%CMDCMDLINE:"=``% " 251 | if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe`` =%" 252 | if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe =%" 253 | if defined CLI set "CLI=%CLI:*msedge.exe`` =%" 254 | if defined CLI set "CLI=%CLI:*msedge.exe =%" 255 | set "FIX=%CLI:~-1%" 256 | if defined CLI if "%FIX%"==" " set "CLI=%CLI:~0,-1%" 257 | if defined CLI set "RED=%CLI:microsoft-edge=%" 258 | if defined CLI set "URL=%CLI:http=%" 259 | if defined CLI set "ARG=%CLI:``="%" 260 | if "%CLI%" equ "%RED%" (set NOOP=1) else if "%CLI%" equ "%URL%" (set NOOP=1) 261 | if defined NOOP if exist "%PassTrough%" start "" "%PassTrough%" %ARG% 262 | if defined NOOP exit /b 263 | set "URL=%CLI:*microsoft-edge=%" 264 | set "URL=http%URL:*http=%" 265 | set "FIX=%URL:~-2%" 266 | if defined URL if "%FIX%"=="``" set "URL=%URL:~0,-2%" 267 | call :dec_url 268 | start "" "%Choice%" "%URL%" 269 | exit 270 | 271 | :reg_var [USAGE] call :reg_var "HKCU\Volatile Environment" value-or-"" variable [extra options] 272 | set {var}=& set {reg}=reg query "%~1" /v %2 /z /se "," /f /e& if %2=="" set {reg}=reg query "%~1" /ve /z /se "," /f /e 273 | for /f "skip=2 tokens=* delims=" %%V in ('%{reg}% %4 %5 %6 %7 %8 %9 2^>nul') do if not defined {var} set "{var}=%%V" 274 | if not defined {var} (set {reg}=& set "%~3="& exit /b) else if %2=="" set "{var}=%{var}:*) =%"& rem AveYo: v3 275 | if not defined {var} (set {reg}=& set "%~3="& exit /b) else set {reg}=& set "%~3=%{var}:*) =%"& set {var}=& exit /b 276 | 277 | :dec_url brute url percent decoding 278 | set ".=%URL:!=}%"&setlocal enabledelayedexpansion& rem brute url percent decoding 279 | set ".=!.:%%={!" &set ".=!.:{3A=:!" &set ".=!.:{2F=/!" &set ".=!.:{3F=?!" &set ".=!.:{23=#!" &set ".=!.:{5B=[!" &set ".=!.:{5D=]!" 280 | set ".=!.:{40=@!"&set ".=!.:{21=}!" &set ".=!.:{24=$!" &set ".=!.:{26=&!" &set ".=!.:{27='!" &set ".=!.:{28=(!" &set ".=!.:{29=)!" 281 | set ".=!.:{2A=*!"&set ".=!.:{2B=+!" &set ".=!.:{2C=,!" &set ".=!.:{3B=;!" &set ".=!.:{3D==!" &set ".=!.:{25=%%!"&set ".=!.:{20= !" 282 | set ".=!.:{=%%!" &rem set ",=!.:%%=!" & if "!,!" neq "!.!" endlocal& set "URL=%.:}=!%" & call :dec_url 283 | endlocal& set "URL=%.:}=!%" & exit /b 284 | rem done 285 | '@ 286 | 287 | 288 | $OpenWebSearch_script_path = "$env:SystemDrive\Scripts\OpenWebSearch.cmd" 289 | [System.IO.File]::WriteAllText($OpenWebSearch_script_path, $OpenWebSearch, [System.Text.Encoding]::ASCII) -------------------------------------------------------------------------------- /edge.bat: -------------------------------------------------------------------------------- 1 | @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit /b 2 | #:: made by AveYo source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat 3 | sp 'HKCU:\Volatile Environment' 'Edge_Removal' @' 4 | 5 | $also_remove_webview = 1 6 | 7 | $host.ui.RawUI.WindowTitle = 'Edge Removal - AveYo, 2023.09.09' 8 | $remove_win32 = @("Microsoft Edge","Microsoft Edge Update"); $remove_appx = @("MicrosoftEdge"); $skip = @() # @("DevTools") 9 | if ($also_remove_webview -eq 1) {$remove_win32 += "Microsoft EdgeWebView"; $remove_appx += "WebExperience","Win32WebViewHost"} 10 | 11 | ## 1 bonus! enter into powershell console: firefox / edge / webview to install a browser / reinstall edge or webview after removal 12 | function global:firefox { $url = 'https://download.mozilla.org/?product=firefox-stub' 13 | $setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\Firefox Installer.exe" 14 | write-host $url; Invoke-WebRequest $url -OutFile $setup; start $setup 15 | } 16 | function global:edge { $url = 'https://go.microsoft.com/fwlink/?linkid=2108834&Channel=Stable&language=en' 17 | $setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\MicrosoftEdgeSetup.exe" 18 | write-host $url; Invoke-WebRequest $url -OutFile $setup; prepare_edge; start $setup 19 | } 20 | function global:webview { $url = 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' 21 | $setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\MicrosoftEdgeWebview2Setup.exe" 22 | write-host $url; Invoke-WebRequest $url -OutFile $setup; prepare_webview; start $setup 23 | } 24 | ## helper for set-itemproperty remove-itemproperty new-item remove-item with auto test-path 25 | function global:sp_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Set-ItemProperty @args} else { 26 | Microsoft.PowerShell.Management\New-Item $args[0] -force -ea 0 >''; Microsoft.PowerShell.Management\Set-ItemProperty @args} } 27 | function global:rp_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Remove-ItemProperty @args} } 28 | function global:ni_test_path { if (-not (test-path $args[0])) {Microsoft.PowerShell.Management\New-Item @args} } 29 | function global:ri_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Remove-Item @args} } 30 | foreach ($f in 'sp','rp','ni','ri') {set-alias -Name $f -Value "${f}_test_path" -Scope Local -Option AllScope -force -ea 0} 31 | ## helper for edge reinstall - remove bundled OpenWebSearch redirector and edgeupdate policies 32 | function global:prepare_edge { 33 | foreach ($f in 'ni','ri','sp','rp') {set-alias -Name $f -Value "${f}_test_path" -Scope Local -Option AllScope -force -ea 0} 34 | $MS=($env:ProgramFiles,${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem]+'\Microsoft\Edge\Application\msedge.exe' 35 | ri "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -recurse -force -ea 0 36 | ri "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -recurse -force -ea 0 37 | ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -recurse -force -ea 0 38 | ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -recurse -force -ea 0 39 | ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force -ea 0 >'' 40 | sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0 41 | ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force -ea 0 >'' 42 | sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0 43 | foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') { 44 | rp "$p\Microsoft\EdgeUpdate" 'InstallDefault' -force -ea 0 45 | rp "$p\Microsoft\EdgeUpdate" 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' -force -ea 0 46 | rp "$p\Microsoft\EdgeUpdate" 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' -force -ea 0 47 | } 48 | $edgeupdate='Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 49 | $webvupdate='Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' 50 | $on_actions='on-os-upgrade','on-logon','on-logon-autolaunch','on-logon-startup-boost' 51 | foreach ($p in 'HKLM:\SOFTWARE','HKLM:\SOFTWARE\Wow6432Node') { foreach ($launch in $on_actions) { 52 | ri "$p\$edgeupdate\Commands\$launch" -force -ea 0; ri "$p\$webvupdate\Commands\$launch" -force -ea 0 53 | }} 54 | } 55 | ## helper for webview reinstall - restore webexperience (widgets) if available 56 | function global:prepare_webview { 57 | $cfg = @{Register=$true; ForceApplicationShutdown=$true; ForceUpdateFromAnyVersion=$true; DisableDevelopmentMode=$true} 58 | dir "$env:ProgramFiles\WindowsApps\MicrosoftWindows.Client.WebExperience*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg 59 | dir "$env:SystemRoot\SystemApps\Microsoft.Win32WebViewHost*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg 60 | kill -name explorer -ea 0; if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer} 61 | } 62 | 63 | ## 2 enable admin privileges 64 | $D1=[uri].module.gettype('System.Diagnostics.Process')."GetM`ethods"(42) |where {$_.Name -eq 'SetPrivilege'} #`:no-ev-warn 65 | 'SeSecurityPrivilege','SeTakeOwnershipPrivilege','SeBackupPrivilege','SeRestorePrivilege'|foreach {$D1.Invoke($null, @("$_",2))} 66 | 67 | ## 3 shut edge & webview clone stuff down and gather install paths 68 | $shut = 'explorer','Widgets','widgetservice','msedgewebview2','MicrosoftEdge*','chredge','msedge','edge' 69 | $shut+= 'msteams','msfamily','WebViewHost','Clipchamp' 70 | cd $env:systemdrive; taskkill /im explorer.exe /f 2>&1 >''; foreach ($p in $shut) {kill -name $p -force -ea 0} 71 | prepare_edge 72 | ## clear win32 uninstall block 73 | foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') { foreach ($i in $remove_win32) { 74 | rp "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\$i" 'NoRemove' -force -ea 0 75 | ni "$hk\SOFTWARE${wow}\Microsoft\EdgeUpdateDev" -force >'' 76 | sp "$hk\SOFTWARE${wow}\Microsoft\EdgeUpdateDev" 'AllowUninstall' 1 -type Dword -force 77 | }}} 78 | ## find all Edge setup.exe and gather BHO paths for OpenWebSearch / MSEdgeRedirect usage 79 | $edges = @(); $bho = @(); 'LocalApplicationData','ProgramFilesX86','ProgramFiles' |foreach { 80 | $folder = [Environment]::GetFolderPath($_); $bho += dir "$folder\Microsoft\Edge*\ie_to_edge_stub.exe" -rec -ea 0 81 | if ($also_remove_webview -eq 1) {$edges += dir "$folder\Microsoft\Edge*\setup.exe" -rec -ea 0 |where {$_ -like '*EdgeWebView*'}} 82 | $edges += dir "$folder\Microsoft\Edge*\setup.exe" -rec -ea 0 |where {$_ -notlike '*EdgeWebView*'} 83 | } 84 | ## use dedicated C:\Scripts path to save OpenWebSearch (due to Sigma rules FUD) 85 | $DIR = "$env:SystemDrive\Scripts"; mkdir $DIR -ea 0 >'' 86 | ## export OpenWebSearch innovative redirector - used by MSEdgeRedirect as well 87 | foreach ($b in $bho) { if (test-path $b) { try {copy $b "$DIR\ie_to_edge_stub.exe" -force -ea 0} catch{} } } 88 | 89 | ## 4 remove found *Edge* appx packages with unblock tricks 90 | $provisioned = get-appxprovisionedpackage -online; $appxpackage = get-appxpackage -allusers; $eol = @() 91 | $store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore' 92 | $users = @('S-1-5-18'); if (test-path $store) {$users += $((dir $store -ea 0 |where {$_ -like '*S-1-5-21*'}).PSChildName)} 93 | foreach ($choice in $remove_appx) { if ('' -eq $choice.Trim()) {continue} 94 | foreach ($appx in $($provisioned |where {$_.PackageName -like "*$choice*"})) { 95 | $next = !1; foreach ($no in $skip) {if ($appx.PackageName -like "*$no*") {$next = !0}} ; if ($next) {continue} 96 | $PackageName = $appx.PackageName; $PackageFamilyName = ($appxpackage |where {$_.Name -eq $appx.DisplayName}).PackageFamilyName 97 | ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName 98 | foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageName" -force >''} ; $eol += $PackageName 99 | dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >'' 100 | remove-appxprovisionedpackage -packagename $PackageName -online -allusers >'' 101 | } 102 | foreach ($appx in $($appxpackage |where {$_.PackageFullName -like "*$choice*"})) { 103 | $next = !1; foreach ($no in $skip) {if ($appx.PackageFullName -like "*$no*") {$next = !0}} ; if ($next) {continue} 104 | $PackageFullName = $appx.PackageFullName; 105 | ni "$store\Deprovisioned\$appx.PackageFamilyName" -force >''; $PackageFullName 106 | foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageFullName" -force >''} ; $eol += $PackageFullName 107 | dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >'' 108 | remove-appxpackage -package $PackageFullName -allusers >'' 109 | } 110 | } 111 | 112 | ## 5 run found *Edge* setup.exe with uninstall args and wait in-between 113 | foreach ($setup in $edges) { if (test-path $setup) { 114 | if ($setup -like '*EdgeWebView*') {$target = "--msedgewebview"} else {$target = "--msedge"} 115 | $removal = "--uninstall $target --system-level --verbose-logging --force-uninstall" 116 | try {write-host $setup $removal; start -wait $setup -args $removal} catch {} 117 | do {sleep 3} while ((get-process -name 'setup','MicrosoftEdge*' -ea 0).Path -like '*\Microsoft\Edge*') 118 | }} 119 | 120 | ## 6 extra cleanup 121 | foreach ($PF in $env:ProgramFiles,${env:ProgramFiles(x86)}) { if (test-path "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe") { 122 | write-host "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe /uninstall" 123 | start -wait "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" -args '/uninstall' 124 | do {sleep 3} while ((get-process -name 'setup','MicrosoftEdge*' -ea 0).Path -like '*\Microsoft\Edge*') 125 | if ($also_remove_webview -eq 1) { foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') { 126 | ri "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -rec -force -ea 0 }} 127 | ri "$PF\Microsoft\EdgeUpdate" -rec -force -ea 0; Unregister-ScheduledTask -TaskName MicrosoftEdgeUpdate* -Confirm:$false -ea 0 128 | } 129 | }} 130 | $appdata = $([Environment]::GetFolderPath('ApplicationData')) 131 | ri "$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -force 132 | ri "$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -force 133 | 134 | ## undo eol unblock trick to prevent latest cumulative update (LCU) failing 135 | foreach ($sid in $users) { foreach ($PackageName in $eol) {ri "$store\EndOfLife\$sid\$PackageName" -force >''} } 136 | 137 | ## set (almost) useless policies to prevent unsolicited reinstalls 138 | foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') { 139 | ni "$p\Microsoft\EdgeUpdate" -force >'' 140 | sp "$p\Microsoft\EdgeUpdate" 'InstallDefault' 0 -type Dword -force 141 | sp "$p\Microsoft\EdgeUpdate" 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 0 -type Dword -force 142 | sp "$p\Microsoft\EdgeUpdate" 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' 1 -type Dword -force 143 | sp "$p\Microsoft\EdgeUpdate" 'DoNotUpdateToEdgeWithChromium' 1 -type Dword -force 144 | } 145 | $edgeupdate='Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 146 | $webvupdate='Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' 147 | $on_actions='on-os-upgrade','on-logon','on-logon-autolaunch','on-logon-startup-boost' 148 | foreach ($p in 'HKLM:\SOFTWARE','HKLM:\SOFTWARE\Wow6432Node') { foreach ($launch in $on_actions) { 149 | ni "$p\$edgeupdate\Commands\$launch" -force >''; sp "$p\$edgeupdate\Commands\$launch" 'CommandLine' 'systray.exe' -force 150 | ni "$p\$webvupdate\Commands\$launch" -force >''; sp "$p\$webvupdate\Commands\$launch" 'CommandLine' 'systray.exe' -force 151 | }} 152 | 153 | ## 7 add bundled OpenWebSearch script to redirect microsoft-edge: anti-competitive links to the default browser 154 | $MSEP = ($env:ProgramFiles,${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application' 155 | $IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options' 156 | $MIN = ('--headless','--width 1 --height 1')[([environment]::OSVersion.Version.Build) -gt 25179] 157 | $CMD = "$env:systemroot\system32\conhost.exe $MIN" # AveYo: minimize prompt - see Terminal issue #13914 158 | ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force >'' 159 | sp "HKLM:\SOFTWARE\Classes\microsoft-edge" '(Default)' 'URL:microsoft-edge' -force 160 | sp "HKLM:\SOFTWARE\Classes\microsoft-edge" 'URL Protocol' '' -force 161 | sp "HKLM:\SOFTWARE\Classes\microsoft-edge" 'NoOpenWith' '' -force 162 | sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$DIR\ie_to_edge_stub.exe`" %1" -force 163 | ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force >'' 164 | sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM" 'NoOpenWith' '' -force 165 | sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$DIR\ie_to_edge_stub.exe`" %1" -force 166 | ni "$IFEO\ie_to_edge_stub.exe\0" -force >'' 167 | sp "$IFEO\ie_to_edge_stub.exe" 'UseFilter' 1 -type Dword -force 168 | sp "$IFEO\ie_to_edge_stub.exe\0" 'FilterFullPath' "$DIR\ie_to_edge_stub.exe" -force 169 | sp "$IFEO\ie_to_edge_stub.exe\0" 'Debugger' "$CMD $DIR\OpenWebSearch.cmd" -force 170 | ni "$IFEO\msedge.exe\0" -force >'' 171 | sp "$IFEO\msedge.exe" 'UseFilter' 1 -type Dword -force 172 | sp "$IFEO\msedge.exe\0" 'FilterFullPath' "$MSEP\msedge.exe" -force 173 | sp "$IFEO\msedge.exe\0" 'Debugger' "$CMD $DIR\OpenWebSearch.cmd" -force 174 | 175 | $OpenWebSearch = @$ 176 | @title OpenWebSearch Redux & echo off & set ?= open start menu web search, widgets links or help in your chosen browser - by AveYo 177 | for /f %%E in ('"prompt $E$S& for %%e in (1) do rem"') do echo;%%E[2t 2>nul & rem AveYo: minimize prompt 178 | call :reg_var "HKCU\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" ProgID ProgID 179 | if /i "%ProgID%" equ "MSEdgeHTM" echo;Default browser is set to Edge! Change it or remove OpenWebSearch script. & pause & exit /b 180 | call :reg_var "HKCR\%ProgID%\shell\open\command" "" Browser 181 | set Choice=& for %%. in (%Browser%) do if not defined Choice set "Choice=%%~." 182 | call :reg_var "HKCR\MSEdgeMHT\shell\open\command" "" FallBack 183 | set "Edge=" & for %%. in (%FallBack%) do if not defined Edge set "Edge=%%~." 184 | set "URI=" & set "URL=" & set "NOOP=" & set "PassTrough=%Edge:msedge=edge%" 185 | set "CLI=%CMDCMDLINE:"=``% " 186 | if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe`` =%" 187 | if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe =%" 188 | if defined CLI set "CLI=%CLI:*msedge.exe`` =%" 189 | if defined CLI set "CLI=%CLI:*msedge.exe =%" 190 | set "FIX=%CLI:~-1%" 191 | if defined CLI if "%FIX%"==" " set "CLI=%CLI:~0,-1%" 192 | if defined CLI set "RED=%CLI:microsoft-edge=%" 193 | if defined CLI set "URL=%CLI:http=%" 194 | if defined CLI set "ARG=%CLI:``="%" 195 | if "%CLI%" equ "%RED%" (set NOOP=1) else if "%CLI%" equ "%URL%" (set NOOP=1) 196 | if defined NOOP if exist "%PassTrough%" start "" "%PassTrough%" %ARG% 197 | if defined NOOP exit /b 198 | set "URL=%CLI:*microsoft-edge=%" 199 | set "URL=http%URL:*http=%" 200 | set "FIX=%URL:~-2%" 201 | if defined URL if "%FIX%"=="``" set "URL=%URL:~0,-2%" 202 | call :dec_url 203 | start "" "%Choice%" "%URL%" 204 | exit 205 | 206 | :reg_var [USAGE] call :reg_var "HKCU\Volatile Environment" value-or-"" variable [extra options] 207 | set {var}=& set {reg}=reg query "%~1" /v %2 /z /se "," /f /e& if %2=="" set {reg}=reg query "%~1" /ve /z /se "," /f /e 208 | for /f "skip=2 tokens=* delims=" %%V in ('%{reg}% %4 %5 %6 %7 %8 %9 2^>nul') do if not defined {var} set "{var}=%%V" 209 | if not defined {var} (set {reg}=& set "%~3="& exit /b) else if %2=="" set "{var}=%{var}:*) =%"& rem AveYo: v3 210 | if not defined {var} (set {reg}=& set "%~3="& exit /b) else set {reg}=& set "%~3=%{var}:*) =%"& set {var}=& exit /b 211 | 212 | :dec_url brute url percent decoding by AveYo 213 | set ".=%URL:!=}%"&setlocal enabledelayedexpansion& rem brute url percent decoding 214 | set ".=!.:%%={!" &set ".=!.:{3A=:!" &set ".=!.:{2F=/!" &set ".=!.:{3F=?!" &set ".=!.:{23=#!" &set ".=!.:{5B=[!" &set ".=!.:{5D=]!" 215 | set ".=!.:{40=@!"&set ".=!.:{21=}!" &set ".=!.:{24=$!" &set ".=!.:{26=&!" &set ".=!.:{27='!" &set ".=!.:{28=(!" &set ".=!.:{29=)!" 216 | set ".=!.:{2A=*!"&set ".=!.:{2B=+!" &set ".=!.:{2C=,!" &set ".=!.:{3B=;!" &set ".=!.:{3D==!" &set ".=!.:{25=%%!"&set ".=!.:{20= !" 217 | set ".=!.:{=%%!" &rem set ",=!.:%%=!" & if "!,!" neq "!.!" endlocal& set "URL=%.:}=!%" & call :dec_url 218 | endlocal& set "URL=%.:}=!%" & exit /b 219 | rem done 220 | 221 | $@ 222 | [io.file]::WriteAllText("$DIR\OpenWebSearch.cmd", $OpenWebSearch) 223 | 224 | ## 8 done 225 | $done = gp 'Registry::HKEY_Users\S-1-5-21*\Volatile*' Edge_Removal -ea 0; if ($done) {rp $done.PSPath Edge_Removal -force -ea 0} 226 | if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer} 227 | 228 | ## 9 bonus enter into powershell console: firefox / edge / webview to install a browser / reinstall edge or webview after removal 229 | ${.} = [char]27; $firefox = "${.}[38;2;255;165;0m firefox"; $edge = "${.}[94m edge${.}[97m"; $webview = "${.}[94mwebview ${.}[97m" 230 | write-host "`n${.}[40;32m EDGE REMOVED! ${.}[97m -GET-ANOTHER-BROWSER? ENTER:$firefox ${.}[97m -REINSTALL? ENTER:$edge / $webview" 231 | 232 | 233 | ## 0 ask to run script as admin 234 | '@.replace("$@","'@").replace("@$","@'") -force -ea 0; $code='gp ''Registry::HKEY_Users\S-1-5-21*\Volatile*'' Edge_Removal -ea 0' 235 | start powershell -args "-nop -noe -c & {iex(($code)[0].Edge_Removal)}" -verb runas 236 | $_Press_Enter 237 | #:: 238 | --------------------------------------------------------------------------------