[DISCUSSION] Microsoft Edge

Discussion in 'Application Software' started by SAM-R, Mar 18, 2019.

  1. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    #2881 spanishfly, Nov 13, 2021
    Last edited: Nov 21, 2021
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    #2882 AveYo, Nov 13, 2021
    Last edited: Feb 8, 2022
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    :D:clap3:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. crven-gjaol

    crven-gjaol MDL Novice

    Oct 21, 2021
    38
    8
    0
    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.
     
  5. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. crven-gjaol

    crven-gjaol MDL Novice

    Oct 21, 2021
    38
    8
    0
    #2886 crven-gjaol, Nov 20, 2021
    Last edited: Nov 20, 2021
    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.
     
  7. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    #2887 spanishfly, Nov 21, 2021
    Last edited: Nov 21, 2021
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    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).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    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,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    #2890 AveYo, Nov 23, 2021
    Last edited: Nov 23, 2021
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    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.
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. Gaesthy

    Gaesthy MDL Novice

    Aug 10, 2017
    8
    2
    0
  14. fLOW.

    fLOW. MDL Senior Member

    Jul 28, 2009
    475
    571
    10
    #2895 fLOW., Nov 27, 2021
    Last edited: Nov 27, 2021
    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
     
  15. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    #2896 AveYo, Nov 27, 2021
    Last edited: Nov 27, 2021
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. fLOW.

    fLOW. MDL Senior Member

    Jul 28, 2009
    475
    571
    10
    Even better! Thank you very much, works perfect :)
     
  17. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,685
    60
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. wmn

    wmn MDL Junior Member

    Feb 24, 2010
    64
    43
    0
    Script work on Windows 11 but not on Windows 10 (10.0.19044.1387).
     
  19. ElectroChef

    ElectroChef MDL Novice

    Dec 2, 2018
    2
    0
    0
    Does anyone here have the x64 Evergreen Standalone Installer version 95.0.1020.53?
    Thanks.