停用Google Chrome自动更新

使用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 更新服务
    #这里也可以使用 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
    # 移除更新程序
    Remove-Item "$PF\Google\Update\" -Recurse  -Force
    echo "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
    # 移除更新程序
    Remove-Item "$PF\Google\Update\" -Recurse  -Force
    echo "Disable Google Chrome Enterprise x86 Auto Update Successful!"
}
else {
    echo "No Google Chrome Enterprise Installation Detected!"
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

躺在马桶看代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值