I might be dumb, but why does this not work when used as a PS script? Pasting the content in .ps1 file and then running it (after using bypass stuff) throws errors, but Just pasting it in powershell works like a charm.
Maybe your editor messed up line endings? Windows expects CRLF. Just download the zip attached, and rename the .bat file to .ps1 - it should work.
Yea, I'm dumb for not reading the error message. It was some encoding stuff in some lines like –Force which was the issues. Re-saving with utf8 (Windows 1252) in VS Code fixed it. As for files attached, I don't see any in the post you have with the script.
Thank you very much! Your Edge toggle works great! You probably already know that your a celebrity developer with a ChrEdgeFkOff_toggle GHACKS review. Congratulations! I was wondering if it was possible to incorporate into your toggle script the ability to enable and disable the three Edge update services? Right now, along with your Edge toggle script, I independently run the following PowerShell (Function) Scripts: DISABLE Edge Update Services.ps1 Code: $ServiceList = @( "MicrosoftEdgeElevationService", "edgeupdate", "edgeupdatem" ) Function Set-Privacy { [CmdletBinding()] Param () Clear-Host Write-Host "Disabling Edge Update Services" -NoNewline -ForegroundColor Cyan Write-Host '' # Disable services in the ServicesList. Get-Service | Where-Object Name -In $ServiceList | Where-Object { $_.StartType -ne 'Disabled' } | Set-Service -StartupType Disabled # Stop services in the ServicesList. Get-Service | Where-Object Name -In $ServiceList | Stop-Service Write-Output '' Write-Host "[Done]" -ForegroundColor Cyan } # Call the function right here, right now Set-Privacy ENABLE Edge Update Services.ps1 Code: $ServiceList = @( "MicrosoftEdgeElevationService", "edgeupdate", "edgeupdatem" ) Function Set-Privacy { [CmdletBinding()] Param () Clear-Host Write-Host "Restoring Edge Update Services" -NoNewline -ForegroundColor Cyan Write-Host '' # Set services in the ServicesList to default. Get-Service | Where-Object Name -In $ServiceList | Where-Object { $_.Name -eq "MicrosoftEdgeElevationService"} | Set-Service -StartupType Manual Get-Service | Where-Object Name -In $ServiceList | Where-Object { $_.Name -eq "edgeupdatem" } | Set-Service -StartupType Manual Get-Service | Where-Object Name -In $ServiceList | Where-Object { $_.Name -eq "edgeupdate" } | Set-Service -StartupType Automatic Write-Output '' Write-Host "[Done]" -ForegroundColor Cyan } # Call the function right here, right now Set-Privacy
What you're already doing is fine. Better to be separated, as I plan to still allow edge running for those that need it (atm it blocks it).
Thank you! How the script works now "block/unblock" is good for my needs. I prefer some kind toggle-style solution. Like you're Defender Toggle. If I need Edge, I can activate it and do what I need to do. Otherwise it's dormant,
Is your ChrEdgeFkOf solution (with Edge toggled 'off') enough to protect from the exploits? Awhile ago, I converted your "what to do"/"Paste the code" solution into a PowerShell script so I could call it from another script. I removed the bits that Microsoft broke. I'll put it here behind a spoiler. Let me know if you want me to delete it. Spoiler: BAU - Uninstall and block automatic install of Edge and Webview.ps1 Code: # Source: https://forums.mydigitallife.net/threads/microsoft-edge.79237/page-137#post-1630576 Write-Host -ForegroundColor Cyan "RIP Edge legacy app first" Write-Host '' $edges = (get-appxpackage -allusers *MicrosoftEdge*).PackageFullName $bloat = (get-appxprovisionedpackage -online |? {$_.PackageName -like '*MicrosoftEdge*'}).PackageName $users = ([wmi]"win32_userAccount.Domain='$env:userdomain',Name='$env:username'").SID,'S-1-5-18' $eoled = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife' foreach ($legacy in $bloat) { foreach ($user in $users) { ni "$eoled\$user\$legacy" –Force -ea 0 >$null } powershell -nop -c remove-appxprovisionedpackage -online -packagename $legacy 2>&1 >$null } foreach ($legacy in $edges) { foreach ($user in $users) { ni "$eoled\$user\$legacy" –Force -ea 0 >$null } powershell -nop -c remove-appxpackage -allusers -package $legacy 2>&1 >$null } Write-Host -ForegroundColor Cyan "remove ChrEdge lame uninstall block" Write-Host '' $uninstall = '\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge' foreach ($wow in '','\Wow6432Node') {'HKCU:','HKLM:' |% { rp $($_ + $wow + $uninstall) NoRemove -Force -ea 0 } } Write-Host -ForegroundColor Cyan "find all ChrEdge setup.exe" Write-Host '' $setup = @(); "LocalApplicationData","ProgramFilesX86","ProgramFiles" |% { $setup += dir $([Environment]::GetFolderPath($_) +'\Microsoft\Edge*\setup.exe') -rec -ea 0 } Write-Host -ForegroundColor Cyan "compute ChrEdge uninstall arguments" Write-Host '' $arg = @(); $u = '--uninstall'; $v = ' --verbose-logging --force-uninstall --delete-profile' foreach ($l in '',' --system-level'){ foreach ($m in ' --msedge',''){ if ($m -eq ''){$arg += $u + $l + $v} else { '-beta','-dev','-internal','-sxs','webview','' |% {$arg += $u + $l + $m + $_ + $v} } } } Write-Host -ForegroundColor Cyan "brute-run found ChrEdge setup.exe with uninstall args" Write-Host '' foreach ($ChrEdge in $setup){ foreach ($purge in $arg) { powershell -nop -c "start '$ChrEdge' -args '$purge'" 2>&1 >$null } } Write-Host -ForegroundColor Cyan "remove leftover shortcuts" Write-Host '' $IELaunch = '\Microsoft\Internet Explorer\Quick Launch' del $([Environment]::GetFolderPath('Desktop') + '\Microsoft Edge*.lnk') -Force -ea 0 >$null del $([Environment]::GetFolderPath('ApplicationData') + $IELaunch + '\Microsoft Edge*.lnk') -Force -ea 0 >$null del $($env:SystemRoot+'\System32\config\systemprofile\AppData\Roaming' + $IELaunch + '\Microsoft Edge*.lnk') -Force -ea 0 >$null Write-Host -ForegroundColor Cyan "Prevent reinstall via windows updates - Reinforced with BAU Toggle - Even if Edge is gone" Write-Host '' ni "HKLM:\SOFTWARE\Microsoft\EdgeUpdate" -Force -ea 0 >$null sp "HKLM:\SOFTWARE\Microsoft\EdgeUpdate" DoNotUpdateToEdgeWithChromium 1 -Type Dword -ea 0 Write-Host -ForegroundColor Cyan "refresh explorer" Write-Host '' kill -name 'sihost' Function Pause-Script { Write-Output '' Write-Host "When ready, press any key to continue." -ForegroundColor Green [void][Console]::ReadKey($true) } Pause-Script
I said before, ChrEdgeFkOff does just one thing - redirects startmenu/widgets msedge: links to your chosen default browser. It just happens that blocks msedge from running as a side-effect, but not the updating services and what-not. I encourage you to experiment and share your modifications, it's not something set in stone that nobody can even discuss. Tho it does not matter if ms broke some reg changes. I just instructed someone that got pwned yesterday to run the very first version I shared on reddit and it worked just fine on a fresh 21H2. He clicked the malware again and it did nothing with edge being nuked.
Is there a way to "translate" this into bat/cmd files like @BAU does with his scripts? So we can double click them instead of opening powershell every time we want to stop/start the services Using the context menu option "Run with Powershell" it does nothing. Might have something to do with the execution policy i guess, not really user friendly to adjust that on every machine IF a batch file is a possibility imo
toggle_edge_update.bat Code: @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b $_Paste_in_Powershell = { Function Toggle-EdgeUpdate { $ServiceList = 'MicrosoftEdgeElevationService', 'edgeupdate', 'edgeupdatem' $Restored = 'Manual', 'Manual', 'Automatic' $Disabled = 'Disabled', 'Disabled', 'Disabled' $status = 'Disabled' -eq (get-wmiobject win32_service -filter "Name='$($ServiceList[0])'").StartMode $toggle = ('Restoring', 'Disabling')[!$status] $change = ($Restored, $Disabled)[!$status] Write-Host Write-Host "$toggle Edge Update Services" -NoNewline -ForegroundColor Cyan Write-Host # Toggle services in the ServicesList 0..($ServiceList.count-1) |% { Set-Service -Name $ServiceList[$_] -StartupType $change[$_] } Write-Host Write-Host "[Done]" -ForegroundColor Cyan } # Call the function right here, right now Toggle-EdgeUpdate timeout /t 5 } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}" $_Press_Enter #:: something like this? took liberty to turn it into a toggle.
ChrEdgeFkOff v2.0 only redirects microsoft-edge: links, no longer blocks msedge.exe (with a junction trick). Highly recommended with ClearURLs and similar browser addons for filtering out unwanted tracking added to the urls.