Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

545

Downloads of v 1.0.2:

386

Last Update:

15 Jan 2024

Package Maintainer(s):

Software Author(s):

  • bcurran3

Tags:

bcurran3 unofficial ccu choco upgrade all cup

(unofficial) Chocolatey Continuous Upgrader (CCU) (Script)

  • 1
  • 2
  • 3

1.0.2 | Updated: 15 Jan 2024

Downloads:

545

Downloads of v 1.0.2:

386

Maintainer(s):

Software Author(s):

  • bcurran3

(unofficial) Chocolatey Continuous Upgrader (CCU) (Script) 1.0.2

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install (unofficial) Chocolatey Continuous Upgrader (CCU) (Script), run the following command from the command line or from PowerShell:

>

To upgrade (unofficial) Chocolatey Continuous Upgrader (CCU) (Script), run the following command from the command line or from PowerShell:

>

To uninstall (unofficial) Chocolatey Continuous Upgrader (CCU) (Script), run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade choco-continuous-upgrader -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade choco-continuous-upgrader -y --source="'INTERNAL REPO URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install choco-continuous-upgrader
  win_chocolatey:
    name: choco-continuous-upgrader
    version: '1.0.2'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'choco-continuous-upgrader' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '1.0.2'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller choco-continuous-upgrader
{
    Name     = "choco-continuous-upgrader"
    Version  = "1.0.2"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'choco-continuous-upgrader':
  ensure   => '1.0.2',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator Windos on 16 Jan 2024.

Description


choco://choco-continuous-upgrader

To use choco:// protocol URLs, install (unofficial) choco:// Protocol support


Screenshot of choco-continuous-upgrader
Click here for secret GeekMode screenshot

This package is a pseudo replacement for choco-upgrade-all-at which is a pseudo replacement for choco-upgrade-all-at-startup. (Got that? There will be a pop quiz!) CCU is a result of my obsessive desire to keep my Chocolatey packages up-to-date.

DO YOU WANT TO UPGRADE YOUR CHOCOLATEY PACKAGES CONTINUOUSLY THROUGHOUT THE DAY?

YOU JUST FOUND THE EASIEST WAY!

HOW DOES IT WORK?

CCU starts a background PowerShell process which continuously checks FeedBurner for recently published Chocolatey packages. When locally installed packages are found in the feed, they are automatically upgraded.

CCU defaults to checking every 30 minutes, automatically upgrading packages, and no foreground notifications. These defaults are overridable and configurable; e.g. you could use CCU to just notify you of upgrades every hour without automatically installing them.

Install my choco-toast-notifications.hook to enable beautiful foreground toast notifications of package installs, upgrades, and uninstalls. If you plan to use CCU only for notifications of upgrades without having them automatically installed, I recommend using burnttoast-psmodule for those notifications.

USAGE INSTRUCTIONS:

CCU -Start will start CCU with defaults or your preferences if you created a config file.
CCU -Stop to stop CCU.
CCU -Status will display CCU's running options and packages that have been upgraded or waiting to be upgraded since last check.
CCU -Notify (assumes -Start) will send foreground notifications of upgrades using either BurntToast or MSG.
CCU -NoUpgrades (assumes -Start) will check for upgrades but not automatically install them.
CCU -UpgradeAll (assumes -Start) runs 'choco upgrade all -y' before continuously checking for upgrades.
CCU -CreateConfig to set your preferences.
CCU -CreateTask to set CCU to run on bootup.
CCU -Help for more info.

PACKAGE NOTES

If you find choco-continuous-upgrader (CCU) useful, and I suspect you will, please consider donating: https://www.paypal.me/bcurran3donations or become a patron at https://www.patreon.com/bcurran3


tools\.SkipAutoUninstaller
 
tools\CCU.ps1
#Requires -RunAsAdministrator
#$ErrorActionPreference = 'Stop'
# CCU.ps1 (Chocolatey Continuous Upgrader) Copyleft 2023 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues if you have suggestions for improvement.

param (
	[Alias("?")][switch]$Help,
    [switch]$Start,
    [switch]$Stop,
    [switch]$Status,
	[Alias("Notifications")][switch]$Notify,
	[Alias("DoNotUpgrade")][switch]$NoUpgrades,
	[Alias("UpgradeAll")][switch]$UpgradeAllFirst,
	[Alias("EditConfig")][switch]$CreateConfig,
	[switch]$DeleteConfig,
	[Alias("CreateTask")][switch]$CreateScheduledTask,
	[Alias("DeleteTask")][switch]$DeleteScheduledTask,
    [Alias("GeekMode")][switch]$Debug,
	[int]$WaitTime
 )

Write-Host "CCU.ps1 v1.0.2 (2024/01/14) - (unofficial) Chocolatey Continuous Upgrader" -Foreground White
Write-Host "Copyleft 2023 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White

if (!$env:ChocolateyToolsLocation) {$env:ChocolateyToolsLocation = "$ENV:SystemDrive\tools"}
$ErrorActionPreference = 'Stop'
$Background=$True
$CCUconfig="$env:chocolateyToolsLocation\BCURRAN3\CCU.config"
$RunningFile="$env:chocolateyToolsLocation\BCURRAN3\CCU-running.tmp"
$StatusFile="$env:chocolateyToolsLocation\BCURRAN3\CCU-status.tmp"
$execdir=(Split-Path -parent $MyInvocation.MyCommand.Definition)

function create_config {
	Write-Host "  ** Creating CCU config file:`n" -Foreground Magenta
	if (Test-Path "$CCUconfig") {Remove-Item "$CCUconfig" -Force}
	
	do {
		$ConfigNotify=Read-Host "     CCU notifications (True/False)? "
	} until (($ConfigNotify -eq 'true') -or ($ConfigNotify -eq 'false'))
	do {
		$ConfigNoUpgrades=Read-Host "     Disable CCU automatic upgrades (True/False)? "
	} until (($ConfigNoUpgrades -eq 'true') -or ($ConfigNoUpgrades -eq 'false'))
	do {
		$ConfigUpgradeAllFirst=Read-Host "     CCU upgrade all packages on run? (True/False)? "
	} until (($ConfigUpgradeAllFirst -eq 'true') -or ($ConfigUpgradeAllFirst -eq 'false'))
	do {
		[int]$ConfigWaitTime=Read-Host "     CCU wait time (# of minutes)? "
	} until ($ConfigWaitTime -is [int])
	
	$ConfigFile = New-Object System.XMl.XmlTextWriter("$CCUconfig", $Null)
	$ConfigFile.Formatting = 'Indented'
    $ConfigFile.Indentation = 1
    $ConfigFile.IndentChar = "`t"
	$ConfigFile.WriteStartDocument()
	$ConfigFile.WriteStartElement("Preferences")
    $ConfigFile.WriteElementString("Notify","$ConfigNotify")
	$ConfigFile.WriteElementString("NoUpgrades","$ConfigNoUpgrades")
	$ConfigFile.WriteElementString("UpgradeAllFirst","$ConfigUpgradeAllFirst")
	$ConfigFile.WriteElementString("WaitTime","$ConfigWaitTime")
	$ConfigFile.WriteEndDocument()
    $ConfigFile.Flush()
    $ConfigFile.Close()
	Write-Host "`n  ** Created $CCUconfig." -Foreground Magenta
	if (Test-Path "$RunningFile") {
		Write-Host "  ** Restart CCU for defaults to take effect." -Foreground Yellow
	}
	Write-Host ""
}

function delete_config {
	if (Test-Path "$CCUconfig") {
		Remove-Item "$CCUconfig"
	    Write-Host "  ** Deleted $CCUconfig`n" -Foreground Magenta
	} else {
		Write-Host "  ** CCU config file not found.`n" -Foreground Yellow
	}
}

function create_scheduledtask {
	if (!(Test-Path "$CCUconfig")) {
		Write-Host "  ** CCU config file not found." -Foreground Yellow
		Write-Host "  ** CCU needs defaults to run as a scheduled task." -Foreground Yellow
		Write-Host "  ** Run `'CCU -CreateConfig`' to set defaults.`n" -Foreground Yellow
		return
	}
	Write-Host "  ** Creating CCU scheduled task.`n" -Foreground Magenta
    $ErrorActionPreference = 'SilentlyContinue'
    $GotTask = (&schtasks.exe /query /tn "CCU") 2> $null
    $ErrorActionPreference = 'Stop'
    if ($GotTask){
      &schtasks.exe /DELETE /TN "CCU" /F
    }
    SchTasks /Create /SC ONSTART /RU $(whoami) /RP /RL HIGHEST /TN "CCU" /TR "%ChocolateyInstall%\bin\CCU.bat" /F
    Write-Host "`n  ** CCU will run at Windows startup.`n" -Foreground Yellow
}

function delete_scheduledtask {
    $ErrorActionPreference = 'SilentlyContinue'
    $GotTask = (&schtasks.exe /query /tn "CCU") 2> $null
    $ErrorActionPreference = 'Stop'
    if ($GotTask){
      &schtasks.exe /DELETE /TN "CCU" /F
	  Write-Host "`n  ** CCU scheduled task deleted.`n" -Foreground Magenta
    } else {
		Write-Host "  ** No CCU scheduled task to delete.`n" -Foreground Yellow
	}
}

function print_footer {
	Write-Host "Found CCU.ps1 useful?" -ForegroundColor White
    Write-Host "Buy me a beer at https://www.paypal.me/bcurran3donations" -ForegroundColor White
    Write-Host "Become a patron at https://www.patreon.com/bcurran3" -ForegroundColor White
}

if (Test-Path "$RunningFile") {
	$created=(Get-ChildItem "$RunningFile").LastWriteTime
	$rebooted=(Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime).LastBootUpTime
	if ($created -lt $rebooted) {
		Write-Host " ** CCU detected a reboot while previously running." -Foreground Yellow
		Write-Host " ** Deleting temp file.`n" -Foreground Magenta
		Remove-Item $RunningFile
		}
}

if ($CreateConfig) {create_config; return}
if ($DeleteConfig) {delete_config; return}
if ($CreateScheduledTask) {create_scheduledtask; return}
if ($DeleteScheduledTask) {delete_scheduledtask; return}

if (!$Start -and !$Stop -and !$Status -and !$Help -and !$Notify -and !$NoUpgrades -and !$Debug -and !$WaitTime) {
	$MiniHelp=$True
	if (Test-Path "$CCUconfig") {
		[xml]$ConfigFile = Get-Content "$CCUconfig"
        if ($ConfigFile.Preferences.Notify -eq 'true') {$Notify=$True}
        if ($ConfigFile.Preferences.NoUpgrades -eq 'true') {$NoUpgrades=$True}
		if ($ConfigFile.Preferences.UpgradeAllFirst -eq 'true') {$UpgradeAllFirst=$True}
        if ($ConfigFile.Preferences.WaitTime) {$WaitTime=$ConfigFile.Preferences.WaitTime}
	    $Start=$True
		$MiniHelp=$False
	}
	if (Test-Path "$RunningFile") {
		$Start=$False
		$Status=$True
		$MiniHelp=$False
	}
	if ($MiniHelp) {
		Write-Host "  ** Please run 'CCU -?' or 'CCU -help' for help menu.`n" -Foreground White
		return
	}
}

if ($Debug) {$Start=$True; $Background=$False}
if ($Notify) {$env:Notify=$True; $Start=$True} else {$env:Notify=$False}
if ($NoUpgrades) {$env:AutoUpgrade=$False; $Start=$True} else {$env:AutoUpgrade=$True}
if ($UpgradeAllFirst) {$env:UpgradeAllFirst=$True} else {$env:UpgradeAllFirst=$False}
if ($WaitTime) {$Start=$True}; if (!$WaitTime) {$WaitTime="30"} ; $env:WaitTime=$WaitTime
if ($Stop) {$Help=$False; $Start=$False; $Status=$False}

if ( $Help ) {
	Write-Host "OPTIONS AND SWITCHES:" -Foreground Magenta
	Write-Host " -Start"
	Write-Host "    Start checking for and install upgrades."
	Write-Host " -Stop"
	Write-Host "    Stop checking for upgrades."
	Write-Host " -Status"
	Write-Host "    Show CCU status."
	Write-Host " -Notify, -Notifications (assumes -Start)"
	Write-Host "    Send notifications when upgrades are found."
	Write-Host " -NoUpgrades, -DoNotUpgrade (assumes -Start)"
	Write-Host "    Disable auto-upgrading of packages."
	Write-Host " -UpgradeAll, -UpgradeAllFirst (assumes -Start)"
	Write-Host "    Run `'choco upgrade all -y`' before continuously checking for upgrades."
	Write-Host " #  (assumes -Start)"
	Write-Host "    Number of minutes to wait between checks for upgrades (default 30)."
	Write-Host " -CreateConfig, -EditConfig"
	Write-Host "    Creates CCU config file with your preferences."
	Write-Host " -DeleteConfig"
	Write-Host "    Deletes the CCU config file."
	Write-Host " -CreateTask, -CreateScheduledTask"
	Write-Host "    Creates a scheduled task to run CCU on system boot."
	Write-Host " -DeleteTask, -DeleteScheduledTask"
	Write-Host "    Deletes the scheduled task to run CCU on system boot."
	Write-Host " -GeekMode, -Debug (assumes -Start)"
	Write-Host "    Just for fun."
	Write-Host " -Help, -?"
	Write-Host "    This menu.`n"
	return
}

if ($Status) {
	if (Test-Path "$RunningFile") {
		Write-Host "  ** CCU is running." -Foreground Yellow
		if (Test-Path "$StatusFile") {
			foreach($line in Get-Content "$StatusFile") {
				Write-Host "$line" -Foreground Yellow
			}
		} else {
			Write-Host "  ** ERROR: Status file not found. Run `'CCU -Status`' again." -Foreground Red
			Write-Host "  ** ERROR: If this error continues, Run `'CCU -Stop`'" -Foreground Red
		}
	} else {
		Write-Host "  ** CCU is not running." -Foreground Yellow
	}
	if (Get-Process -Name choco -ErrorAction SilentlyContinue) {
		Write-Host "  ** Chocolatey is currently running.`n" -Foreground Yellow
	}
	Write-Host ""
	print_footer
	return
}

if ($Start) {
	if (Test-Path "$RunningFile") {
		Write-Host "  ** CCU is already running!`n" -Foreground Yellow
		return
	}
	if ($Background) {
		$CCUProcess = Start-Process PowerShell -ArgumentList '$host.ui.RawUI.WindowTitle=''Chocolatey Continuous Upgrader''; Import-Module ./CCU.psm1; for (;;) {keep_checking}' -WindowStyle Hidden -WorkingDirectory "$execdir" -PassThru
		$CCUProcess | Export-Clixml -Path "$RunningFile"
	}
	if ($Debug) {
		$CCUProcess = Start-Process PowerShell -ArgumentList '$host.ui.RawUI.WindowTitle=''Chocolatey Continuous Upgrader''; Import-Module ./CCU.psm1; for (;;) {keep_checking}' -WindowStyle Normal -WorkingDirectory "$execdir" -PassThru
		$CCUProcess | Export-Clixml -Path "$RunningFile"
	}
	Write-Host "  ** CCU STARTED." -Foreground Yellow
	if ($Notify) {Write-Host "  ** CCU notifications are ENABLED." -Foreground Yellow} else {Write-Host "  ** CCU notifications are DISABLED." -Foreground Yellow}
	if ($NoUpgrades) {Write-Host "  ** CCU package upgrades are DISABLED." -Foreground Yellow} else {Write-Host "  ** CCU package upgrades are ENABLED." -Foreground Yellow}
	Write-Host "  ** CCU will check for upgrades every $WaitTime minutes.`n" -Foreground Yellow
	print_footer
	return
}

if ($Stop) {
	if (Get-Process -Name choco -ErrorAction SilentlyContinue) {
		Write-Host "  ** Chocolatey is currently running. Waiting for it to finish..." -Foreground Yellow
		while (Get-Process -Name choco -ErrorAction SilentlyContinue) {Start-Sleep 1}
	}
	if (Test-Path "$RunningFile") {$CCUProcess = Import-Clixml -Path "$RunningFile"}
    $CCUProcess | Stop-Process -ErrorAction SilentlyContinue
	if (!$?) {
		Write-Host "  ** CCU already STOPPED!`n" -Foreground Yellow
	} else {
		Write-Host "  ** CCU STOPPED.`n" -Foreground Yellow
	}
	if (Test-Path "$RunningFile") {Remove-Item "$RunningFile" -Force}
	if (Test-Path "$StatusFile") {Remove-Item "$StatusFile" -Force}
	print_footer
	return
}
tools\CCU.psm1
# CCU.psm1 (Chocolatey Continuous Upgrader) Copyleft 2023 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues if you have suggestions for improvement.

if (Get-Module -ListAvailable -Name BurntToast) {$ToastAvailable=$True} else {$ToastAvailable=$False}
if (!$env:ChocolateyToolsLocation) {$env:ChocolateyToolsLocation = "$env:SystemDrive\tools"}
$StatusFile="$env:chocolateyToolsLocation\BCURRAN3\CCU-status.tmp"

if (Test-Path "$StatusFile") {Remove-Item "$StatusFile" -Force}
if ($env:AutoUpgrade -eq 'true') {$AutoUpgrade=$True} else {$AutoUpgrade=$False}
if ($env:Notify -eq 'true') {$Notify=$True} else {$Notify=$False}
if ($env:WaitTime -eq '') {$WaitTime=30} else {$WaitTime=$env:WaitTime}

# Send Windows MSG messages to foreground about available upgrades
function send_msg {
	& msg * /time:3 "Chocolatey Continuous Upgrader:`n$Feedpackage v$FeedPackageVersion`nUPGRADE AVAILABLE."
}

# Send toast messages to foreground about available upgrades
function send_toast {
	if ((Get-Service WinRM).Status -eq 'Stopped') {Start-Service 'WinRM' -ErrorAction SilentlyContinue}
	if ((Get-Service WinRM).Status -eq 'Running') {
		Invoke-Command -ComputerName $(hostname) -ArgumentList $FeedPackage,$FeedPackageVersion -ScriptBlock {param([string]$FeedPackage, [string]$FeedPackageVersion) Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force; New-BurntToastNotification -Text "Chocolatey Continuous Upgrader:`n", "$Feedpackage v$FeedPackageVersion `nUPGRADE AVAILABLE." -AppLogo "$env:PUBLIC\Pictures\choco.ico"}
	} else {
		send_msg
	}
}

function send_notification {
	if ($ToastAvailable -eq $True) {send_toast} else {send_msg}
}

# Meat and Potatoes
function keep_checking {

	Clear-Host
	if ($env:UpgradeAllFirst -eq 'true') {
		if ($Notify) {Add-Content -Path "$StatusFile" -Value "  ** CCU notifications are ENABLED."} else {Add-Content -Path "$StatusFile" -Value "  ** CCU notifications are DISABLED."}
	    if ($NoUpgrades) {Add-Content -Path "$StatusFile" -Value "  ** CCU package upgrades are DISABLED."} else {Add-Content -Path "$StatusFile" -Value "  ** CCU package upgrades are ENABLED."}
		Add-Content -Path "$StatusFile" -Value "  ** CCU will check for upgrades every $WaitTime minutes`n."
		Write-Host "  ** CCU UpgradeAllFirst is ENABLED." -Foreground Yellow
		Add-Content -Path "$StatusFile" -Value "  ** CCU UpgradeAllFirst is ENABLED."
		if (Get-Process -Name choco -ErrorAction SilentlyContinue) {
			Write-Host "  ** Chocolatey is running elsewhere. Waiting for it to finish..." -Foreground Yellow
			Add-Content -Path "$StatusFile" -Value "  ** Chocolatey is running elsewhere. Waiting for it to finish..."
            while (Get-Process -Name choco -ErrorAction SilentlyContinue) {Start-Sleep 1}
		} else {
			Write-Host "  ** CCU is running `'choco upgrade all -y`'." -Foreground Yellow
		    Add-Content -Path "$StatusFile" -Value "  ** CCU is running `'choco upgrade all -y`'"
		    & choco upgrade all -y
		}
		if (Test-Path "$StatusFile") {Remove-Item "$StatusFile"}
		$env:UpgradeAllFirst='false'
	}
    $FoundUpgrades=$False
	if (!$WaitTime) {$WaitTime=30}
	if ($Notify) {
		Write-Host "  ** CCU notifications are ENABLED." -Foreground Yellow
		Add-Content -Path "$StatusFile" -Value "  ** CCU notifications are ENABLED."
	} else {
		Write-Host "  ** CCU notifications are DISABLED." -Foreground Yellow
		Add-Content -Path "$StatusFile" -Value "  ** CCU notifications are DISABLED."
	}
    if ($AutoUpgrade) {
		Write-Host "  ** CCU package upgrades are ENABLED." -Foreground Yellow
		Add-Content -Path "$StatusFile" -Value "  ** CCU package upgrades are ENABLED."
	} else {
		Write-Host "  ** CCU package upgrades are DISABLED." -Foreground Yellow
		Add-Content -Path "$StatusFile" -Value "  ** CCU package upgrades are DISABLED."
	}
	Add-Content -Path "$StatusFile" -Value "  ** CCU is checking for upgrades every $WaitTime minutes."
    # Get list of installed packages
    Write-Host "  ** Getting list of installed Chocolatey packages..." -Foreground Magenta
    Write-Host "  ** Found $((Get-Childitem $env:ChocolateyInstall\lib).count) installed Chocolatey packages" -Foreground Green
    Write-Host "  ** Found $((Get-Childitem $env:ChocolateyInstall\extensions).count) installed Chocolatey extensions" -Foreground Green
    Write-Host "  ** Found $((Get-Childitem $env:ChocolateyInstall\hooks).count) installed Chocolatey hooks" -Foreground Green
    $InstalledPackages = Get-Childitem $env:ChocolateyInstall\lib | Split-Path -Leaf
    $InstalledPackages = $InstalledPackages + (Get-Childitem $env:ChocolateyInstall\extensions | Split-Path -Leaf)
    $InstalledPackages = $InstalledPackages + (Get-Childitem $env:ChocolateyInstall\hooks | Split-Path -Leaf)

    # Get Feedburner list of upgraded packages
    Write-Host "  ** Getting Feedburner list of recently published Chocolatey packages..." -Foreground Magenta
    try {
    	[xml]$feed = Invoke-WebRequest -Uri 'https://feeds.feedburner.com/chocolatey' | Select-Object -ExpandProperty Content
    }
    catch {
        if ( $_.Exception.Response.StatusCode.Value__ -eq 404 ) {
            Write-Host "  ** 404 error getting https://feeds.feedburner.com/chocolatey" -Foreground Red
			$WaitTimeRemaining=$WaitTime
	        Write-Host "  ** Waiting $WaitTimeRemaining minutes before checking again...`r" -Foreground Cyan -NoNewLine
            while ($WaitTimeRemaining -gt 0) {
				Write-Host "  ** Waiting $WaitTimeRemaining minutes before checking again...   `r" -Foreground Cyan -NoNewLine
	            Sleep 60
	            $WaitTimeRemaining=$WaitTimeRemaining-1
			}
    		return
        } else { Write-Host "  ** Bad response..." -Foreground Red }
    }
    $links = $feed.rss.channel.item.link

    Write-Host "  ** Found $($links.count) Chocolatey packages in Feedburner list." -Foreground Green
    Write-Host "  ** $($feed.rss.channel.item[$($links.count)-1].title) is the oldest Chocolatey package published at $([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date -Date $feed.rss.channel.item[$($links.count)-1].updated), $(Get-TimeZone).id))." -Foreground Green
    Write-Host "  ** $($feed.rss.channel.item[0].title) is the latest Chocolatey package published at $([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date -Date $feed.rss.channel.item[0].updated), $(Get-TimeZone).id))." -Foreground Green

    # Upgrade and/or notify about upgraded packages
	Write-Host "  ** CCU checked for upgrades at $(date)." -Foreground Magenta
	Add-Content -Path "$StatusFile" -Value ""
	Add-Content -Path "$StatusFile" -Value "  ** CCU checked for upgrades at $(date)."
    for ($link=0; $link -lt $links.count; $link++) {
        $FeedPackage = $links[$link] | split-path | split-path -leaf
    	$FeedPackageVersion = $links[$link] | split-path -leaf
        for ($installed=0; $installed -lt $InstalledPackages.count; $installed++) {
    		if ($InstalledPackages[$installed] -eq $FeedPackage) {
    			[xml]$nuspecFile = Get-Content "$env:ChocolateyInstall\lib\$FeedPackage\$FeedPackage.nuspec"
                $InstalledVersion=$nuspecFile.package.metadata.version
    			if ($FeedPackageVersion -gt $InstalledVersion) {
    				$FoundUpgrades=$True
                    Write-Host "  ** Found upgrade for $FeedPackage (v$FeedPackageVersion published $([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date -Date $feed.rss.channel.item[$link].updated), $(Get-TimeZone).id)))" -Foreground Magenta
					Add-Content -Path "$StatusFile" -Value "  ** Found upgrade for $FeedPackage (v$FeedPackageVersion published $([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date -Date $feed.rss.channel.item[$link].updated), $(Get-TimeZone).id)))"
    				if ($Notify) {send_notification}
    				if ($AutoUpgrade) {
						if (Get-Process -Name choco -ErrorAction SilentlyContinue) {
							Write-Host "  ** Chocolatey is running elsewhere. Waiting for it to finish..." -Foreground Yellow
                 		    while (Get-Process -Name choco -ErrorAction SilentlyContinue) {Start-Sleep 1}
	                    } else {
							& choco upgrade $FeedPackage -y
						    if (!$LASTEXITCODE) {
							   Add-Content -Path "$StatusFile" -Value "  ** choco upgrade of $FeedPackage SUCCESSFUL."
						    } else {
  							  Add-Content -Path "$StatusFile" -Value "  ** choco upgrade of $FeedPackage had ERRORS. ($LASTEXITCODE)"
						    }
						}
					}
    			}
    	    }
        }
    }
    if (!$FoundUpgrades) {
		Write-Host "  ** CCU found no packages to upgrade." -Foreground Magenta
		Add-Content -Path "$StatusFile" -Value "  ** CCU found no packages to upgrade."
		}
    $WaitTimeRemaining=$WaitTime
	Write-Host "  ** Waiting $WaitTimeRemaining minutes before checking again...`r" -Foreground Cyan -NoNewLine
    while ($WaitTimeRemaining -gt 0) {
		Write-Host "  ** Waiting $WaitTimeRemaining minutes before checking again...   `r" -Foreground Cyan -NoNewLine
	    Sleep 60
	    $WaitTimeRemaining=$WaitTimeRemaining-1
	}
	if (Test-Path "$StatusFile") {Remove-Item "$StatusFile"}
}
tools\chocolateyinstall.ps1
$ErrorActionPreference = 'Stop'
$packageName     = 'choco-continuous-upgrader'
$toolsDir        = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$scriptDir       = "$(Get-ToolsLocation)\BCURRAN3"
$script          = 'CCU.ps1'

# Setup
# New storage location moving forward for all my Chocolatey scripts
if (!(Test-Path "$(Get-ToolsLocation)\BCURRAN3")) { New-Item -Path "$(Get-ToolsLocation)" -Name "BCURRAN3" -ItemType "Directory" | Out-Null }

# Install Script
# Move new files and support files (if applicable)
Move-Item "$toolsDir\CCU.*" "$scriptDir" -Force -ErrorAction SilentlyContinue

# Create "shim"
Install-ChocolateyPowershellCommand -PackageName 'CCU' -PSFileFullPath "$scriptDir\$script"

Write-Host "  ** Type `'CCU`' at the command line to run Chocolatey Continuous Upgrader." -Foreground Magenta
tools\chocolateyuninstall.ps1
$ErrorActionPreference = 'Stop'
$packageName     = 'choco-continuous-upgrader'
$scriptDir       = "$(Get-ToolsLocation)\BCURRAN3"

Remove-Item "$scriptDir\CCU*.*" -Force -ErrorAction SilentlyContinue | Out-Null

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
(unofficial) Chocolatey Continuous Upgrader (CCU) (Script) 1.0.1 63 Monday, December 11, 2023 Approved
(unofficial) Chocolatey Continuous Upgrader (CCU) (Script) 1.0.0 36 Sunday, November 26, 2023 Approved
(unofficial) Chocolatey Continuous Upgrader (CCU) (Script) 1.0.0-RC2 26 Wednesday, November 22, 2023 Exempted
(unofficial) Chocolatey Continuous Upgrader (CCU) (Script) 1.0.0-RC1 25 Sunday, November 19, 2023 Exempted

CHANGELOG:

  • 1.0.2 - fixed bug where $env:ChocolateyToolsLocation wasn't defined before use
  • 1.0.1 - Re-worded some status messages and added timestamp to last check. If the event WinRM fails to start for toast notifications MSG will now be used.
  • 1.0.0 - initial release

ROADMAP

  • Nothing planned.
  • It would be neat to make a tray app that replicates GeekMode...

This package has no dependencies.

Discussion for the (unofficial) Chocolatey Continuous Upgrader (CCU) (Script) Package

Ground Rules:

  • This discussion is only about (unofficial) Chocolatey Continuous Upgrader (CCU) (Script) and the (unofficial) Chocolatey Continuous Upgrader (CCU) (Script) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or (unofficial) Chocolatey Continuous Upgrader (CCU) (Script), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus