不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2022-12-22 23:37:21  修改时间:2024-04-30 23:05:59  分类:数据采集/桌面自动化  编辑

Google Chrome 及基于其开源版本 Chromium 实现的衍生浏览器【国外各种(Microsoft Edge 等),国产各种......】不仅没有禁用自动更新的配置,而且是强制自动更新如同病毒病毒肆虐一般难以控制,非常不尊重用户。即使我们使用变通方法屏蔽了自动更新,它们竟然还会不停的提示软件已经过期。

打开 Windows PowerShell 直接复制以下脚本运行一下更加方便:

或者将脚本保存为 disable-chrome-auto-update.ps1 文件,右键点击 “使用 PowerShell 运行” 即可快速完成。

if ([Environment]::Is64BitOperatingSystem -eq "True") {
    #Write-Host "64-bit OS"
    $PF=${env:ProgramFiles(x86)}
}
else {
    #Write-Host "32-bit OS"
    $PF=$env:ProgramFiles
}

if ($(Test-Path "$env:ProgramFiles\Google\Chrome\Application\chrome.exe") -eq "true") {
    # 结束进程
    taskkill /im chrome.exe /f
    taskkill /im GoogleUpdate.exe /f
    # Google Chrome 更新服务 (sysin)
    #这里也可以使用 sc.exe stop "service name"
    Stop-Service -Name "gupdate"
    Stop-Service -Name "gupdatem"
    Stop-Service -Name "GoogleChromeElevationService"
    # Windows 10 默认 PS 版本 5.1 没有 Remove-Service 命令
    # This cmdlet was added in PS v6. See https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6#cmdlet-updates.
    #Remove-Service -Name "gupdate"
    #Remove-Service -Name "gupdatem"
    #Remove-Service -Name "GoogleChromeElevationService"
    # sc 在 PowerShell 中是 Set-Content 别名,所以要使用 sc.exe 否则执行后无任何效果
    sc.exe delete "gupdate"
    sc.exe delete "gupdatem"
    sc.exe delete "GoogleChromeElevationService"
    # 任务计划企业版
    #schtasks.exe /Delete /TN \GoogleUpdateBrowserReplacementTask /F
    #schtasks.exe /Delete /TN \GoogleUpdateTaskMachineCore /F
    #schtasks.exe /Delete /TN \GoogleUpdateTaskMachineUA /F
    Get-ScheduledTask -taskname GoogleUpdate* | Unregister-ScheduledTask -Confirm: $false
    # 移除更新程序
    Remove-Item "$PF\Google\Update\" -Recurse -Force
    Write-Output "Disable Google Chrome Enterprise x64 Auto Update Successful!"
}
elseif ($(Test-Path "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe") -eq "true") {
    # 结束进程
    taskkill /im chrome.exe /f
    taskkill /im GoogleUpdate.exe /f
    # 删除 Google Chrome 更新服务
    #这里也可以使用 sc.exe stop "service name"
    Stop-Service -Name "gupdate"
    Stop-Service -Name "gupdatem"
    Stop-Service -Name "GoogleChromeElevationService"
    # Windows 10 默认 PS 版本 5.1 没有 Remove-Service 命令,糟糕!
    # This cmdlet was added in PS v6. See https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6#cmdlet-updates.
    #Remove-Service -Name "gupdate"
    #Remove-Service -Name "gupdatem"
    #Remove-Service -Name "GoogleChromeElevationService"
    # sc 在 PowerShell 中是 Set-Content 别名,所以要使用 sc.exe 否则执行后无任何效果
    sc.exe delete "gupdate"
    sc.exe delete "gupdatem"
    sc.exe delete "GoogleChromeElevationService"
    # 删除任务计划
    #schtasks.exe /Delete /TN \GoogleUpdateBrowserReplacementTask /F
    #schtasks.exe /Delete /TN \GoogleUpdateTaskMachineCore /F
    #schtasks.exe /Delete /TN \GoogleUpdateTaskMachineUA /F
    Get-ScheduledTask -taskname GoogleUpdate* | Unregister-ScheduledTask -Confirm: $false
    # 移除更新程序
    Remove-Item "$PF\Google\Update\" -Recurse -Force
    Write-Output "Disable Google Chrome Enterprise x86 Auto Update Successful!"
}
else {
    Write-Output "No Google Chrome Enterprise Installation Detected!"
}

 

 

摘自:https://zhuanlan.zhihu.com/p/349454190